public void TabletDetails() { List <Tablet> tablet = new List <Tablet>(); tablet.Add(new Tablet(1, "citrizen", 5, 500)); tablet.Add(new Tablet(2, "paracetamol", 10, 200)); tablet.Add(new Tablet(3, "ativan", 7, 300)); tablet.Add(new Tablet(4, "colpal", 8, 500)); Tablet[] tabletInfo = TabletBLL.showTablet(tablet); Console.WriteLine("-----------------------"); Console.WriteLine("Tablet ID Tablet Name Tablet Price Tablet Stock"); Console.WriteLine("-----------------------"); foreach (var t in tabletInfo) { Console.WriteLine(t.ToString()); } Console.WriteLine(" "); Console.WriteLine("Please choose from below if you wish to continue with other services"); Console.WriteLine("-----------------------"); Console.WriteLine("1.view the medicine list"); Console.WriteLine("2.Place order"); Console.WriteLine("3.View order details"); Console.WriteLine("4.Exit"); custop(); }
public void UpdateStock() { List <Tablet> tablet = new List <Tablet>(); tablet.Add(new Tablet(1, "citrizen", 5, 500)); tablet.Add(new Tablet(2, "paracetamol", 10, 200)); tablet.Add(new Tablet(3, "ativan", 7, 300)); tablet.Add(new Tablet(4, "colpal", 8, 500)); Tablet[] tabletInfo = TabletBLL.showTablet(tablet); foreach (var t in tabletInfo) { Console.WriteLine(t.ToString()); } Console.WriteLine("-----------------------"); Console.WriteLine("Enter tablet Id to update stock"); int tId = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter stock"); int tstock = Convert.ToInt32(Console.ReadLine()); try { if (tstock > 0) { string tab = TabletBLL.updateStock(tId, tstock, tablet); foreach (var t in tabletInfo) { Console.WriteLine(t.ToString()); } } else { throw (new NegativeStockException("Tablet Stock cannot be less than zero ")); } } catch (NegativeStockException e) { Console.WriteLine(e.Message.ToString()); Console.ReadLine(); } Console.WriteLine("Please choose from below if you wish to continue with other services"); Console.WriteLine("-----------------------"); Console.WriteLine("1.Add tablet to stock"); Console.WriteLine("2.update tablet stock"); Console.WriteLine("3.view order history"); Console.WriteLine("4.Exit"); shopop(); }
public void AddTablet() { List <Tablet> tablet = new List <Tablet>(); tablet.Add(new Tablet(1, "citrizen", 5, 500)); tablet.Add(new Tablet(2, "paracetamol", 10, 200)); tablet.Add(new Tablet(3, "ativan", 7, 300)); tablet.Add(new Tablet(4, "colpal", 8, 500)); Tablet[] tabletInfo = TabletBLL.showTablet(tablet); foreach (var t in tabletInfo) { Console.WriteLine(t.ToString()); } Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine("-----------------------"); Console.WriteLine("The above mentioned this are the available medicine stock"); Console.WriteLine("-----------------------"); Console.WriteLine(" "); Console.WriteLine(" "); Console.Write("Tablet Id:"); int tid = Convert.ToInt32(Console.ReadLine()); Console.Write("Tablet Name:"); string tname = Console.ReadLine(); Console.Write("Tablet Cost:"); int tcost = Convert.ToInt32(Console.ReadLine()); Console.Write("Tablet Stock:"); int tstock = Convert.ToInt32(Console.ReadLine()); string tab = TabletBLL.addTablet(tid, tname, tcost, tstock, tablet); Console.WriteLine(tab); Tablet[] tabletInfo1 = TabletBLL.showTablet(tablet); foreach (var t in tabletInfo1) { Console.WriteLine(t.ToString()); } Console.WriteLine(" "); Console.WriteLine("Please choose from below if you wish to continue with other services"); Console.WriteLine("-----------------------"); Console.WriteLine("1.Add tablet to stock"); Console.WriteLine("2.update tablet stock"); Console.WriteLine("3.view order history"); Console.WriteLine("4.Exit"); shopop(); }
public void Ordertablet() { Console.WriteLine("Available tablets"); Console.WriteLine("-----------------------"); List <Tablet> tablet = new List <Tablet>(); tablet.Add(new Tablet(1, "citrizen", 5, 500)); tablet.Add(new Tablet(2, "paracetamol", 10, 200)); tablet.Add(new Tablet(3, "ativan", 7, 300)); tablet.Add(new Tablet(4, "colpal", 8, 500)); Tablet[] tabletInfo = TabletBLL.showTablet(tablet); foreach (var t in tabletInfo) { Console.WriteLine(t.ToString()); } Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine("-----------------------"); List <Order> order = new List <Order>(); Console.WriteLine("Enter tablet to order"); String tabName1 = Console.ReadLine(); Console.WriteLine("Enter no. of tablets"); int count = Convert.ToInt32(Console.ReadLine()); int cst = TabletBLL.order1(tabName1, tablet); int amount = count * cst; Console.WriteLine("Total Amount payable:" + amount); Console.WriteLine("-----------------------"); Console.WriteLine("Press 1 to place order"); Console.WriteLine("press 2 to exit from current order"); int b = Convert.ToInt32(Console.ReadLine()); switch (b) { case 1: Random rand = new Random(); const int maxValue = 99; int ordId = rand.Next(maxValue + 1); DateTime dateTime = DateTime.Now; string DateValue = dateTime.ToShortDateString(); //Console.WriteLine(amount); Console.WriteLine(" "); Console.WriteLine("-----------------------"); Console.WriteLine("your order is successful"); Console.WriteLine("-----------------------"); Console.WriteLine(" "); string updStk = TabletBLL.updateStock1(tabName1, count, tablet); /*foreach (var t in tabletInfo) * { * Console.WriteLine(t.ToString()); * }*/ //Console.WriteLine("your order is :" + tabName1); /*int tabId = 1; * string date = "12/12/2020"*/ Console.WriteLine("Press 1 to view order history"); Console.WriteLine("Press 2 to place another order"); int a = Convert.ToInt32(Console.ReadLine()); switch (a) { case 1: Console.WriteLine("view orders history"); Console.WriteLine("-----------------------"); Console.WriteLine("Order ID Tablet Name No.of Tablets Tablet Cost Total Amount Date of order"); string ord = OrderBLL.orderTablet(ordId, tabName1, count, cst, amount, DateValue, order); //Console.WriteLine(ord); Order[] orderInfo = OrderBLL.showOrder(order); foreach (var o in orderInfo) { Console.WriteLine(o.ToString()); } break; //Console.ReadLine(); case 2: Ordertablet(); break; default: Console.WriteLine(" Invalid Choice"); Console.WriteLine("Please choose from below if you wish to continue with other services"); Console.WriteLine("-----------------------"); Console.WriteLine("1.view the medicine list"); Console.WriteLine("2.Place order"); Console.WriteLine("3.View order details"); Console.WriteLine("4.Exit"); custop(); break; } break; case 2: Ordertablet(); break; default: Console.WriteLine(" Invalid Choice"); Console.WriteLine("Please choose from below if you wish to continue with other services"); Console.WriteLine("-----------------------"); Console.WriteLine("1.view the medicine list"); Console.WriteLine("2.Place order"); Console.WriteLine("3.View order details"); Console.WriteLine("4.Exit"); custop(); break; } }