예제 #1
0
		public DayTrackViewModel(DayTimeTrack dayTimeTrack, TimeTrackFilter timeTrackFilter, ShortEmployee shortEmployee)
		{
			DayTimeTrack = dayTimeTrack;
			TimeTrackFilter = timeTrackFilter;
			ShortEmployee = shortEmployee;
			Update();
		}
예제 #2
0
		public TimeTrackingViewModel()
		{
			ShowFilterCommand = new RelayCommand(OnShowFilter, CanShowFilter);
			RefreshCommand = new RelayCommand(OnRefresh, CanRefresh);
			PrintCommand = new RelayCommand(OnPrint, CanPrint);
			ShowDocumentTypesCommand = new RelayCommand(OnShowDocumentTypes, CanShowDocumentTypes);
			ShowNightSettingsCommand = new RelayCommand(OnShowNightSettingsCommand, CanShowNightSettings);
			ServiceFactory.Events.GetEvent<EditDocumentEvent>().Unsubscribe(OnEditDocument);
			ServiceFactory.Events.GetEvent<EditDocumentEvent>().Subscribe(OnEditDocument);
			ServiceFactory.Events.GetEvent<RemoveDocumentEvent>().Unsubscribe(OnRemoveDocument);
			ServiceFactory.Events.GetEvent<RemoveDocumentEvent>().Subscribe(OnRemoveDocument);
			ServiceFactory.Events.GetEvent<EditTimeTrackPartEvent>().Unsubscribe(OnEditTimeTrackPart);
			ServiceFactory.Events.GetEvent<EditTimeTrackPartEvent>().Subscribe(OnEditTimeTrackPart);
			ServiceFactory.Events.GetEvent<ChiefChangedEvent>().Unsubscribe(OnInitializeLeadUIDs);
			ServiceFactory.Events.GetEvent<ChiefChangedEvent>().Subscribe(OnInitializeLeadUIDs);

			TimeTrackFilter = new TimeTrackFilter();
			TimeTrackFilter.EmployeeFilter = new EmployeeFilter()
			{
				User = ClientManager.CurrentUser, 
			};

			TimeTrackFilter.Period = TimeTrackingPeriod.CurrentMonth;
			TimeTrackFilter.StartDate = DateTime.Today.AddDays(1 - DateTime.Today.Day);
			TimeTrackFilter.EndDate = DateTime.Today;

			TimeTracks = new SortableObservableCollection<TimeTrackViewModel>();
		}
예제 #3
0
		public ReportSettingsViewModel(TimeTrackFilter timeTrackFilter, List<TimeTrackEmployeeResult> timeTrackEmployeeResults, Guid chiefUID, Guid departmentChiefUID, Guid hrChiefUID, Guid organisationUid, Guid departmentUid)
		{
			Title = "Настройка печати отчета Т-13";
			TimeTrackFilter = timeTrackFilter;
			TimeTrackEmployeeResults = timeTrackEmployeeResults;
			DateTime = DateTime.Now;
			FillViewModel = new EmployeeSelectationViewModel(chiefUID, new EmployeeFilter { OrganisationUIDs = new List<Guid> { organisationUid } });
			LeadViewModel = new EmployeeSelectationViewModel(departmentChiefUID, new EmployeeFilter { DepartmentUIDs = new List<Guid> { departmentUid } });
			HRViewModel = new EmployeeSelectationViewModel(hrChiefUID, new EmployeeFilter { OrganisationUIDs = new List<Guid> { organisationUid } });
		}
예제 #4
0
		public TimeTrackViewModel(TimeTrackFilter timeTrackFilter, TimeTrackEmployeeResult timeTrackEmployeeResult)
		{
			DocumentsViewModel = new DocumentsViewModel(timeTrackEmployeeResult, timeTrackFilter.StartDate, timeTrackFilter.EndDate);

			ShortEmployee = timeTrackEmployeeResult.ShortEmployee;
			ScheduleName = timeTrackEmployeeResult.ScheduleName;
			if (timeTrackEmployeeResult.DayTimeTracks == null)
			    timeTrackEmployeeResult.DayTimeTracks = new List<DayTimeTrack>();

			DayTracks = new ObservableCollection<DayTrackViewModel>();
			foreach (var dayTimeTrack in timeTrackEmployeeResult.DayTimeTracks)
			{
				dayTimeTrack.Calculate();
				var dayTrackViewModel = new DayTrackViewModel(dayTimeTrack, timeTrackFilter, timeTrackEmployeeResult.ShortEmployee);
				DayTracks.Add(dayTrackViewModel);
			}

			Totals = new List<TimeTrackTotal>();
			foreach (var timeTrackType in timeTrackFilter.TotalTimeTrackTypeFilters)
			{
				Totals.Add(new TimeTrackTotal(timeTrackType));
			}

			foreach (var dayTimeTrack in timeTrackEmployeeResult.DayTimeTracks)
			{
				foreach (var timeTrackTotal in dayTimeTrack.Totals)
				{
					var total = Totals.FirstOrDefault(x => x.TimeTrackType == timeTrackTotal.TimeTrackType);
					if (total != null)
					{
						total.TimeSpan += timeTrackTotal.TimeSpan;
					}
				}
			}
			OnPropertyChanged(() => Totals);
		}