public DayIntervalPartDetailsViewModel(DayInterval dayInterval, Guid organisationUID, DayIntervalPart dayIntervalPart = null)
		{
			DayInterval = dayInterval;
			if (dayIntervalPart == null)
			{
				Title = "Новый интервал";
				IsNew = true;
				dayIntervalPart = new DayIntervalPart()
				{
					DayIntervalUID = dayInterval.UID,
				};
			}
			else
			{
				Title = "Редактирование интервала";
				IsNew = false;
			}
			DayIntervalPart = dayIntervalPart;

			OrganisationUID = organisationUID;
			AvailableTransitions = new ObservableCollection<DayIntervalPartTransitionType>(Enum.GetValues(typeof(DayIntervalPartTransitionType)).OfType<DayIntervalPartTransitionType>());
			BeginTime = dayIntervalPart.BeginTime;
			EndTime = dayIntervalPart.EndTime;
			SelectedTransition = dayIntervalPart.TransitionType;
			oldBeginTime = BeginTime;
			oldEndTime = EndTime;
			oldTransitionType = SelectedTransition;
		}
		public RubezhAPI.OperationResult<bool> SaveDayInterval(DayInterval item, bool isNew)
		{
			return SafeOperationCall(() =>
			{
				var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10));
				using (rubezhService as IDisposable)
					return rubezhService.SaveDayInterval(RubezhServiceFactory.UID, item, isNew);
			}, "SaveDayInterval");
		}
		public OperationResult<bool> SaveDayInterval(Guid clientUID, DayInterval item, bool isNew)
		{
			if (isNew)
				AddJournalMessage(JournalEventNameType.Редактирование_дневного_графика, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_дневной_график, JournalObjectType.DayInterval);
			else
				AddJournalMessage(JournalEventNameType.Редактирование_дневного_графика, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_дневной_график, JournalObjectType.DayInterval);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.DayIntervalTranslator.Save(item);
			}
		}
		public OperationResult<bool> SaveDayInterval(Guid clientUID, DayInterval item, bool isNew)
		{
			return SafeOperationCall(clientUID, () => RubezhService.SaveDayInterval(clientUID, item, isNew), "SaveDayInterval");
		}
Exemple #5
0
		public static bool Save(DayInterval dayInterval, bool isNew)
		{
			var operationResult = ClientManager.RubezhService.SaveDayInterval(dayInterval, isNew);
			return Common.ShowErrorIfExists(operationResult);
		}
Exemple #6
0
		public static bool Restore(DayInterval item)
		{
			return Restore(item.UID, item.Name);
		}
Exemple #7
0
		public static bool MarkDeleted(DayInterval item)
		{
			return MarkDeleted(item.UID, item.Name);
		}