示例#1
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);
            }
        }