Ejemplo n.º 1
0
        private MonitorFloorModel GetMonitorModel(Int32?id)
        {
            MonitorFloorModel        model  = new MonitorFloorModel();
            List <Models.TableOrder> tables = new List <Models.TableOrder>();

            Models.TableOrder          order;
            List <Services.TableOrder> alltables = new List <Services.TableOrder>();

            Services.Floor floor;
            Services.Table table;
            try {
                id           = id.HasValue ? id.Value : 0;
                model.Floors = _floorService.GetFloors(SessionData.customer.id);
                if (id == 0)
                {
                    floor      = new Services.Floor();
                    floor.id   = 0;
                    floor.Name = Resources.Resource.COMMON_ALL;
                }
                else
                {
                    floor = _floorService.GetFloor(id.Value);
                    if (floor == null && model.Floors.Count > 0)
                    {
                        floor = model.Floors[0];
                    }
                }
                model.Floor = new Models.MonitorFloor();
                if (floor != null)
                {
                    SessionData.floor = floor;
                    model.Floor.id    = floor.id;
                    model.Floor.Name  = floor.Name;
                    alltables         = _orderService.GetTableOrdersByFloorId(model.Floor.id, SessionData.customer.id);
                    if (alltables != null)
                    {
                        foreach (Services.TableOrder tab in alltables)
                        {
                            order           = new Models.TableOrder();
                            table           = _orderService.GetTable(tab.TableId);
                            order.TableName = table.Name;
                            order.Order     = tab;
                            tables.Add(order);
                        }
                    }
                    model.Floor.Tables = tables;
                    model.Inventory    = _orderService.LatestInventory(SessionData.customer.id);
                    model.Sales        = _orderService.LatestSale(SessionData.customer.id);
                }
                return(model);
            }
            catch (Exception ex) {
                base.Log(ex);
            }
            finally {
            }

            return(null);
        }
Ejemplo n.º 2
0
        private FloorModel GetModel(Int32?id)
        {
            FloorModel model = new FloorModel();

            Services.Floor floor;

            try {
                id           = id.HasValue ? id.Value : 0;
                model.Floors = _floorService.GetFloors(SessionData.customer.id);
                floor        = _floorService.GetFloor(id.Value);
                if (floor == null && model.Floors.Count > 0)
                {
                    floor = model.Floors[0];
                }
                model.Floor = new Models.Floor();
                if (floor != null)
                {
                    SessionData.floor  = floor;
                    model.Floor.id     = floor.id;
                    model.Floor.id     = floor.id;
                    model.Floor.Name   = floor.Name;
                    model.Floor.Layout = GetTables(model.Floor.id);
                    model.Floor.Width  = floor.Width;
                    model.Floor.Height = floor.Height;
                }
                return(model);
            }
            catch (Exception ex) {
                base.Log(ex);
            }
            finally {
            }

            return(null);
        }