public ScheduleZoneDetailsViewModel(Schedule schedule, Organisation organisation)
		{
			Title = "Добавить новые зоны";
			ScheduleZone = new List<ScheduleZone>();

			Zones = new SortableObservableCollection<SelectationScheduleZoneViewModel>();
			var organisationResult = OrganisationHelper.GetSingle(organisation.UID);
			_doorUIDs = organisationResult != null ? organisationResult.DoorUIDs : new List<Guid>();

			var gkDoors = GKManager.Doors.Where(x => _doorUIDs.Any(y => y == x.UID));
			foreach (var door in gkDoors)
			{
				if (door.EnterZoneUID != Guid.Empty)
				{
					var enterZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.EnterZoneUID);
					if (enterZone != null && !Zones.Any(x => x.ZoneUID == enterZone.UID))
						Zones.Add(new SelectationScheduleZoneViewModel(enterZone, schedule, door.UID));
				}

				if (door.ExitZoneUID != Guid.Empty)
				{
					var exitZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.ExitZoneUID);
					if (exitZone != null && !Zones.Any(x => x.ZoneUID == exitZone.UID))
						Zones.Add(new SelectationScheduleZoneViewModel(exitZone, schedule, door.UID));
				}
			}

			Zones = new ObservableCollection<SelectationScheduleZoneViewModel>(Zones.OrderBy(x => x.No)); //TODO: 
			SelectedZone = Zones.FirstOrDefault();
		}
		public RubezhAPI.OperationResult<bool> SaveSchedule(Schedule item, bool isNew)
		{
			return SafeOperationCall(() =>
			{
				var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10));
				using (rubezhService as IDisposable)
					return rubezhService.SaveSchedule(RubezhServiceFactory.UID, item, isNew);
			}, "SaveSchedule");
		}
		public OperationResult<bool> SaveSchedule(Guid clientUID, Schedule item, bool isNew)
		{
			return SafeOperationCall(clientUID, () => RubezhService.SaveSchedule(clientUID, item, isNew), "SaveSchedule");
		}
示例#4
0
		public static bool Restore(Schedule item)
		{
			return Restore(item.UID, item.Name);
		}
示例#5
0
		public static bool MarkDeleted(Schedule item)
		{
			return MarkDeleted(item.UID, item.Name);
		}
示例#6
0
		public static bool Save(Schedule scheme, bool isNew)
		{
			var operationResult = ClientManager.RubezhService.SaveSchedule(scheme, isNew);
			return Common.ThrowErrorIfExists(operationResult);
		}
		public OperationResult<bool> SaveSchedule(Guid clientUID, Schedule item, bool isNew)
		{
			if (isNew)
				AddJournalMessage(JournalEventNameType.Редактирование_графика_работы, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_график_работы, JournalObjectType.Schedule);
			else
				AddJournalMessage(JournalEventNameType.Редактирование_графика_работы, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_график_работы, JournalObjectType.Schedule);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.ScheduleTranslator.Save(item);
			}
		}
		public SelectationScheduleZoneViewModel(GKSKDZone zone, Schedule schedule, Guid doorUID)
		{
			DoorUID = doorUID;
			ZoneUID = zone.UID;
			Name = zone.Name;
			No = zone.No;
			ScheduleUID = schedule.UID;
			Description = zone.Description;
			IsChecked = schedule.Zones.Any(x => x.ZoneUID == zone.UID);
		}