Esempio 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);
        }
Esempio 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);
        }
Esempio n. 3
0
        private Camera GetCameraFromDTO(CameraDTO camDTO)
        {
            Camera cam = Service.CreateCamera();

            CameraDTO.GetAttributesFromDTO(camDTO, cam);
            if (camDTO.Floor != null)
            {
                cam.Floor = FloorService.GetFloor((Guid)camDTO.Floor);
            }
            else
            {
                cam.Floor = null;
            }

            //if (camDTO.People != null)
            // {
            //    foreach (Guid personGuid in camDTO.People) cam.People.Add(PersonService.GetPerson(personGuid));
            // }
            //Seems like we need a person type service too.
            if (cam.PersonTypes == null)
            {
                cam.PersonTypes = new List <PersonType>();
            }
            return(cam);
        }
Esempio n. 4
0
        public async Task <ReadFloorDTO> GetFloor(EntityDTO input)
        {
            try
            {
                var floor = await _floorService.GetFloor(input);

                return(floor);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IHttpActionResult Get(int id)
        {
            var floor = _service.GetFloor(id);

            if (floor != null)
            {
                return(Ok(floor));
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 6
0
 // DELETE: api/Floors/23005604-eb1b-11de-85ba-806d6172696f
 public void Delete(Guid id)
 {
     Service.Delete(Service.GetFloor(id));
 }
Esempio n. 7
0
        public IHttpActionResult Get(int floorID)
        {
            var response = service.GetFloor(floorID);

            return(Ok(response));
        }