static void AddProducts() { Product product = new Product(); #region Product Name Console.WriteLine("Mehsulun adini daxil edin :"); product.Name = Console.ReadLine(); #endregion #region Product price Console.WriteLine("Mehsulun qiymetini daxil edin:"); string priceInput = Console.ReadLine(); double price; while (!double.TryParse(priceInput, out price)) { Console.WriteLine("Reqem daxil etmelisiniz!"); priceInput = Console.ReadLine(); } product.Price = price; #endregion #region Product Category product.ProductCategory = SelectCategory(); #endregion #region Product Quantity Console.WriteLine("\nMehsulun sayini daxil edin:"); string quantityInput = Console.ReadLine(); int quantity; while (!int.TryParse(quantityInput, out quantity)) { Console.WriteLine("Reqem daxil etmelisiniz!"); quantityInput = Console.ReadLine(); } product.Quantity = quantity; #endregion #region Product Code Console.WriteLine("\nMehsulun kodunu daxil edin :"); product.Code = Console.ReadLine(); #endregion _marketableService.AddProduct(product); Console.WriteLine("-------------- Yeni mehsul ugurla elave edildi -------------"); }
// product methodlari static void ShowProductAdd() { Console.WriteLine("===================== Yeni satış əlavə et ====================="); Product product = new Product(); // isdediyi parametrler consolda gorsensin deye ve whie verilib sef reqem daxil edilmesin deye #region ProductCategoryType int selectInt; do { #region product Category Menu Console.WriteLine("Kategoriya daxil edin :"); Console.WriteLine("1. SonyHeadphone "); Console.WriteLine("2. Tv"); Console.WriteLine("3. Computer"); Console.WriteLine("4. Phone"); #endregion #region Product Category Selection Console.WriteLine(""); Console.Write("Seçiminizi edin:"); string select = Console.ReadLine(); while (!int.TryParse(select, out selectInt)) { Console.WriteLine(""); Console.Write("Rəqəm daxil etməlisiniz!: "); select = Console.ReadLine(); } #endregion #region Product Category switch switch (selectInt) { case 1: product.ProductCategory = ProductCategoryType.SonyHeadphone; break; case 2: product.ProductCategory = ProductCategoryType.Tv; break; case 3: product.ProductCategory = ProductCategoryType.Computer; break; case 4: product.ProductCategory = ProductCategoryType.Phone; break; default: Console.WriteLine("---------------------------------------------"); Console.WriteLine("Siz yalnış seçim etdiniz, 1-4 aralığında seçim etməlisiniz! "); Console.WriteLine("-----------------------------------------------"); break; } #endregion } while (selectInt == 0); #endregion #region ProductName Console.Write("Məhsulun adını daxil edin :"); product.ProductName = Console.ReadLine(); #endregion #region ProductPrice Console.Write("Satışın qiymətini daxil edin :"); string ProductPriceInput = Console.ReadLine(); double ProductPrice; while (!double.TryParse(ProductPriceInput, out ProductPrice)) { Console.Write("Ancaq rəqəm daxil etməlisiniz :"); ProductPriceInput = Console.ReadLine(); } product.ProductPrice = ProductPrice; #endregion #region ProductQuantity Console.Write("Satış sayını daxil edin :"); string ProductQuantityInput = Console.ReadLine(); int ProductQuantity; while (!int.TryParse(ProductQuantityInput, out ProductQuantity)) { Console.Write("Rəqəm daxil etməlisiniz!"); ProductQuantityInput = Console.ReadLine(); } product.ProductQuantity = ProductQuantity; #endregion #region ProductCode Console.Write("Produqtun kodunu daxil edin :"); product.ProductCode = Console.ReadLine(); #endregion var seleProductCode = _marketableService.Products.Select(m => m.ProductCode).FirstOrDefault(); if (seleProductCode == product.ProductCode) { Console.WriteLine(""); Console.WriteLine("{0} - koduna aid məhsul mövcuddur, əlavə edə blməzsiniz!", product.ProductCode); } else { if (product != null) { } _marketableService.AddProduct(product); Console.WriteLine("-------------- Yeni satış əlavə edildi --------------"); } } //isdiyir
static void AddProduct() { Console.WriteLine("=========Yeni mehsul daxil edin========="); Product product = new Product(); #region Name Console.WriteLine("Məhsul adı daxil edin :"); product.ProductName = Console.ReadLine(); #endregion #region price Console.WriteLine("Mehsulun qiymetini daxil edin"); string Price = Console.ReadLine(); double PriceDouble; while (!double.TryParse(Price, out PriceDouble)) { Console.WriteLine("Duzgun reqem daxil edin"); Price = Console.ReadLine(); } product.ProductPrice = PriceDouble; #endregion #region Count Console.WriteLine("Say daxil edin"); string Count1 = Console.ReadLine(); int Count2; while (!int.TryParse(Count1, out Count2)) { Console.WriteLine("Duzgun say daxil edin"); Count1 = Console.ReadLine(); } product.ProductCount = Count2; #endregion #region Code Console.WriteLine("Mehsulun kodunu daxil edin"); product.ProductCode = Console.ReadLine(); #endregion #region Category Console.WriteLine("Sechmek istediyiniz kateqoriyanin qarshisindaki reqemi qeyd edin"); Array array = Enum.GetValues(typeof(Category)); foreach (var item in array) { Console.Write(Array.IndexOf(array, item) + 1); Console.WriteLine("-{0}", item); } int Selection; string Select = Console.ReadLine(); while (!int.TryParse(Select, out Selection)) { Console.WriteLine("Reqem daxil etmelisiniz"); Select = Console.ReadLine(); } switch (Selection) { case 1: product.Category = Category.Ichkiler; break; case 2: product.Category = Category.Meyveler; break; case 3: product.Category = Category.Shokoladlar; break; case 4: product.Category = Category.Terevezler; break; case 5: product.Category = Category.UnMehsullari; break; case 6: product.Category = Category.Yaglar; break; default: Console.WriteLine("Bele bir kateqoriya yoxdur"); AddProduct(); break; } #endregion marketableService.AddProduct(product); Console.WriteLine("=========Mehsul elave olundu========="); }
}//title menu static void ShowAddProduct() { Console.WriteLine("------------------Məhsul əlavə et-------------------"); Product product = new Product(); int selectInt; do { #region CATEGORY Console.WriteLine("Kateqoriya daxil edin"); Console.WriteLine("1. Televisions"); Console.WriteLine("2. Phones"); Console.WriteLine("3. Tablets"); Console.WriteLine("4. ComputerAccesories"); Console.WriteLine("5. Books"); Console.WriteLine("6. Clothes"); Console.WriteLine(""); Console.Write("Rəqəm daxil etməlisiniz: "); string select = Console.ReadLine(); while (!int.TryParse(select, out selectInt)) { Console.WriteLine(""); Console.Write("Rəqəm daxil etməlisiniz!: "); select = Console.ReadLine(); } switch (selectInt) { case 1: product.ProductCategory = Category.Televisions; break; case 2: product.ProductCategory = Category.Phones; break; case 3: product.ProductCategory = Category.Tablets; break; case 4: product.ProductCategory = Category.ComputerAccesories; break; case 5: product.ProductCategory = Category.Books; break; case 6: product.ProductCategory = Category.Clothes; break; default: Console.WriteLine("Yalnız 1 ilə 6 arasında bir rəqəm seçə bilərsiniz"); ShowAddProduct(); break; #endregion } } while (selectInt == 0); #region Product Code Console.WriteLine("Məhsulun kodunu daxil edin"); string productCodeInput = Console.ReadLine(); int ProductCode; while (!int.TryParse(productCodeInput, out ProductCode)) { Console.WriteLine("Yalnız rəqəmlərdən istifadə edə bilərsiniz"); productCodeInput = Console.ReadLine(); } product.ProductCode = ProductCode; #endregion #region Product Name Console.WriteLine("Məhsulun adını daxil edin"); product.ProductName = Console.ReadLine(); #endregion #region Product Price Console.WriteLine("Məhsulun qiymətini daxil edin"); string productPriceInput = Console.ReadLine(); double ProductPrice; while (!double.TryParse(productPriceInput, out ProductPrice)) { Console.WriteLine("Yalnız rəqəmlərdən istifadə edə bilərsiniz"); Console.ReadLine(); } product.ProductPrice = ProductPrice; #endregion #region Product Count Console.WriteLine("Məhsulun miqdarını daxil edin"); string productCountInput = Console.ReadLine(); int Count; while (!int.TryParse(productCountInput, out Count)) { Console.WriteLine("Yalnız rəqəmlərdən istifadə edə bilərsiniz"); Console.ReadLine(); #endregion } product.Count = Count; _marketableService.AddProduct(product); } //completed
static void ShowProductAdd() { Console.WriteLine("~~~~~~~~~~~~ Yeni Mehsul elave et ~~~~~~~~~~~~"); Product product = new Product(); #region Product Category int selectInt; do { #region Product kategory Menu Console.WriteLine("~~~~~~~~kategoriya daxil edin~~~~~~~~"); Console.WriteLine("1. Televizor"); Console.WriteLine("2. Computer"); Console.WriteLine("3. Phone"); Console.WriteLine("4. Saat"); #endregion #region Product kategory Selection Console.WriteLine(""); Console.WriteLine("Seçiminizi Edin:"); string select = Console.ReadLine(); while (!int.TryParse(select, out selectInt)) { Console.WriteLine("Reqem daxil etmelisiniz!"); select = Console.ReadLine(); } #endregion #region Product kategory Switch switch (selectInt) { case 1: product.Category = CategoryType.Televizor; break; case 2: product.Category = CategoryType.Computer; break; case 3: product.Category = CategoryType.Phone; break; case 4: product.Category = CategoryType.Saat; break; default: Console.WriteLine("------------------------"); Console.WriteLine("Siz yalniş secim etdiniz, 1-3 araliğinda seçim etməlisiniz"); Console.WriteLine("------------------------"); break; } } while (selectInt == 0); #endregion #endregion #region Product Name Console.WriteLine("Mehsul adi daxil edin"); product.ProductName = Console.ReadLine(); #endregion #region product Quantity Console.WriteLine("Mehsulun sayi daxil edin"); string productQuantityInput = Console.ReadLine(); int ProductQuantity; while (!int.TryParse(productQuantityInput, out ProductQuantity)) { Console.WriteLine("Reqem daxil edin"); productQuantityInput = Console.ReadLine(); } product.ProductQuantity = ProductQuantity; #endregion #region Price Console.WriteLine("Mehsulun meblegi daxil edin"); string productPriceInput = Console.ReadLine(); double ProductPrice; while (!double.TryParse(productPriceInput, out ProductPrice)) { Console.WriteLine("Satis meblegi daxil edin"); productPriceInput = Console.ReadLine(); } product.ProductPrice = ProductPrice; #endregion #region Product code Console.WriteLine("Mehsulun kodu daxil edin"); product.ProductCode = Console.ReadLine(); var selectProductCode = _marketableService.Products.Select(m => m.ProductCode).FirstOrDefault(); if (selectProductCode == product.ProductCode) { Console.WriteLine(""); Console.WriteLine("____{0}- Bu koda aid məhsul mövcuddur, ferqli kod daxil edin____! ", product.ProductCode); Console.WriteLine(""); } else { _marketableService.AddProduct(product); Console.WriteLine(""); Console.WriteLine("-------------Məhsul əlave edildi--------------"); Console.WriteLine(""); } #endregion }
static void ShowAddProduct() { Console.WriteLine(""); Console.WriteLine("-------------- Yeni Məhsul əlavə et --------------"); Product product = new Product(); #region Product Catagory Name int selectInt; do { #region Product Category Menu Console.WriteLine("Kateqoriya daxil edin:"); Console.WriteLine("1. Televizorlar"); Console.WriteLine("2. Telefonlar"); Console.WriteLine("3. Soyuducular"); Console.WriteLine("4. Kompyuterlər"); #endregion #region Product Category Selection Console.WriteLine(""); Console.Write("Seçiminizi edin: "); string select = Console.ReadLine(); while (!int.TryParse(select, out selectInt)) { Console.WriteLine(""); Console.Write("Rəqəm daxil etməlisiniz!: "); select = Console.ReadLine(); } #endregion #region Product Category Switch switch (selectInt) { case 1: product.ProductCategory = ProductCategoryType.TV; break; case 2: product.ProductCategory = ProductCategoryType.Phone; break; case 3: product.ProductCategory = ProductCategoryType.Refrigerator; break; case 4: product.ProductCategory = ProductCategoryType.Computer; break; default: Console.WriteLine(""); Console.WriteLine("--------------------------------"); Console.WriteLine("Siz yalnış seçim etdiniz,1-4 aralığında seçim etməlisiniz"); Console.WriteLine("--------------------------------"); break; } #endregion } while (selectInt == 0); #endregion if (selectInt == 1 || selectInt == 2 || selectInt == 3 || selectInt == 4) { #region Product Name Console.WriteLine(""); Console.Write("Məhsul adı daxil edin: "); product.ProductName = Console.ReadLine(); Console.WriteLine(""); #endregion #region Product Price Console.Write("Məhsulun qiymətini daxil edin: "); string productPriceInput = Console.ReadLine(); double productPrice; while (!double.TryParse(productPriceInput, out productPrice)) { Console.WriteLine(""); Console.Write("Rəqəm daxil etməlisiniz!: "); productPriceInput = Console.ReadLine(); } product.ProductPrice = productPrice; #endregion #region Product Quantity Console.WriteLine(""); Console.Write("Məhsulun sayını daxil edin: "); string productQuantityInput = Console.ReadLine(); int productQuantity; while (!int.TryParse(productQuantityInput, out productQuantity)) { Console.WriteLine(""); Console.Write("Tam rəqəm daxil etməlisiniz!: "); productQuantityInput = Console.ReadLine(); } product.ProductQuantity = productQuantity; Console.WriteLine(""); #endregion #region Product Code Console.Write("Məhsulun kodunu daxil edin: "); product.ProductCode = Console.ReadLine(); #endregion var selectProductCode = _marketableService.Products.Select(m => m.ProductCode).FirstOrDefault(); if (selectProductCode == product.ProductCode) { Console.WriteLine(""); Console.WriteLine("-------------- {0} - koduna aid məhsul mövcuddur, əlavə edə bilməzsiniz!!! --------------", product.ProductCode); } else { if (product != null) { _marketableService.AddProduct(product); } Console.WriteLine(""); Console.WriteLine("-------------- Yeni məhsul əlavə edildi --------------"); } } }
static void ShowAddProduct() { Product product = new Product(); Console.WriteLine(""); Console.WriteLine("----------------- Məhsul əlavə et ------------------"); Console.WriteLine(""); int selectInt; do { #region Product Category List Console.WriteLine("Kateqoriya daxil edin: "); Console.WriteLine("1. Telephone"); Console.WriteLine("2. Noutbook"); Console.WriteLine("3. Printer"); #endregion #region Product Category Selection Console.WriteLine(""); Console.WriteLine("Seçiminizi daxil edin: "); string select = Console.ReadLine(); while (!int.TryParse(select, out selectInt)) { Console.WriteLine(""); Console.Write("Rəqəm daxil etməlisiniz"); select = Console.ReadLine(); } #endregion switch (selectInt) { case 1: product.Category = Category.Telephone; break; case 2: product.Category = Category.Noutbook; break; case 3: product.Category = Category.Printer; break; default: Console.WriteLine("---------------------------------------------------------"); Console.WriteLine("Siz yalnış seçim etdiniz,1-3 aralığında seçim etməlisiniz"); Console.WriteLine("---------------------------------------------------------"); break; } } while (selectInt == 0); Console.WriteLine(""); Console.WriteLine("Məhsulun adını daxil edin: "); product.Name = Console.ReadLine(); Console.WriteLine(""); Console.WriteLine("Məhsulun məbləğini daxil edin: "); string proPriceInput = Console.ReadLine(); double ProPrice; while (!double.TryParse(proPriceInput, out ProPrice)) { Console.WriteLine(""); Console.WriteLine("Rəqəm daxil etməlisiniz"); proPriceInput = Console.ReadLine(); } product.Price = ProPrice; Console.WriteLine(""); Console.WriteLine("Məhsulun miqdarını daxil edin: "); string proQuantityInput = Console.ReadLine(); int proQuantity; while (!int.TryParse(proQuantityInput, out proQuantity)) { Console.WriteLine("Rəqəm daxil etməlisiniz"); proQuantityInput = Console.ReadLine(); } product.Quantity = proQuantity; Console.WriteLine(""); Console.WriteLine("Məhsulun kodunu daxil edin: "); product.Code = Console.ReadLine(); if (product != null) { _marketableService.AddProduct(product); } Console.WriteLine(""); Console.WriteLine("----------------- Məhsul əlavə edildi -----------------"); Console.WriteLine(""); }