Exemplo n.º 1
0
        public void ViewOrders()
        {
            Console.WriteLine("welcome");
            List <Order> order = new List <Order>();

            Console.WriteLine("Order ID    Tablet Name    No.of Tablets    Tablet Cost    Total Amount    Date of order");
            string ord  = OrderBLL.orderTablet(11, "alpha", 5, 25, 125, "12/12/2020", order);
            string ord1 = OrderBLL.orderTablet(12, "aspirin", 10, 20, 200, "08/10/2020", order);
            string ord2 = OrderBLL.orderTablet(13, "beta", 7, 8, 56, "25/09/2020", order);
            string ord3 = OrderBLL.orderTablet(14, "Vit-B", 20, 40, 800, "15/05/2020", order);

            //Console.WriteLine(ord);
            Order[] orderInfo = OrderBLL.showOrder(order);
            foreach (var o in orderInfo)
            {
                Console.WriteLine(o.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();
        }
Exemplo n.º 2
0
        public void CancelOrder()
        {
            List <Order> order = new List <Order>();
            string       ord   = OrderBLL.orderTablet(11, "alpha", 5, 25, 125, "12/13/2020", order);
            string       ord1  = OrderBLL.orderTablet(12, "aspirin", 10, 20, 200, "08/10/2020", order);
            string       ord2  = OrderBLL.orderTablet(13, "beta", 7, 8, 56, "25/09/2020", order);
            string       ord3  = OrderBLL.orderTablet(14, "Vit-B", 20, 40, 800, "15/05/2020", order);

            Order[] orderInfo = OrderBLL.showOrder(order);
            foreach (var o in orderInfo)
            {
                Console.WriteLine(o.ToString());
            }
            Console.WriteLine("Enter Order ID to cancel");
            int      canVar = Convert.ToInt32(Console.ReadLine());
            String   dat    = OrderBLL.cancelOrd(canVar, order);
            DateTime date1  = DateTime.Parse(dat);

            Console.WriteLine(dat);
            Console.WriteLine(date1);
            DateTime dateTime = DateTime.Now;

            Console.WriteLine(dateTime);
            int value = (dateTime - date1).Days;

            Console.WriteLine(value);
            if (value >= 0 && value < 2)
            {
                Order[] dat1 = OrderBLL.cancelOrd1(canVar, order);
                foreach (var d in dat1)
                {
                    Console.WriteLine(d.ToString());
                }
            }
            else
            {
                Console.WriteLine("Order cannot be cancelled");
            }
            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();

            /*Order[] orderInfo1 = OrderBLL.showOrder(order);
             * foreach (var o in orderInfo1)
             * {
             *  Console.WriteLine(o.ToString());
             * }*/
        }
Exemplo n.º 3
0
        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;
            }
        }