public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateCateringSetting(Deploy.CustomDTO.FCYSettingCDTO settingDTO) { //定义返回值 Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO result; try { //调用代理方法 result = base.Channel.UpdateCateringSetting(settingDTO); } catch { //抛异常 throw; } finally { //关链接 ChannelClose(); } //返回结果 return(result); }
public Deploy.CustomDTO.FCYSettingCDTO GetCateringSettingByAppIdExt(System.Guid appId) { Deploy.CustomDTO.FCYSettingCDTO CYSetting = new Deploy.CustomDTO.FCYSettingCDTO(); Deploy.CustomDTO.FCateringSettingCDTO fcs = (from cs in BE.CateringSetting.ObjectSet() where cs.AppId == appId && cs.IsDel == false select new Deploy.CustomDTO.FCateringSettingCDTO { Unit = cs.Unit, Specification = cs.Specification, DeliveryAmount = cs.DeliveryAmount, DeliveryRange = cs.DeliveryRange, DeliveryFee = cs.DeliveryFee, MostCoupon = cs.MostCoupon, AppId = cs.AppId, StoreId = cs.StoreId, Id = cs.Id, DeliveryFeeDiscount = cs.DeliveryFeeDiscount, DeliveryFeeStartT = cs.DeliveryFeeStartT, DeliveryFeeEndT = cs.DeliveryFeeEndT, FreeAmount = cs.FreeAmount }).FirstOrDefault(); CYSetting.CateringSetting = fcs; CYSetting.CYBusinessHours = (from cbh in BE.CateringBusinessHours.ObjectSet() where cbh.CateringSettingId == fcs.Id select new Deploy.CustomDTO.FCateringBusinessHoursCDTO { openingTime = cbh.OpeningTime, closingTime = cbh.ClosingTime }).ToList(); CYSetting.CYShiftTime = (from shift in BE.CateringShiftTime.ObjectSet() where shift.CateringSettingId == fcs.Id select new Deploy.CustomDTO.FCateringShiftTimeCDTO() { shiftTime = shift.ShiftTime }).ToList(); return(CYSetting); }
public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateCateringSetting(Deploy.CustomDTO.FCYSettingCDTO settingDTO) { base.Do(); return(this.Command.UpdateCateringSetting(settingDTO)); }
public ResultDTO UpdateCateringSettingExt(Deploy.CustomDTO.FCYSettingCDTO settingDTO) { try { var setting = CateringSetting.ObjectSet().SingleOrDefault(r => r.Id == settingDTO.CateringSetting.Id && r.AppId == settingDTO.CateringSetting.AppId); if (setting == null) { return new ResultDTO { ResultCode = 3, Message = "未找到该店铺!" } } ; setting.DeliveryAmount = settingDTO.CateringSetting.DeliveryAmount; setting.DeliveryFee = settingDTO.CateringSetting.DeliveryFee; setting.DeliveryRange = settingDTO.CateringSetting.DeliveryRange; setting.MostCoupon = settingDTO.CateringSetting.MostCoupon; setting.Unit = settingDTO.CateringSetting.Unit; setting.Specification = settingDTO.CateringSetting.Specification; setting.DeliveryFeeDiscount = settingDTO.CateringSetting.DeliveryFeeDiscount; setting.DeliveryFeeEndT = settingDTO.CateringSetting.DeliveryFeeEndT; setting.DeliveryFeeStartT = settingDTO.CateringSetting.DeliveryFeeStartT; setting.FreeAmount = settingDTO.CateringSetting.FreeAmount; setting.IsDel = false; setting.ModifiedOn = DateTime.Now; setting.EntityState = EntityState.Modified; ContextFactory.CurrentThreadContext.SaveObject(setting); var hours = CateringBusinessHours.ObjectSet().Where(r => r.CateringSettingId == setting.Id).ToList(); if (hours != null && hours.Count > 0) { hours.ForEach(r => { r.EntityState = EntityState.Deleted; ContextFactory.CurrentThreadContext.SaveObject(r); }); } if (settingDTO.CYBusinessHours != null && settingDTO.CYBusinessHours.Count > 0) { settingDTO.CYBusinessHours.ForEach(r => { var hour = CateringBusinessHours.CreateCateringBusinessHours(); hour.OpeningTime = r.openingTime; hour.ClosingTime = r.closingTime; hour.Id = Guid.NewGuid(); hour.CateringSettingId = setting.Id; hour.SubTime = hour.ModifiedOn = DateTime.Now; hour.SubId = this.ContextDTO.LoginUserID; hour.EntityState = EntityState.Added; ContextFactory.CurrentThreadContext.SaveObject(hour); }); } var shiftTimes = CateringShiftTime.ObjectSet().Where(r => r.CateringSettingId == setting.Id).ToList(); if (shiftTimes != null && shiftTimes.Count > 0) { shiftTimes.ForEach(r => { r.EntityState = EntityState.Deleted; ContextFactory.CurrentThreadContext.SaveObject(r); }); } if (settingDTO.CYShiftTime != null && settingDTO.CYShiftTime.Count > 0) { settingDTO.CYShiftTime.ForEach(r => { var hour = CateringShiftTime.CreateCateringShiftTime(); hour.ShiftTime = r.shiftTime; hour.Id = Guid.NewGuid(); hour.CateringSettingId = setting.Id; hour.SubTime = hour.ModifiedOn = DateTime.Now; hour.SubId = this.ContextDTO.LoginUserID; hour.EntityState = EntityState.Added; ContextFactory.CurrentThreadContext.SaveObject(hour); }); } if (ContextFactory.CurrentThreadContext.SaveChanges() > 0) { return(new ResultDTO { ResultCode = 0, Message = "Success" }); } } catch (Exception ex) { LogHelper.Error(string.Format("修改门店异常。commodityAndCategoryDTO:{0}", settingDTO), ex); } return(new ResultDTO { ResultCode = 1, Message = "Error" }); }
public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddCateringSetting(Deploy.CustomDTO.FCYSettingCDTO settingDTO) { base.Do(); return(this.AddCateringSettingExt(settingDTO)); }