/// <summary> /// 启用角色 /// </summary> /// <param name="roleId"></param> public void EnableRole(int roleId) { UpdateRoleStatus(roleId, 0); int authId = SubjectUtils.GetAuthenticationId(); Log.M(Loggers.USER_ENABLE_ROLE, authId, roleId); }
/// <summary> /// 添加用户 /// </summary> /// <param name="employeeId"></param> public int Add(int employeeId, string username, string passwd) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Employee employee = entities.Employee.Find(employeeId); if (null == employee) { throw new ServiceException("无法找到对应的员工,编号为:【" + employeeId + "】"); } int authorId = SubjectUtils.GetAuthenticationId(); UserInfo _UserInfo = new UserInfo(); _UserInfo.EmployeeId = employeeId; if (null != username || null != passwd) { _UserInfo.Username = username; _UserInfo.Salt = CryptoUtils.GetSalt(); _UserInfo.Password = CryptoUtils.MD5Encrypt(passwd); _UserInfo.CreateBy = SubjectUtils.GetAuthenticationId(); } _UserInfo.CreateDatetime = DateTime.Now; entities.UserInfo.Add(_UserInfo); try { entities.SaveChanges(); Log.A(Loggers.USER_NEW, authorId, _UserInfo.UserId); }catch (DbEntityValidationException e) { throw new ServiceException(e.Message); } return(_UserInfo.UserId); } }
public bool Add(string _Code, int _DishesWayNameId, string _Name, string _PingYing, double _AddPrice, int _AddPriceByNum) { //添加 using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { DischesWay odw = new DischesWay(); odw.Code = _Code; odw.DischesWayNameId = _DishesWayNameId; odw.Name = _Name; odw.PingYing = _PingYing; odw.AddPrice = _AddPrice; odw.AddPriceByNum = _AddPriceByNum; odw.CreateBy = SubjectUtils.GetAuthenticationId(); odw.CreateDatetime = DateTime.Now; entities.DischesWay.Add(odw); entities.SaveChanges(); return(true); } catch (Exception e) { e.ToString(); return(false); } } }
//根据做法类型id修改删除状态 public bool UpdateDishesWayNameDeletedTypeById(int Id) { if (Id == null) { return(false); } //修改 直接修改 using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { var type = entities.DischesWayName.SingleOrDefault(bt => bt.DischesWayNameId == Id); if (type != null) { type.UpdateBy = SubjectUtils.GetAuthenticationId(); //操作人员id type.UpdateDatetime = DateTime.Now; type.Deleted = 1; entities.SaveChanges(); return(true); } } catch (Exception e) { e.ToString(); return(false); } } return(false); }
//修改菜品做法类型,传入的参数需要包含:DischesWayNameId/Code,Name,Status,Deleted,UpdateBy,UpdateDatetime字段 public bool UpdateDishesWayName(DischesWayName dwn) { if (dwn == null) { return(false); } //修改 直接修改 using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { var type = entities.DischesWayName.SingleOrDefault(bt => bt.DischesWayNameId == dwn.DischesWayNameId); if (type != null) { type.Name = dwn.Name; type.Status = dwn.Status; type.UpdateBy = SubjectUtils.GetAuthenticationId(); type.UpdateDatetime = DateTime.Now; type.Deleted = dwn.Deleted; entities.SaveChanges(); return(true); } } catch (Exception e) { e.ToString(); return(false); } } return(false); }
/// <summary> /// 为制定的用户设置角色 /// </summary> /// <param name="userId"></param> /// <param name="roles"></param> public void Grant(int userId, int[] roles) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { UserInfo userInfo = entities.UserInfo.Find(userId); if (null == userInfo) { throw new ServiceException("未找到对应的用户【" + userId + "】"); } List <UserRoleRef> _RefList = new List <UserRoleRef>(); int authId = SubjectUtils.GetAuthenticationId(); DateTime now = DateTime.Now; foreach (var r in roles) { UserRoleRef _ref = new UserRoleRef(); _ref.RoleId = r; _ref.UserId = userId; _ref.CreateBy = authId; _ref.CreateDateTime = now; _RefList.Add(_ref); } entities.UserRoleRef.AddRange(_RefList); entities.SaveChanges(); Log.M(Loggers.USER_GRANT_ROLE, authId, userId, new object[] { roles }); } }
public List <BargainDish> CreateBargainDishList(DishBeanUtil[] _BargainDiahSelectList) { if (_BargainDiahSelectList != null && _BargainDiahSelectList.Length > 0) { List <BargainDish> list = new List <BargainDish>(); foreach (var element in _BargainDiahSelectList) { BargainDish bargainDishBean = CreateBargainDish(this); bargainDishBean.DishId = element.DishId; bargainDishBean.Enable = 1; bargainDishBean.MarketTypeId = 0; bargainDishBean.CreateBy = SubjectUtils.GetAuthenticationId(); BargainDishPrice bargainDishPrice = new BargainDishPrice(); bargainDishPrice.Price1 = element.Price1; bargainDishPrice.Price2 = element.Price2; bargainDishPrice.Price3 = element.Price3; bargainDishPrice.MemberPrice3 = element.MemberPrice3; bargainDishPrice.MemberPrice2 = element.MemberPrice2; bargainDishPrice.MemberPrice1 = element.MemberPrice1; bargainDishPrice.DishSpecification = element.DishFormat; bargainDishPrice.CreateBy = bargainDishBean.CreateBy; bargainDishPrice.CreateTime = DateTime.Now; bargainDishBean.BargainDishPrice.Add(bargainDishPrice); list.Add(bargainDishBean); } return(list); } return(null); }
public ClearEstimate CreateClearEstimateDishObject(ClearEstimateModel model) { ClearEstimate clearEstimateDish = CreateClearEstimateDish(model); clearEstimateDish.Status = 1; clearEstimateDish.CreateBy = SubjectUtils.GetAuthenticationId(); clearEstimateDish.CreateDatetime = DateTime.Now; return(clearEstimateDish); }
private DischesWayRef GetDischesWayRef(int dishesId, int DishesWayId) { DischesWayRef dr = new DischesWayRef() { DishId = dishesId, DischesWayId = DishesWayId, CreateBy = SubjectUtils.GetAuthenticationId(), CreateDatetime = DateTime.Now }; return(dr); }
public void AddRole(string name, string Description) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Role _Role = new Role(); _Role.Name = name; _Role.Description = Description; _Role.CreateBy = SubjectUtils.GetAuthenticationId(); _Role.CreateDateTime = DateTime.Now; entities.Role.Add(_Role); entities.SaveChanges(); } }
// public void SaveTableInBatch(int loop) { Table table = new Table(); if (CodePrefix != null && !CodePrefix.Trim().Equals("")) {//编号有前缀 int lengthDiff = Convert.ToInt32(CodeLength) - (CodePrefix.Length + loop.ToString().Length); if (lengthDiff <= 0) {//前缀加编号是否大于编号长度,如果小于则要补0 table.Code = CodePrefix + loop.ToString(); } else {//长度不达标,中间补0 for (int Cursor = 1; Cursor <= lengthDiff; Cursor++) { table.Code = CodePrefix + "0"; } table.Code = table.Code + loop.ToString(); } } else {//编号没有前缀 int lengthDiff = Convert.ToInt32(CodeLength) - loop.ToString().Length; if (lengthDiff <= 0) {//前缀加编号是否大于编号长度,如果小于则要补0 table.Code = loop.ToString(); } else {//长度不达标,中间补0 for (int Cursor = 1; Cursor <= lengthDiff; Cursor++) { table.Code = "0"; } table.Code = table.Code + loop.ToString(); } } table.Name = "桌" + table.Code; table.LocationId = LocationId; table.TableTypeId = TableTypeId; table.Seat = Convert.ToInt32(Seat); table.Deleted = 0; table.Status = Status; table.CreateBy = SubjectUtils.GetAuthenticationId(); table.CreateDatetime = DateTime.Now; table.UpdateBy = SubjectUtils.GetAuthenticationId(); table.UpdateDatetime = DateTime.Now; _TableService.SaveTable(table); //刷新餐桌列表数据 TableGrid.Add(table); }
public int Add(string code, string name) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { var list = entities.DishesMenu.Where(t => t.Deleted == 0 && (t.Code == code || t.Name == name)).ToList(); if (list != null && list.Count > 0) { return(0); } DishesMenu menu = DishesMenuModel.build(code, name, SubjectUtils.GetAuthenticationId()); entities.DishesMenu.Add(menu); entities.SaveChanges(); return(menu.MenusId); } }
/// <summary> /// 收回制定角色的权限 /// </summary> /// <param name="roleId">角色编号</param> /// <param name="Function">权限ID列表</param> public void RevokeFunctionForRole(int roleId, String functionId) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { RoleRefFunction p = entities.RoleRefFunction.Where(t => t.RoleId == roleId && t.FunctionId == functionId && t.Deleted == 0).Single(); if (null == p) { throw new ServiceException("无法找到对应角色【" + roleId + "】的授权编号【" + functionId + "】"); } int authId = SubjectUtils.GetAuthenticationId(); p.Deleted = 1; p.UpdateBy = authId; p.UpdateDateTime = DateTime.Now; entities.SaveChanges(); } }
/// <summary> /// 更新权限状态 /// </summary> /// <param name="premissionId">权限编号</param> /// <param name="status">权限状态(0,启用,1禁用)</param> private void UpdateFunctiontatus(String FunctionId, int status) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Function pre = entities.Function.Where(t => t.Id == FunctionId).Single(); if (null == pre) { throw new ServiceException("无法找到指定的权限【" + FunctionId + "】"); } int authId = SubjectUtils.GetAuthenticationId(); DateTime now = DateTime.Now; pre.Disabled = status; entities.SaveChanges(); } }
/// <summary> /// 给制定的角色赋予权限 /// </summary> /// <param name="roleId">角色编号</param> /// <param name="Function">权限ID列表</param> public void GrantFunctionForRole(int roleId, String functionId) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { RoleRefFunction rp = new RoleRefFunction(); int authId = SubjectUtils.GetAuthenticationId(); rp.Deleted = 0; rp.RoleId = roleId; rp.FunctionId = functionId; rp.CreateBy = authId; rp.CreateDateTime = DateTime.Now; entities.RoleRefFunction.Add(rp); entities.SaveChanges(); } }
public int SaveTypeMethod() { try { TableType type = new TableType(); type.Code = Code; type.Name = Name; type.PeopleMax = Convert.ToInt32(PeopleMax); type.PeopleMin = Convert.ToInt32(PeopleMin); //type.Prefix = Prefix; type.PriceType = (int)PriceType; type.ServerfreeModel = (int)ServerfreeModel; type.LowConsCalcType = (int)LowConsCalcType; type.ServerFeeCalcType = (int)ServerFeeCalcType; type.Status = 0; type.Deleted = 0; type.ColorType = ColorType; type.CreateDatetime = DateTime.Now; type.CreateBy = SubjectUtils.GetAuthenticationId(); type.UpdateBy = SubjectUtils.GetAuthenticationId(); type.UpdateDatetime = DateTime.Now; ServerFeeDetail.CreateBy = SubjectUtils.GetAuthenticationId(); ServerFeeDetail.DataType = 1; ServerFeeDetail.ServerfreeAccountType = (int)ServerfreeAccountType; LowConsumerDetail.CreateBy = SubjectUtils.GetAuthenticationId(); LowConsumerDetail.DataType = 2; LowConsumerDetail.ConsumerMode = (int)ConsumerMode; int tableTypeId = TableService.SaveTableTypeAll(type, ServerFeeDetail, LowConsumerDetail); MessageBox.Show("新增成功!"); //刷新界面上的目录树 TableViewModel tableModel = ServiceLocator.Current.GetInstance <TableViewModel>(); _TableTypeTree = tableModel.TableTypeTree; TableTypeTreeNode tableTypeTreeNode = new TableTypeTreeNode(type.TableTypeId.ToString(), type.Name, tableModel.TableTypeTree[0], false, null); tableTypeTreeNode.Action = tableModel.LoadTableTypeAction; tableModel.TableTypeTree[0].Children.Add(tableTypeTreeNode); return(tableTypeId); } catch (Exception e) { throw new ServiceException(e.Message); } }
private void UpdateRoleStatus(int roleId, int status) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Role role = entities.Role.Where(t => t.RoleId == roleId).Single(); if (null == role) { throw new ServiceException("无法找到指定的角色【" + roleId + "】"); } int authId = SubjectUtils.GetAuthenticationId(); DateTime now = DateTime.Now; role.Deleted = status; role.UpdateBy = authId; entities.SaveChanges(); } }
public bool ModifyStatus(int TableId, int Status) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { var type = entities.TableItem.SingleOrDefault(bt => bt.Deleted == 0 && bt.TableId == TableId); if (type != null) { type.UpdateBy = SubjectUtils.GetAuthenticationId(); type.UpdateDatetime = DateTime.Now; type.Status = Status; entities.SaveChanges(); return(true); } return(false); } }
/// <summary> /// 删除用户销售规则 /// </summary> /// <param name="userId"></param> public void RemoveSaleRuleByUserId(int userId) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { UserSaleRule saleRule = entities.UserSaleRule.Where(t => t.UserId == userId && t.Deleted == 0).Single(); if (null == saleRule) { return; } int authId = SubjectUtils.GetAuthenticationId(); DateTime now = DateTime.Now; saleRule.Deleted = 1; saleRule.UpdateBy = authId; entities.SaveChanges(); } }
public void SaveOnUpdateForUserSaleRule(int userId, UserSaleRule saleRule) { if (null == saleRule) { throw new ServiceException("参数【saleRule】不能为空!"); } using (ChooseDishesEntities entities = new ChooseDishesEntities()) { try { UserSaleRule savedSaleRule = entities.UserSaleRule.Where(t => t.Deleted == 0 && t.UserId == userId).SingleOrDefault(); //不存在销售规则,则抛出异常 if (savedSaleRule == null) { savedSaleRule = new UserSaleRule(); try { savedSaleRule.CreateBy = SubjectUtils.GetAuthenticationId(); savedSaleRule.CreateDatetime = DateTime.Now; saleRule.UserId = userId; saleRule.CreateBy = SubjectUtils.GetAuthenticationId(); saleRule.CreateDatetime = DateTime.Now; entities.UserSaleRule.Add(saleRule); entities.SaveChanges(); } catch (DbUpdateException e) { e.ToString(); } } else { // savedSaleRule.DiscountAllowanceLimit = saleRule.DiscountAllowanceLimit; savedSaleRule.DiscountLimit = saleRule.DiscountLimit; savedSaleRule.AlowanceType = saleRule.AlowanceType; savedSaleRule.AllowanceLimit = saleRule.AllowanceLimit; savedSaleRule.PresentType = saleRule.PresentType; savedSaleRule.PresentLimit = saleRule.PresentLimit; savedSaleRule.UpdateDatetime = DateTime.Now; savedSaleRule.UpdateBy = SubjectUtils.GetAuthenticationId(); entities.SaveChanges(); } } catch (DbEntityValidationException e) { e.ToString(); } } }
/// <summary> /// 修改服务费低消设置 /// </summary> /// <param name="detail">服务费设置详细</param> /// <param name="serverFeeMode">服务费模式</param> /// <returns>成功则返回true,失败返回false</returns> public bool UpdateTableTypeDetail(TableTypeDetail detail) { try { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { detail.UpdateBy = SubjectUtils.GetAuthenticationId(); detail.UpdateDatetime = DateTime.Now; DbEntityEntry <IShow.ChooseDishes.Data.TableTypeDetail> entry = entities.Entry <IShow.ChooseDishes.Data.TableTypeDetail>(detail); entry.State = System.Data.Entity.EntityState.Unchanged; entry.Property("StartMoney").IsModified = true; entry.Property("StartGetMoneyTime").IsModified = true; entry.Property("StartUnit").IsModified = true; entry.Property("StartDateTime").IsModified = true; entry.Property("EndDateTime").IsModified = true; entry.Property("OutMoney").IsModified = true; entry.Property("OutTime").IsModified = true; entry.Property("OutTimeFree").IsModified = true; entry.Property("ServerfreeNax").IsModified = true; entry.Property("ServerfreeAccountType").IsModified = true; entry.Property("ServerfreeNum").IsModified = true; entry.Property("Rate").IsModified = true; entry.Property("ConsumerMode").IsModified = true; entry.Property("ConsumerMoney").IsModified = true; entry.Property("UpdateDatetime").IsModified = true; entry.Property("UpdateBy").IsModified = true; //entry.Property("TableTypeDetailId").IsModified = false; entities.Configuration.ValidateOnSaveEnabled = false; int result = entities.SaveChanges(); entities.Configuration.ValidateOnSaveEnabled = false; if (result == 1) { return(true); } else { return(false); } } } catch (Exception e) { throw e; } }
public void UpdateTypeMethod() { try { TableType type = new TableType(); type.Code = Code; type.Name = Name; type.PeopleMax = Convert.ToInt32(PeopleMax); type.PeopleMin = Convert.ToInt32(PeopleMin); //type.Prefix = Prefix; type.PriceType = (int)PriceType; type.ServerfreeModel = (int)ServerfreeModel; type.LowConsCalcType = (int)LowConsCalcType; type.ServerFeeCalcType = (int)ServerFeeCalcType; type.Status = 0; type.Deleted = 0; type.ColorType = ColorType; type.CreateDatetime = DateTime.Now; type.CreateBy = SubjectUtils.GetAuthenticationId(); type.UpdateBy = SubjectUtils.GetAuthenticationId(); type.UpdateDatetime = DateTime.Now; type.CanDiscount = CanDiscount; type.InLowConsume = InLowConsume; TableViewModel tableViewModel = ServiceLocator.Current.GetInstance <TableViewModel>(); if (currentTableTypeId == null) {//修改窗口修改餐桌类型 type.TableTypeId = tableViewModel.SelectedType.TableTypeId; } else//新增窗口修改餐桌类型 { type.TableTypeId = (int)currentTableTypeId; } ServerFeeDetail.UpdateBy = SubjectUtils.GetAuthenticationId(); ServerFeeDetail.ServerfreeAccountType = (int)ServerfreeAccountType; LowConsumerDetail.ConsumerMode = (int)ConsumerMode; LowConsumerDetail.UpdateBy = SubjectUtils.GetAuthenticationId(); TableService.UpdateTableTypeAll(type, ServerFeeDetail, LowConsumerDetail); } catch (Exception e) { throw e; } }
/// <summary> /// 删除用户 /// </summary> /// <param name="userId"></param> public void Delete(int userId) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { UserInfo userInfo = entities.UserInfo.Where(t => t.Deleted == 0 && t.UserId == userId).Single(); if (null == userInfo) { throw new ServiceException("无法找对删除的用户【" + userId + "】"); } int authId = SubjectUtils.GetAuthenticationId(); userInfo.Deleted = 1; userInfo.UpdateBy = authId; userInfo.UpdateDateTime = DateTime.Now; entities.SaveChanges(); Log.M(Loggers.USER_DELETE, authId, userId); } }
/// <summary> /// 删除角色 /// </summary> /// <param name="roleId"></param> public void DeleteRole(int roleId) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Role role = entities.Role.Where(t => t.RoleId == roleId).Single(); if (null == role) { throw new ServiceException("无法找到指定的角色【" + roleId + "】"); } int authId = SubjectUtils.GetAuthenticationId(); DateTime now = DateTime.Now; role.Deleted = 1; role.UpdateBy = authId; entities.SaveChanges(); // Log.M(Loggers.USER_DELETE_ROLE, authId, roleId); } }
public bool update(int menusId, string code, string name) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { var list = entities.DishesMenu.Where(t => t.Deleted == 0 && (t.Code == code || t.Name == name)).ToList(); if (list != null && list.Count > 1) { return(false); } var type = entities.DishesMenu.SingleOrDefault(t => t.Deleted == 0 && t.MenusId == menusId); type.Code = code; type.Name = name; type.UpdateBy = SubjectUtils.GetAuthenticationId(); type.UpdateDatetime = DateTime.Now; entities.SaveChanges(); return(true); } }
/// <summary> /// 加载做法基本数据 /// </summary> private void InitDishesWayTypeBaseData() { List <DischesWayName> dwns = _DataService.FindAllDishesWayName(); DishesWayTypeItems.Clear(); if (dwns != null) { foreach (var dwn in dwns) { _DishesWayNameBean = new DishesWayNameBean(); _DishesWayNameBean.LineNumber = DishesWayTypeItems.Count + 1; _DishesWayNameBean.CreateDishesWayNameBean(dwn); _DishesWayNameBean.UpdateBy = SubjectUtils.GetAuthenticationId(); _DishesWayNameBean.UpdateDatetime = DateTime.Now; DishesWayTypeItems.Add(DishesWayNameBean); } } }
//删除折扣方案明细 public bool DeleteDetail(int typeId) { bool flag = true; using (ChooseDishesEntities entities = new ChooseDishesEntities()) { Expression <Func <DiscountDetail, bool> > checkCourse = Detail => Detail.DiscountId == typeId && Detail.Deleted == 0; //先查询 后修改 List <DiscountDetail> type = entities.DiscountDetail.Where(checkCourse).ToList(); if (type != null && type.Count > 0) { foreach (var t in type) { t.UpdateBy = SubjectUtils.GetAuthenticationId(); t.UpdateDatetime = DateTime.Now; t.Deleted = 1; //直接修改的方式 DbEntityEntry <DiscountDetail> entry = entities.Entry <DiscountDetail>(t); entry.State = System.Data.Entity.EntityState.Modified; //设置修改状态为ture 否则数据库不会更新 entry.Property("UpdateBy").IsModified = true; entry.Property("Deleted").IsModified = true; entry.Property("UpdateDatetime").IsModified = true; try { //关闭实体验证,不关闭验证需要整个对象全部传值 entities.Configuration.ValidateOnSaveEnabled = false; var result = entities.SaveChanges(); entities.Configuration.ValidateOnSaveEnabled = true; if (result <= 0) { return(false); } } catch (Exception ex) { ex.ToString(); } } } return(flag); } }
public PromotionsDish CreatePromotionsDishObject(PromotionsDishDetailBean[] promotionsDishDetailBean) { PromotionsDish beanBack = CreatePromotionsDish(this); beanBack.Status = 1; beanBack.PromotionsDishDetail.Clear(); if (promotionsDishDetailBean != null && promotionsDishDetailBean.Length > 0) { foreach (var element in promotionsDishDetailBean) { element.CreateBy = SubjectUtils.GetAuthenticationId(); element.CreateDatetime = DateTime.Now; element.Status = 1; beanBack.PromotionsDishDetail.Add(element.CreatePromotionsDishDetail(element)); } } return(beanBack); }
/// <summary> /// 收回权限 /// </summary> /// <param name="userId"></param> /// <param name="roles"></param> public void Revoke(int userId, int[] roles) { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { List <UserRoleRef> roleRes = entities.UserRoleRef.Where(t => t.UserId == userId && roles.Any(a => t.RoleId == a) && t.Deleted == 0).ToList(); if (null == roleRes || roleRes.Count == 0) { throw new ServiceException("无法收回不存在的用户【" + userId + "】的角色【" + Convert.ToString(roleRes) + "】!"); } int authId = SubjectUtils.GetAuthenticationId(); DateTime now = DateTime.Now; foreach (var role in roleRes) { role.Deleted = 1; role.UpdateBy = authId; role.UpdateDateTime = now; } entities.SaveChanges(); Log.M(Loggers.USER_REVOKE_ROLE, authId, userId, new object[] { roles }); } }
public bool ModifyDeleted(int dishesId, int DishesWayId) { try { using (ChooseDishesEntities entities = new ChooseDishesEntities()) { var type = entities.DischesWayRef.SingleOrDefault(d => d.Deleted == 0 && d.DishId == dishesId && d.DischesWayId == DishesWayId); type.Deleted = 1; type.UpdateBy = SubjectUtils.GetAuthenticationId(); type.UpdateDatetime = DateTime.Now; entities.SaveChanges(); return(true); } } catch (Exception ex) { ex.ToString(); throw new ServiceException("删除菜品做法关联状态失败"); } }