public bool PrintTableTicket(Customer customer, int OrderID)
        {
            string        line1         = "===================================================================================================";
            string        line          = "---------------------------------------------------------------------------------------------------";
            OrderBL       OrderBL       = new OrderBL();
            List <Ticket> listtk        = new List <Ticket>();
            double        totaldueOrder = 0;

            try
            {
                listtk = OrderBL.GetListTicketByOrderID(OrderID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Loi:" + e.Message);
                Console.WriteLine("An phim bat ky de tro ve menu chinh:");
                Console.ReadKey();
                menu.MenuMain(customer);
            }
            if (listtk.Count != 0)
            {
                Console.WriteLine(line1);
                Console.WriteLine("----------------------------------------Chi Tiet Don Hang------------------------------------------");
                Console.WriteLine(line1);
                var table1 = new ConsoleTable("Ma ve", "Mo Ta", "So luong", "Don gia", "Tong tien");
                foreach (var item in listtk)
                {
                    totaldueOrder += (item.TicketPrice * item.Amount);
                    string unitprice  = consoleticket.pricevalid(item.TicketPrice);
                    string totalmoney = consoleticket.pricevalid((item.TicketPrice * item.Amount));
                    table1.AddRow(item.TicketID, string.Concat("Ve Loai ", item.TicketType, " Tran ", item.M.MatchName), item.Amount, unitprice, totalmoney);
                }
                table1.Write(Format.Default);
                Console.WriteLine(line);
                Console.WriteLine("Tong Tien Da Thanh Toan:{0}", consoleticket.pricevalid(totaldueOrder));
                Console.WriteLine(line);
                Console.WriteLine(line1);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void DisplayStatistic(Customer customer)
        {
            bool         checkorder = false;
            string       choice;
            string       status     = "";
            List <Order> ListOrders = new List <Order>();
            OrderBL      Orders     = new OrderBL();

            try
            {
                ListOrders = Orders.GetOrdersByCustomerID(customer.Id);
            }
            catch (System.Exception)
            {
            }
            if (ListOrders.Count != 0)
            {
                var table = new ConsoleTable("Ma Don Hang", "Ngay Mua", "Trang Thai Don Hang");
                foreach (var item in ListOrders)
                {
                    if (item.OrderStatus == 0)
                    {
                        status = "Da Thanh Toan";
                    }
                    table.AddRow(item.OrderID, String.Format("{0:dd/MM/yyyy}", item.OrderDate), status);
                }
                table.Write(Format.Default);
            }
            else
            {
                Console.WriteLine("Ban Chua mua hang!Nhan phim bat ky de tro ve menu chinh");
                Console.ReadKey();
                menu.MenuMain(customer);
            }
            while (checkorder == false)
            {
                Console.Write("Nhap ma dat hang:");
                int OrderID = consoleticket.Input(Console.ReadLine());
                foreach (var item in ListOrders)
                {
                    if (OrderID == item.OrderID)
                    {
                        checkorder = PrintTableTicket(customer, OrderID);
                    }
                }
                if (checkorder == false)
                {
                    Console.Write("Ma hoa don can tra cuu khong dung!Ban co muon nhap lai khong(C/K):");
                    choice = Console.ReadLine().ToUpper();
                    bool checkchoice = menu.Choose(choice);
                    if (checkchoice == true)
                    {
                        checkorder = false;
                        continue;
                    }
                    else
                    {
                        checkorder = true;
                        menu.MenuMain(customer);
                    }
                }
            }
            Console.WriteLine("An phim bat ky de tro ve menu chinh!");
            Console.ReadKey();
            menu.MenuMain(customer);
        }
Пример #3
0
        public void PrintBill(Customer customer, int orderID, double totaldue)
        {
            int    count = 0;
            Order  order = new Order();
            string line1 = "--------------------------------------------------------------------------------------------------------------------";
            string line2 = "====================================================================================================================";

            try
            {
                OrderBL orderbl = new OrderBL();
                order = orderbl.GetOrderInfoByOrderID(orderID);
            }
            catch (Exception)
            {
                Console.WriteLine("Loi!! An phim bat ky de tro ve man hinh dang nhap!");
                Console.ReadKey();
                m.LoginInterface();
            }
            try
            {
                OrderBL orderbl = new OrderBL();
                order.listticket = orderbl.GetListTicketByOrderID(orderID);
            }
            catch (Exception)
            {
                Console.WriteLine("Loi!! An phim bat ky de tro ve man hinh dang nhap!");
                Console.ReadKey();
                m.LoginInterface();
            }
            if (order.listticket.Count != 0)
            {
                Console.WriteLine(line2);
                Console.WriteLine("------------------------------------------------------Hoa Don-------------------------------------------------------");
                Console.WriteLine(line2);
                Console.WriteLine("Ma hoa don:{0,-59}", order.OrderID);
                Console.WriteLine("Ngay mua:{0,-61}", String.Format("{0:dd/MM/yyyy}", order.OrderDate));
                Console.WriteLine(line1);
                Console.WriteLine("Don Vi Ban Ve:CLB Bong Da HAGL");
                Console.WriteLine("Dia Chi:Thanh Pho Pleiku,Tinh Gia Lai");
                Console.WriteLine(line1);
                Console.WriteLine("Ten khach hang: {0,-54}", customer.CusName);
                Console.WriteLine("So dien thoai: {0,-55}", customer.CusPhone);
                Console.WriteLine("Dia chi: {0,-54}", customer.CusAddress);
                Console.WriteLine(line1);
                var table = new ConsoleTable("STT", "Ma Ve", "Mo ta", "So luong", "Don gia", "Thanh tien");
                foreach (var item in order.listticket)
                {
                    string price      = pricevalid(item.TicketPrice);
                    string totalprice = pricevalid((item.TicketPrice * item.Amount));
                    table.AddRow(count += 1, item.TicketID, string.Concat("Ve Loai ", item.TicketType, " Tran ", item.M.MatchName), item.Amount, price, totalprice);
                }
                table.Write(Format.Default);
                Console.WriteLine(line1);
                Console.WriteLine("Tong Tien(VND):{0,-55}", pricevalid(totaldue));
                if (order.OrderStatus == 0)
                {
                    Console.WriteLine("Xac Nhan:Da Thanh Toan.");
                }
                Console.WriteLine(line1);
                Console.WriteLine(line2);
            }
        }