Beispiel #1
0
        private List <Order> ReadTables(DataTable dataTable)
        {
            OrderItem_DAO orderitemDAO = new OrderItem_DAO();
            Table_DAO     tableDAO     = new Table_DAO();
            Employee_DAO  employeeDAO  = new Employee_DAO();
            List <Order>  orders       = new List <Order>();

            foreach (DataRow dr in dataTable.Rows)
            {
                Order request = new Order()
                {
                    OrderID    = (int)dr["Order_ID"],
                    TotalPrice = (double)dr["Total_Price"],
                    Comment    = (String)(dr["Comment"].ToString()),
                    Table      = tableDAO.Db_Get_Table((int)dr["Table_ID"]),
                    Employee   = employeeDAO.Db_Get_Employee((int)dr["Employee_ID"]),
                    OrderItems = orderitemDAO.Db_Get_FoodItems((int)dr["Order_ID"])
                };
                orders.Add(request);
            }
            return(orders);
        }
        private List <OrderDetail> ReadOrderDetailsNoTable(DataTable dataTable)
        {
            Employee_DAO       employee_DAO = new Employee_DAO();
            MenuItem_DAO       Menuitem_DAO = new MenuItem_DAO();
            List <OrderDetail> orderDetails = new List <OrderDetail>();

            foreach (DataRow dr in dataTable.Rows)
            {
                OrderDetail orderDetail = new OrderDetail();
                orderDetail.OrderDetails_ID    = (int)dr["OrderDetails_ID"];
                orderDetail.Item               = Menuitem_DAO.DB_Get_MenuItem((int)dr["Item_ID"]);
                orderDetail.Order_ID           = (int)dr["Order_ID"];
                orderDetail.Quantity           = (int)dr["OrderDetails_Quantity"];
                orderDetail.Comment            = (string)dr["OrderDetails_Comment"];
                orderDetail.Employee           = employee_DAO.DB_Get_Employee((int)dr["Employee_ID"]);
                orderDetail.OrderStatus        = (OrderStatus)((int)dr["OrderDetails_OrderStatus"]);
                orderDetail.Ordered_DateTime   = (DateTime)dr["OrderDetails_Ordered_DateTime"];
                orderDetail.Preparing_DateTime = (DateTime)dr["OrderDetails_Preparing_DateTime"];
                orderDetail.Finished_DateTime  = (DateTime)dr["OrderDetails_Finished_DateTime"];
                orderDetails.Add(orderDetail);
            }
            return(orderDetails);
        }
        private List <Payment> ReadPayment(DataTable dataTable)
        {
            Employee_DAO   employee_DAO = new Employee_DAO();
            List <Payment> PaymentList  = new List <Payment>();

            foreach (DataRow dr in dataTable.Rows)
            {
                Payment payment = new Payment()
                {
                    Payment_ID       = (int)dr["Payment_ID"],
                    PayMethod        = (PayMethod)dr["Payment_PayMethod"],
                    Employee         = employee_DAO.DB_Get_Employee((int)dr["Employee_ID"]),
                    Comment          = (string)dr["Payment_Comment"],
                    PayStatus        = (PayStatus)dr["Payment_PayStatus"],
                    TotalPrice       = (decimal)dr["Payment_Total"],
                    TotalVAT         = (decimal)dr["Payment_VAT"],
                    Tip              = (decimal)dr["Payment_Tip"],
                    Payment_DateTime = (DateTime)dr["Payment_DateTime"]
                };
                PaymentList.Add(payment);
            }
            return(PaymentList);
        }