コード例 #1
0
        public void RunCreateView()
        {
            string  name        = null;
            string  description = null;
            decimal price       = 0;

            Console.Clear();
            Console.WriteLine(ProductCommonOutputText.GetApplicationHeading());
            Console.WriteLine();
            Console.WriteLine(ProductCommonOutputText.GetColumnHeadings());
            Console.WriteLine();
            Console.Write("Enter product name:\t");
            name = Console.ReadLine();

            Console.Write("Enter product description:\t");
            description = Console.ReadLine();

            Console.Write("Enter price:\t");
            price = decimal.Parse(Console.ReadLine());

            Console.WriteLine();
            Console.WriteLine("Pls press [S] to save product to database");
            ConsoleKey consoleKey = Console.ReadKey().Key;

            if (consoleKey == ConsoleKey.S)
            {
                _products.Add(ProductObjectFactory.CreateNewProduct(name, description, price));
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: donell206/ProductLibrary
        static void Main(string[] args)
        {
            bool endApplication                   = false;
            ProductCollection  products           = new ProductCollection();
            ProductRecordsView productRecordsView = ProductObjectFactory.ProductRecordsViewObject(products);

            while (!endApplication)
            {
                Console.Clear();
                Console.WriteLine(ProductCommonOutputText.GetApplicationHeading());
                productRecordsView.RunRecordsView();
                Console.WriteLine();
                Console.WriteLine(ProductCommonOutputText.GetInstructions());

                ConsoleKey instructionKey = Console.ReadKey().Key;
                switch (instructionKey)
                {
                case ConsoleKey.C:
                    ProductCreateView productCreateView = ProductObjectFactory.ProductCreateViewObject(products);
                    productCreateView.RunCreateView();
                    break;

                case ConsoleKey.R:
                    break;

                case ConsoleKey.U:
                    break;

                case ConsoleKey.D:
                    break;

                default:
                    endApplication = true;
                    break;
                }
            }
            Console.ReadLine();
        }
コード例 #3
0
 [TestMethod] public void CreateTest()
 {
     o = ProductObjectFactory.Create(id, name, description, category, biddingEndDate);
     validateResults(id, name, description, category, biddingEndDate);
 }