public TimeTrackPartDetailsViewModel(DayTimeTrack dayTimeTrack, ShortEmployee employee, TimeTrackDetailsViewModel parent, Guid? uid = null, TimeSpan? enterTime = null, TimeSpan? exitTime = null)
		{
			_DayTimeTrack = dayTimeTrack;
			_Employee = employee;
			_Parent = parent;
			if (uid != null)
			{
				UID = uid.Value;
				EnterTime = enterTime.Value;
				ExitTime = exitTime.Value;
				Title = "Редактировать проход";
			}
			else
			{
				UID = Guid.NewGuid();
				_IsNew = true;
				Title = "Добавить проход";
			}

			var schedule = ScheduleHelper.GetSingle(employee.ScheduleUID);
			if (schedule != null)
			{
				Zones = new ObservableCollection<TimeTrackZone>();

				var gkZones = GKManager.SKDZones.Where(x => schedule.Zones.Any(y => y.ZoneUID == x.UID));
				foreach (var zone in gkZones)
				{
					Zones.Add(new TimeTrackZone(zone));
				}

				SelectedZone = Zones.FirstOrDefault();
			}
		}
Пример #2
0
		private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
		{
			DayTrackViewModel dayTrackViewModel = DataContext as DayTrackViewModel;
			if (dayTrackViewModel != null)
			{
				var timeTrackDetailsViewModel = new TimeTrackDetailsViewModel(dayTrackViewModel.DayTimeTrack, dayTrackViewModel.ShortEmployee);
				if (DialogService.ShowModalWindow(timeTrackDetailsViewModel))
				{
					dayTrackViewModel.DayTimeTrack.Calculate();
					dayTrackViewModel.Update();
				}
			}
		}