static void UpadteOrder() { Console.Write("\nEnter Order Number : "); int update_no = Convert.ToInt32(Console.ReadLine()); Show.showOrderDetails(update_no); int index = 0; int len = Program.AllOrderDetails.Count; OrderDetail od = new OrderDetail(); int update_product_no; do { bool flag = false; Console.Write("\nEnter Product Number : "); update_product_no = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < len; i++) { od = (OrderDetail)Program.AllOrderDetails[i]; if (od.ProductDetail.ProductNo == update_product_no) { flag = true; index = i; break; } } if (flag) { string qt; do { Console.Write("Enter Quantity : "); qt = Console.ReadLine(); } while (Validation.IsQuantity(qt)); od.Quantity = Convert.ToInt32(qt); od.Amount = od.UnitPrice * od.Quantity; od.GrandTotal = od.Amount - od.DiscountAmount; od.ModifiedDate = DateTime.Now; Program.AllOrderDetails[index] = od; Show.showOrderDetails(od.OrderNoRef); od.Show(); } else { Console.WriteLine("\nNo product avilable : "); } } while (update_product_no != 0); }
static void UpadteOrder() { if (AllOrder.Count == 0) { Console.WriteLine("No Order Placed Yet...!"); return; } Show.AllOrder(); string up_no; do { Console.Write("\nEnter Order Number : "); up_no = Console.ReadLine(); if (Check.chkOrderNo(up_no)) { Console.WriteLine("No Order Number Found..!"); } } while (Validation.IsOrderAvail(up_no)); if (up_no.Equals("0")) { start(); } int update_no = Convert.ToInt32(up_no); int index = 0; int len = Program.AllOrderDetails.Count; OrderDetail od = new OrderDetail(); int update_product_no; do { Show.showOrderDetails(update_no); bool flag = false; string pro_no; do { Console.Write("\nEnter Product Number (Exit 0) : "); pro_no = Console.ReadLine(); if (Check.chkProductNo(update_no, pro_no)) { Console.WriteLine("No Product Avialable Within Order \n"); } } while (!Validation.IsNumber(pro_no)); if (pro_no.Equals("0")) { start(); } update_product_no = Convert.ToInt32(pro_no); for (int i = 0; i < len; i++) { od = (OrderDetail)Program.AllOrderDetails[i]; if (od.ProductDetail.ProductNo == update_product_no) { flag = true; index = i; break; } } if (flag) { string qt; do { Console.Write("Enter Quantity : "); qt = Console.ReadLine(); } while (Validation.IsQuantity(qt)); if (qt.Equals("0")) { start(); } od.Quantity = Convert.ToInt32(qt); od.Amount = od.UnitPrice * od.Quantity; od.GrandTotal = od.Amount - od.DiscountAmount; od.ModifiedDate = DateTime.Now; Program.AllOrderDetails[index] = od; //Show.showOrderDetails(od.OrderNoRef); Console.WriteLine("\nNo\tName\t\tQuantity\tAmount\tTotal"); od.Show(); } else { //Console.WriteLine("No Product Available!"); } } while (true); }