public ActionResult Desk_EditData(DXInfo.Models.Desks desk) { var gridModel = new DeskGridModel(); SetupDeskGridModel(gridModel); return(ajaxCallBack <DXInfo.Models.Desks>(gridModel.DeskGrid, desk, addDesk, editDesk, delDesk)); }
private void delDesk(DXInfo.Models.Desks desk) { var oldDesk = Uow.Desks.GetById(g => g.Id == desk.Id); if (oldDesk != null) { Uow.Desks.Delete(oldDesk); Uow.Commit(); } }
private void addDesk(DXInfo.Models.Desks desk) { var d = Uow.Desks.GetAll().Where(w => w.Code == desk.Code); if (d.Count() > 0) { throw new DXInfo.Models.BusinessException("桌号不能重复"); } Uow.Desks.Add(desk); Uow.Commit(); }
private void editDesk(DXInfo.Models.Desks desk) { var oldDesk = Uow.Desks.GetById(g => g.Id == desk.Id); oldDesk.Comment = desk.Comment; oldDesk.Code = desk.Code; oldDesk.Name = desk.Name; oldDesk.Status = desk.Status; oldDesk.Size = desk.Size; Uow.Desks.Update(oldDesk); Uow.Commit(); }
private List <DXInfo.Models.OrderDishes> getOrder(string deskNo, DateTime beginDate, DateTime endDate) { //DXInfo.Models.FairiesMemberManage db = new DXInfo.Models.FairiesMemberManage(); DXInfo.Models.Desks desk = uow.Desks.GetAll().Where(w => w.Code == deskNo).FirstOrDefault(); if (desk == null) { MessageBox.Show("未找到桌台"); return(new List <DXInfo.Models.OrderDishes>()); } var q = (from d in uow.OrderDeskes.GetAll() join o in uow.OrderDishes.GetAll() on d.OrderId equals o.Id where d.DeskId == desk.Id && o.CreateDate >= beginDate && o.CreateDate <= endDate select o).Distinct().ToList(); return(q); }
public OrderInfo GetOrder(string userName, string passwd, string deskNo) { OrderInfo orderInfo = new OrderInfo(); if (!LogOn(userName, passwd)) { return(null); } DXInfo.Models.aspnet_Users user = (from d in uow.aspnet_Users.GetAll() where d.UserName == userName select d).FirstOrDefault(); if (user == null) { throw new WebFaultException <string>("无“" + userName + "”操作员信息", HttpStatusCode.MethodNotAllowed); } orderInfo.OrderDesk.UserId = user.UserId; DXInfo.Models.aspnet_CustomProfile userProfile = uow.aspnet_CustomProfile.GetById(g => g.UserId == user.UserId); if (userProfile == null) { throw new WebFaultException <string>("无“" + userName + "”操作员信息", HttpStatusCode.MethodNotAllowed); } orderInfo.OrderDesk.UserName = user.UserName; orderInfo.OrderDesk.FullName = userProfile.FullName; //判断桌台是否可用 DXInfo.Models.Desks curdesk = uow.Desks.GetAll().Where(w => w.Code == deskNo).FirstOrDefault(); if (curdesk == null) { //throw new Exception("桌台错误"); throw new WebFaultException <string>(deskNo + "无此桌台", HttpStatusCode.MethodNotAllowed); } if (curdesk.Status != 1) { //throw new Exception("桌台不在用"); throw new WebFaultException <string>(deskNo + "不在用", HttpStatusCode.MethodNotAllowed); } orderInfo.OrderDesk.DeskId = curdesk.Id; orderInfo.OrderDesk.DeskNo = deskNo; //判断桌台是否使用 DXInfo.Models.OrderDeskes od = (from d in uow.OrderDeskes.GetAll() where d.DeskId == curdesk.Id && d.Status == 0 select d).FirstOrDefault(); if (od == null) { //throw new Exception("订单错误"); throw new WebFaultException <string>(deskNo + "未开台", HttpStatusCode.MethodNotAllowed); } orderInfo.OrderDesk.OrderDeskId = od.Id; DXInfo.Models.OrderDishes orderDish = (from d in uow.OrderDishes.GetAll() where d.Id == od.OrderId select d).FirstOrDefault(); if (orderDish == null) { throw new WebFaultException <string>("无此订单", HttpStatusCode.MethodNotAllowed); } if (!(orderDish.Status == 0 || orderDish.Status == 3)) { throw new WebFaultException <string>("已结账或已撤销", HttpStatusCode.MethodNotAllowed); } orderInfo.OrderDesk.OrderDishId = orderDish.Id; var q = from d in uow.OrderMenus.GetAll() where d.OrderId == od.OrderId && !(d.Status == 1 || d.Status == 7) join i in uow.Inventory.GetAll() on d.InventoryId equals i.Id into di from dis in di.DefaultIfEmpty() join p in uow.OrderPackages.GetAll() on d.PackageId equals p.Id into dp from dps in dp.DefaultIfEmpty() orderby d.Id select new OrderMenuInfo() { OrderMenuId = d.Id, InvId = d.InventoryId, InvCode = dis.Code, InvName = dis.Name, Amount = d.Amount, Quantity = d.Quantity, SalePrice = d.Price, EnglishName = dis.EnglishName, Comment = d.Comment, IsAdd = false, IsDelete = false, IsPackage = d.IsPackage, PackageId = d.PackageId, PackageSn = d.PackageSn, Status = d.Status, }; orderInfo.lOrderMenu = q.ToList(); List <DXInfo.Models.MenuStatus> lLackMenu = (from d in uow.MenuStatus.GetAll() where d.Dept == localDeptId && d.Status == (int)DXInfo.Models.OrderMenuStatus.Lack select d).ToList(); orderInfo.lLackMenu = lLackMenu; return(orderInfo); }
public OrderInfo OpenBookDesk(string userName, string passwd, int quantity, OrderBookDeskInfo orderBookDesk) { if (quantity == 0) { throw new WebFaultException <string>("请输入人数", HttpStatusCode.MethodNotAllowed); } if (!LogOn(userName, passwd)) { return(null); } DXInfo.Models.aspnet_Users user = uow.aspnet_Users.GetAll().Where(w => w.UserName == userName).FirstOrDefault(); if (user == null) { throw new WebFaultException <string>("无“" + userName + "”操作员信息", HttpStatusCode.MethodNotAllowed); } Guid userId = user.UserId; DXInfo.Models.aspnet_CustomProfile userProfile = uow.aspnet_CustomProfile.GetById(g => g.UserId == userId); if (userProfile == null) { throw new WebFaultException <string>("无“" + userName + "”操作员信息", HttpStatusCode.MethodNotAllowed); } //判断桌台是否可用 DXInfo.Models.Desks curdesk = uow.Desks.GetAll().Where(w => w.Id == orderBookDesk.DeskId && w.Status == (int)DXInfo.Models.DeskStatus.InUse).FirstOrDefault(); if (curdesk == null) { throw new WebFaultException <string>("桌台不可用", HttpStatusCode.MethodNotAllowed); } if (localDeptId == Guid.Empty) { throw new WebFaultException <string>("未获得本地部门信息", HttpStatusCode.MethodNotAllowed); } DXInfo.Restaurant.DeskManageFacade dmf = new DXInfo.Restaurant.DeskManageFacade(uow, localDeptId, userId); DateTime dtOperDate = DateTime.Now; dmf.dtOperDate = dtOperDate; DXInfo.Models.OrderDishes orderDish = new Models.OrderDishes(); DXInfo.Models.OrderDeskes orderDesk = new Models.OrderDeskes(); OrderInfo oi = new OrderInfo(); try { dmf.OpenBook(orderBookDesk.OrderBookId, orderBookDesk.DeskId, quantity, true, ref orderDish, ref orderDesk); oi.OrderDesk.OrderDishId = orderDish.Id; oi.OrderDesk.OrderDeskId = orderDesk.Id; oi.OrderDesk.DeskNo = orderBookDesk.DeskNo; oi.OrderDesk.DeskId = orderBookDesk.DeskId; oi.OrderDesk.UserId = userId; oi.OrderDesk.UserName = userName; oi.OrderDesk.FullName = userProfile.FullName; List <DXInfo.Models.MenuStatus> lLackMenu = (from d in uow.MenuStatus.GetAll() where d.Dept == localDeptId && d.Status == (int)DXInfo.Models.OrderMenuStatus.Lack select d).ToList(); oi.lLackMenu = lLackMenu; } catch (Exception ex) { throw new WebFaultException <string>(ex.Message, HttpStatusCode.MethodNotAllowed); } return(oi); }