/// <summary> /// 生成单个时间段 /// </summary> /// <param name="addBusinessHourWeek"></param> /// <param name="operatorName"></param> /// <returns></returns> public int AddBusinessHourWeek(AddBusinessHourWeekDTO addBusinessHourWeek, string operatorName) { if (addBusinessHourWeek == null) { throw ErrorCodeHelper.BusinessHourWeekNull.ToException(); } if (string.IsNullOrWhiteSpace(operatorName)) { throw ErrorCodeHelper.OperatorNameNull.ToException(); } string uuid = System.Guid.NewGuid().ToString(); List <BusinessHourWeekPO> listBusinessHour = GetBusinessHourWeekList(null, null, null, new List <string> { addBusinessHourWeek.TypeUUID }, null); if (listBusinessHour.Count(x => x.WeekDay == addBusinessHourWeek.WeekDay) > 0) { throw new BusinessException("已存在此时间段"); } if (string.IsNullOrWhiteSpace(addBusinessHourWeek.Name)) { if (listBusinessHour != null && listBusinessHour.Count > 0) { addBusinessHourWeek.Name = listBusinessHour[0].Name; } } BusinessHourWeekPO businessHourWeek = new BusinessHourWeekPO() { AllowOrderNumber = addBusinessHourWeek.AllowOrderNumber, Deleted = false, EndDate = addBusinessHourWeek.EndDate, EndTime = addBusinessHourWeek.EndTime, InAdvance = addBusinessHourWeek.InAdvance, LatestOrderTime = addBusinessHourWeek.LatestOrderTime, Name = addBusinessHourWeek.Name, ResUUID = addBusinessHourWeek.ResUUID, SortIndex = addBusinessHourWeek.SortIndex, StartDate = addBusinessHourWeek.StartDate, StartTime = addBusinessHourWeek.StartTime, State = addBusinessHourWeek.State, UUID = System.Guid.NewGuid().ToString(), WeekDay = addBusinessHourWeek.WeekDay, TypeUUID = addBusinessHourWeek.TypeUUID, }; return(Add(businessHourWeek, operatorName)); }
public ReturnValue <int> AddBusinessHourWeek(AddBusinessHourWeekDTO addBusinessHourWeek, string operatorName) { return(ReturnValue <int> .Get200OK(BusinessHourWeekManager.Instance.AddBusinessHourWeek(addBusinessHourWeek, operatorName))); }