コード例 #1
0
        public ActionResult SaveFloor(Models.Floor model)
        {
            Services.Floor floor = new Services.Floor();
            try {
                floor.id          = model.id;
                floor.CustomerId  = SessionData.customer.id;
                floor.Name        = model.Name;
                floor.Description = floor.Description;
                floor.Height      = model.Height;
                floor.Width       = model.Width;
                Int32 newId = _floorService.SaveFloor(floor);
                if (newId == 0)
                {
                    return(RedirectToAction("Index", "Error"));
                }

                SessionData.floor.id = newId;
                return(Json(newId));
            }
            catch (Exception ex) {
                base.Log(ex);
            }
            finally {
            }
            return(null);
        }
コード例 #2
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);
        }
コード例 #3
0
 public Boolean DeleteFloor(Int32? id) {
     Floor query = new Floor();
     id = id.HasValue ? id : 0;
     try {
         using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
             query = db.Floors.FirstOrDefault(m => m.id == id);
             if (query != default(Floor)) {
                 IEnumerable<Table> tables = db.Tables.Where(m => m.FloorId == id);
                 if (tables != null) {
                     db.Tables.DeleteAllOnSubmit(tables);
                 }
                 db.Floors.DeleteOnSubmit(query);
                 db.SubmitChanges();
             }
         }
     }
     catch (Exception ex) {
         return false;
     }
     return true;
 }
コード例 #4
0
        public ActionResult SaveFloor(Models.Floor model) {
            Services.Floor floor = new Services.Floor();
            try {
                floor.id = model.id;
                floor.CustomerId = SessionData.customer.id;
                floor.Name = model.Name;
                floor.Description = floor.Description;
                floor.Height = model.Height;
                floor.Width = model.Width;
                Int32 newId = _floorService.SaveFloor(floor);
                if (newId == 0)
                    return RedirectToAction("Index", "Error");

                SessionData.floor.id = newId;
                return Json(newId);
            }
            catch (Exception ex) {
                base.Log(ex);
            }
            finally {
            }
            return null;
        }
コード例 #5
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 = "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);
                    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;
                }
                return model;
            }
            catch (Exception ex) {
                base.Log(ex);
            }
            finally {
            }

            return null;
        }
コード例 #6
0
 public Int32 SaveFloor(Floor floor) {
     Floor query = new Floor();
     try {
         using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
             if (floor.id != 0)
                 query = db.Floors.FirstOrDefault(m => m.id == floor.id);
             if (query != default(Floor)) {
                 query.CustomerId = floor.CustomerId;
                 query.Name = floor.Name;
                 query.Description = floor.Description;
                 query.Height = floor.Height;
                 query.Width = floor.Width;
             }
             if (floor.id == 0) {
                 db.Floors.InsertOnSubmit(query);
             }
             db.SubmitChanges();
         }
     }
     catch (Exception ex) {
         return 0;
     }
     return query.id;
 }
コード例 #7
0
		private void detach_Floors(Floor entity)
		{
			this.SendPropertyChanging();
			entity.Customer = null;
		}
コード例 #8
0
		private void attach_Floors(Floor entity)
		{
			this.SendPropertyChanging();
			entity.Customer = this;
		}
コード例 #9
0
 partial void DeleteFloor(Floor instance);
コード例 #10
0
 partial void UpdateFloor(Floor instance);
コード例 #11
0
 partial void InsertFloor(Floor instance);