// *** Start programmer edit section *** (BusinessServer CustomMembers) // *** End programmer edit section *** (BusinessServer CustomMembers) // *** Start programmer edit section *** (OnUpdateExceptionDay CustomAttributes) /// <summary> /// /// </summary> /// <param name="UpdatedObject"></param> /// <returns></returns> // *** End programmer edit section *** (OnUpdateExceptionDay CustomAttributes) public virtual ICSSoft.STORMNET.DataObject[] OnUpdateExceptionDay(IIS.BusinessCalendar.ExceptionDay UpdatedObject) { // *** Start programmer edit section *** (OnUpdateExceptionDay) if (UpdatedObject.GetStatus() == ObjectStatus.Deleted) { DataServiceProvider.DataService.LoadObject(ExceptionDay.Views.ExceptionDayE, UpdatedObject, false, false); if (UpdatedObject.WorkTimeDefinition != null) { TSSaveHelper.DeleteTimeSpans(UpdatedObject); WorkTimeDefinition tempWts = UpdatedObject.WorkTimeDefinition; UpdatedObject.WorkTimeDefinition = null; DataServiceProvider.DataService.UpdateObject(UpdatedObject); UpdatedObject.SetStatus(ObjectStatus.Deleted); return(new DataObject[2] { tempWts, UpdatedObject }); } else { UpdatedObject.SetStatus(ObjectStatus.Deleted); } } return(new ICSSoft.STORMNET.DataObject[0]); // *** End programmer edit section *** (OnUpdateExceptionDay) }
/// <summary> /// Нетривиальная логика сохранения объекта. /// </summary> /// <returns>Объект данных, который сохранился.</returns> protected override DataObject SaveObject() { if (DataObject != null) { switch (DataObject.GetStatus()) { case ObjectStatus.Created: using (var ds = (SQLDataService)DataServiceProvider.DataService) { object calendarId = Session["CalendarID"]; Calendar calendar = ds.Query <Calendar>() .Where(c => c.__PrimaryKey == calendarId) .First(); ds.LoadObject(calendar); DataObject.Calendar = calendar; } TSSaveHelper.CreateTimeSpans(DataObject); break; case ObjectStatus.Deleted: TSSaveHelper.DeleteTimeSpans(DataObject); break; default: { if (ctrlMondayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Monday, DataObject.MondayTS); } if (ctrlTuesdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Tuesday, DataObject.TuesdayTS); } if (ctrlWednesdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Wednesday, DataObject.WednesdayTS); } if (ctrlThursdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Thursday, DataObject.ThursdayTS); } if (ctrlFridayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Friday, DataObject.FridayTS); } if (ctrlSaturdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Saturday, DataObject.SaturdayTS); } if (ctrlSundayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Sunday, DataObject.SundayTS); } } break; } } return(base.SaveObject()); }
/// <summary> /// Нетривиальная логика сохранения объекта. /// </summary> /// <returns>Объект данных, который сохранился.</returns> protected override DataObject SaveObject() { if ((DataObject != null) && ((DataObject.GetStatus() == ObjectStatus.Created) || (ctrlWorkTimeSpans.Status == ObjectStatus.Altered))) { TSSaveHelper.UpdateTimeSpans(DataObject); } return(base.SaveObject()); }
/// <summary> /// Нетривиальная логика сохранения объекта. /// </summary> /// <returns>Объект данных, который сохранился.</returns> protected override DataObject SaveObject() { if (DataObject != null) { switch (DataObject.GetStatus()) { case ObjectStatus.Created: TSSaveHelper.CreateTimeSpans(DataObject); break; case ObjectStatus.Deleted: TSSaveHelper.DeleteTimeSpans(DataObject); break; default: { if (ctrlMondayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Monday, DataObject.MondayTS); } if (ctrlTuesdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Tuesday, DataObject.TuesdayTS); } if (ctrlWednesdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Wednesday, DataObject.WednesdayTS); } if (ctrlThursdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Thursday, DataObject.ThursdayTS); } if (ctrlFridayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Friday, DataObject.FridayTS); } if (ctrlSaturdayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Saturday, DataObject.SaturdayTS); } if (ctrlSundayTS.Status == ObjectStatus.Altered) { TSSaveHelper.UpdateTimeSpans(DataObject.Sunday, DataObject.SundayTS); } } break; } } return(base.SaveObject()); }
/// <summary> /// Нетривиальная логика сохранения объекта. /// </summary> /// <returns>Объект данных, который сохранился.</returns> protected override DataObject SaveObject() { if ((DataObject != null) && ((DataObject.GetStatus() == ObjectStatus.Created) || (ctrlWorkTimeSpans.Status == ObjectStatus.Altered))) { using (var ds = (SQLDataService)DataServiceProvider.DataService) { object calendarID = Session["CalendarID"]; Calendar calendar = ds.Query <Calendar>() .Where(c => c.__PrimaryKey == calendarID) .First(); ds.LoadObject(calendar); DataObject.Calendar = calendar; } TSSaveHelper.UpdateTimeSpans(DataObject); } return(base.SaveObject()); }
// *** Start programmer edit section *** (OnUpdateWeek CustomAttributes) /// <summary> /// Метод обрабатывает дополнительную логику обновления "Стандартной рабочей недели" в базе данных /// </summary> /// <param name="UpdatedObject">Изменяема неделя</param> /// <returns></returns> // *** End programmer edit section *** (OnUpdateWeek CustomAttributes) public virtual ICSSoft.STORMNET.DataObject[] OnUpdateWeek(IIS.BusinessCalendar.Week UpdatedObject) { // *** Start programmer edit section *** (OnUpdateWeek) if (UpdatedObject.GetStatus() == ObjectStatus.Deleted) { DataServiceProvider.DataService.LoadObject(Week.Views.WeekE, UpdatedObject, false, false); if ((UpdatedObject.Monday != null) || (UpdatedObject.Tuesday != null) || (UpdatedObject.Wednesday != null) || (UpdatedObject.Thursday != null) || (UpdatedObject.Friday != null) || (UpdatedObject.Saturday != null) || (UpdatedObject.Sunday != null)) { TSSaveHelper.DeleteTimeSpans(UpdatedObject); WorkTimeDefinition tempMon = UpdatedObject.Monday; WorkTimeDefinition tempTue = UpdatedObject.Tuesday; WorkTimeDefinition tempWed = UpdatedObject.Wednesday; WorkTimeDefinition tempThu = UpdatedObject.Thursday; WorkTimeDefinition tempFri = UpdatedObject.Friday; WorkTimeDefinition tempSun = UpdatedObject.Sunday; WorkTimeDefinition tempSat = UpdatedObject.Saturday; UpdatedObject.Monday = null; UpdatedObject.Tuesday = null; UpdatedObject.Wednesday = null; UpdatedObject.Thursday = null; UpdatedObject.Friday = null; UpdatedObject.Saturday = null; UpdatedObject.Sunday = null; DataServiceProvider.DataService.UpdateObject(UpdatedObject); UpdatedObject.SetStatus(ObjectStatus.Deleted); return(new DataObject[8] { tempMon, tempTue, tempWed, tempThu, tempFri, tempSat, tempSun, UpdatedObject }); } else { UpdatedObject.SetStatus(ObjectStatus.Deleted); } } return(new ICSSoft.STORMNET.DataObject[0]); // *** End programmer edit section *** (OnUpdateWeek) }
// *** Start programmer edit section *** (OnUpdateWeek CustomAttributes) /// <summary> /// Метод обрабатывает дополнительную логику обновления "Стандартной рабочей недели" в базе данных /// </summary> /// <param name="UpdatedObject">Изменяема неделя</param> /// <returns></returns> // *** End programmer edit section *** (OnUpdateWeek CustomAttributes) public virtual ICSSoft.STORMNET.DataObject[] OnUpdateWeek(IIS.BusinessCalendar.Week UpdatedObject) { // *** Start programmer edit section *** (OnUpdateWeek) if (UpdatedObject.GetStatus() == ObjectStatus.Deleted) { DataServiceProvider.DataService.LoadObject(Week.Views.WeekE, UpdatedObject, false, false); if ((UpdatedObject.Monday != null) || (UpdatedObject.Tuesday != null) || (UpdatedObject.Wednesday != null) || (UpdatedObject.Thursday != null) || (UpdatedObject.Friday != null) || (UpdatedObject.Saturday != null) || (UpdatedObject.Sunday != null)) { TSSaveHelper.DeleteTimeSpans(UpdatedObject); UpdatedObject.SetStatus(ObjectStatus.Deleted); return(new DataObject[8] { UpdatedObject, UpdatedObject.Monday, UpdatedObject.Tuesday, UpdatedObject.Wednesday, UpdatedObject.Thursday, UpdatedObject.Friday, UpdatedObject.Saturday, UpdatedObject.Sunday }); } else { UpdatedObject.SetStatus(ObjectStatus.Deleted); } } return(new ICSSoft.STORMNET.DataObject[0]); // *** End programmer edit section *** (OnUpdateWeek) }