Ejemplo n.º 1
0
        // Convert the raw database data into an Order object
        private Order Read(DataRow dataRow)
        {
            int          id         = (int)dataRow["id"];
            List <Dish>  dishes     = new Dish_DAO().GetAllForOrder(id);
            List <Drink> drinks     = new Drink_DAO().GetAllForOrder(id);
            int          employeeId = int.Parse(dataRow["employeeId"].ToString());
            int          tableId    = int.Parse(dataRow["tableId"].ToString());
            OrderState   state      = (OrderState)int.Parse(dataRow["orderState"].ToString());
            string       comment    = dataRow["comment"].ToString();

            DateTime timeOrdering;

            DateTime.TryParse(dataRow["timeOrdering"].ToString(), out timeOrdering);
            DateTime timeFinished;

            DateTime.TryParse(dataRow["timeFinished"].ToString(), out timeFinished);

            return(new Order(id, timeOrdering, timeFinished, dishes, drinks, employeeId, tableId, state, comment));
        }