public void Initialize(Guid? organisationId, Guid? id, Guid? parentDepartmentId) { if (id.HasValue) { var departmentDetailsResult = DepartmentHelper.GetDetails(id.Value); Department = departmentDetailsResult; } else { Department = new Department { Name = "Новое подразделение", ParentDepartmentUID = parentDepartmentId ?? Guid.Empty, OrganisationUID = organisationId.Value }; } var filter = new DepartmentFilter(); filter.UIDs.Add(Department.ParentDepartmentUID); var departmentListResult = DepartmentHelper.Get(filter); SelectedDepartment = departmentListResult.FirstOrDefault(); var employeeFilter = new EmployeeFilter { LogicalDeletationType = LogicalDeletationType.All, UIDs = new List<Guid> { Department.ChiefUID }, IsAllPersonTypes = true }; var chiefResult = EmployeeHelper.Get(employeeFilter); SelectedChief = chiefResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).FirstOrDefault(); if (Department.Photo != null && Department.Photo.Data != null) { photoData = string.Format("data:image/gif;base64,{0}", Convert.ToBase64String(Department.Photo.Data)); Department.Photo.Data = null; } }
public void Initialize(Guid? id) { var isNew = id == null; if (isNew) { Organisation = new OrganisationDetails() { Name = "Организация" }; Organisation.UserUIDs.Add(ClientManager.CurrentUser.UID); } else { Organisation = OrganisationHelper.GetDetails(id.Value); } if (Organisation.Photo != null && Organisation.Photo.Data != null) { photoData = string.Format("data:image/gif;base64,{0}", Convert.ToBase64String(Organisation.Photo.Data)); Organisation.Photo.Data = null; } var filter = new EmployeeFilter { LogicalDeletationType = LogicalDeletationType.All, UIDs = new List<Guid> { Organisation.ChiefUID }, IsAllPersonTypes = true }; var chiefOperationResult = EmployeeHelper.Get(filter); SelectedChief = chiefOperationResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).FirstOrDefault(); filter.UIDs = new List<Guid> {Organisation.HRChiefUID}; var hrChiefOperationResult = EmployeeHelper.Get(filter); SelectedHRChief = hrChiefOperationResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).FirstOrDefault(); }
public HRFilter() : base() { EmployeeFilter = new EmployeeFilter(); var hasEmployeePermission = ClientManager.CurrentUser.HasPermission(PermissionType.Oper_SKD_Employees_View); var hasGuestPermission = ClientManager.CurrentUser.HasPermission(PermissionType.Oper_SKD_Guests_View); EmployeeFilter.PersonType = hasGuestPermission && !hasEmployeePermission ? PersonType.Guest : PersonType.Employee; }
public OperationResult<List<ShortEmployee>> GetEmployeeList(Guid clientUID, EmployeeFilter filter) { OperationResult<List<ShortEmployee>> result; using (var databaseService = new RubezhDAL.DataClasses.DbService()) { result = databaseService.EmployeeTranslator.ShortTranslator.Get(filter); } return result; }
public OperationResult<List<ShortEmployee>> GetEmployeeList(EmployeeFilter filter) { return SafeOperationCall(() => { var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10)); using (rubezhService as IDisposable) return rubezhService.GetEmployeeList(RubezhServiceFactory.UID, filter); }, "GetEmployeeList"); }
public OperationResult<TimeTrackResult> GetTimeTracks(EmployeeFilter filter, DateTime startDate, DateTime endDate) { return SafeOperationCall(() => { var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10)); using (rubezhService as IDisposable) return rubezhService.GetTimeTracks(RubezhServiceFactory.UID, filter, startDate, endDate); }, "GetTimeTracks"); }
public static ShortEmployee GetSingleShort(Guid? uid) { if (uid == null) return null; var filter = new EmployeeFilter { LogicalDeletationType = LogicalDeletationType.All, UIDs = new List<Guid> { uid.Value }, IsAllPersonTypes = true }; var operationResult = ClientManager.RubezhService.GetEmployeeList(filter); var result = Common.ThrowErrorIfExists(operationResult); return result != null ? result.FirstOrDefault() : null; }
void Initialize(EmployeeFilter filter) { Title = "Выбор сотрудника"; _filter = filter; var employeeModels = EmployeeHelper.Get(_filter); if (employeeModels == null) return; Employees = new ObservableCollection<ShortEmployee>(employeeModels); }
public Stream GetTimeTracksStream(EmployeeFilter filter, DateTime startDate, DateTime endDate) { var result = SafeOperationCall(() => { var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10)); using (rubezhService as IDisposable) return rubezhService.GetTimeTracksStream(RubezhServiceFactory.UID, filter, startDate, endDate); }, "GetTimeTracksStream"); return result; }
public HRFilter() { EmployeeFilter = new EmployeeFilter(); DepartmentFilter = new DepartmentFilter(); PositionFilter = new PositionFilter(); AdditionalColumnTypeFilter = new AdditionalColumnTypeFilter(); AccessTemplateFilter = new AccessTemplateFilter(); PassCardTemplateFilter = new PassCardTemplateFilter(); CardFilter = new CardFilter(); }
public TimeTrackFilter() : base() { EmployeeFilter = new EmployeeFilter(); var hasEmployeePermission = ClientManager.CurrentUser.HasPermission(PermissionType.Oper_SKD_Employees_View); var hasGuestPermission = ClientManager.CurrentUser.HasPermission(PermissionType.Oper_SKD_Guests_View); EmployeeFilter.PersonType = hasGuestPermission && !hasEmployeePermission ? PersonType.Guest : PersonType.Employee; Period = TimeTrackingPeriod.CurrentMonth; TotalTimeTrackTypeFilters = new List<TimeTrackType>(); }
public EmployeeSelectionDialogViewModel(ShortEmployee selectedEmployee, EmployeeFilter filter) { Initialize(filter); if (selectedEmployee != null) { SelectedEmployee = Employees.FirstOrDefault(x => x.UID == selectedEmployee.UID); if (SelectedEmployee == null) { Employees.Insert(0, selectedEmployee); SelectedEmployee = selectedEmployee; } } }
public JsonNetResult GetOrganisations(EmployeeFilter employeeFilter) { var employeesViewModel = new EmployeesViewModel(); employeesViewModel.Initialize(employeeFilter); dynamic result = new { page = 1, total = 100, records = 100, rows = employeesViewModel.Organisations, }; return new JsonNetResult { Data = result }; }
public EscortSelectionViewModel(EmployeeItem department, ShortEmployee shortEmployee, Guid organisationUID) { Title = "Сопровождающий"; var filter = new EmployeeFilter(); if(EmployeeItem.IsNotNullOrEmpty(department)) filter.DepartmentUIDs.Add(department.UID); filter.OrganisationUIDs.Add(organisationUID); Employees = new List<ShortEmployee>(); var employees = EmployeeHelper.Get(filter); if (employees != null) { foreach (var employee in employees) { Employees.Add(employee); } } if (shortEmployee != null) { SelectedEmployee = Employees.FirstOrDefault(x => x.UID == shortEmployee.UID); } }
public Stream GetTimeTracksStream(EmployeeFilter filter, DateTime startDate, DateTime endDate) { var timeTracksResult = GetTimeTracks(filter, startDate, endDate).Result; var serializer = new DataContractSerializer(typeof(TimeTrackResult)); var folderName = AppDataFolderHelper.GetFolder("TempServer"); if (!Directory.Exists(folderName)) Directory.CreateDirectory(folderName); var fileName = Path.Combine(folderName, "TimeTrackResult.xml"); using (var fileStream = File.Open(fileName, FileMode.Create)) { serializer.WriteObject(fileStream, timeTracksResult); } return new FileStream(fileName, FileMode.Open, FileAccess.Read); }
void InitializeEmployeeFilter() { EmployeeFilter = Filter.EmployeeFilter; EmployeeFilter.UIDs = Filter.EmplooyeeUIDs; EmployeeFilter.PersonType = SelectedPersonType; EmployeeFilter.LogicalDeletationType = Filter.LogicalDeletationType; }
public Stream GetTimeTracksStream(Guid clientUID, EmployeeFilter filter, DateTime startDate, DateTime endDate) { var result = SafeOperationCall(clientUID, () => RubezhService.GetTimeTracksStream(clientUID, filter, startDate, endDate), "GetTimeTracksStream"); return result; }
public OperationResult<List<ShortEmployee>> GetEmployeeList(Guid clientUID, EmployeeFilter filter) { return SafeOperationCall(clientUID, () => RubezhService.GetEmployeeList(clientUID, filter), "GetEmployeeList"); }
public JsonResult GetEmployeesFilter(bool isWithDeleted, PersonType selectedPersonType) { var employeeFilter = new EmployeeFilter { LogicalDeletationType = isWithDeleted ? LogicalDeletationType.All : LogicalDeletationType.Active, PersonType = selectedPersonType }; var employeesViewModel = new EmployeesViewModel(); employeesViewModel.Initialize(employeeFilter); dynamic result = new { page = 1, total = 100, records = 100, rows = employeesViewModel.Organisations, }; return Json(result, JsonRequestBehavior.AllowGet); }
private JsonNetResult GetEmployees(EmployeeFilter filter) { var operationResult = EmployeeHelper.Get(filter); var employees = operationResult.Select(e => ShortEmployeeModel.CreateFromModel(e)); return new JsonNetResult { Data = new { Employees = employees } }; }
public void InitializeFilter() { var filter = new EmployeeFilter() { PersonType = IsEmployee ? PersonType.Employee : PersonType.Guest, LogicalDeletationType = LogicalDeletationType.Active, OrganisationUIDs = OrganisationUIDs }; if (_employeeFilter.IsSearch) { filter.LastName = _employeeFilter.LastName; filter.FirstName = _employeeFilter.FirstName; filter.SecondName = _employeeFilter.SecondName; } else filter.UIDs = Filter.UIDs; Filter.Initialize(filter); }
public JsonResult GetDepartmentEmployeeList(Guid departmentId, Guid organisationId, bool isWithDeleted, Guid chiefId) { var filter = new EmployeeFilter { DepartmentUIDs = new List<Guid> { departmentId }, OrganisationUIDs = new List<Guid> { organisationId }, LogicalDeletationType = isWithDeleted ? LogicalDeletationType.All : LogicalDeletationType.Active }; var operationResult = EmployeeHelper.Get(filter); var employees = operationResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).ToList(); var chief = employees.FirstOrDefault(e => e.UID == chiefId); if (chief != null) { chief.IsChief = true; } dynamic result = new { page = 1, total = 100, records = 100, rows = employees, }; return Json(result, JsonRequestBehavior.AllowGet); }
public static IEnumerable<ShortEmployee> Get(EmployeeFilter filter) { var operationResult = ClientManager.RubezhService.GetEmployeeList(filter); return Common.ThrowErrorIfExists(operationResult); }
public static TimeTrackResult GetTimeTracks(EmployeeFilter filter, DateTime startDate, DateTime endDate) { var operationResult = ClientManager.RubezhService.GetTimeTracks(filter, startDate, endDate); return Common.ThrowErrorIfExists(operationResult); }
public EmployeeSelectionDialogViewModel(EmployeeFilter filter) { Initialize(filter); }
public OperationResult<TimeTrackResult> GetTimeTracks(EmployeeFilter filter, DateTime startDate, DateTime endDate) { return DbServiceHelper.InTryCatch(() => { var operationResult = DbService.EmployeeTranslator.ShortTranslator.Get(filter); if (operationResult.HasError) throw new Exception(operationResult.Error); var employees = DbService.EmployeeTranslator.GetFilteredTableItems(filter, GetEmployeeTableItems()); var employeeUIDs = employees.Select(x => x.UID).ToList(); var passJournals = Context.PassJournals.Where(x => x.EmployeeUID != null && employeeUIDs.Contains(x.EmployeeUID.Value)).ToList(); var timeTrackResult = new TimeTrackResult(); foreach (var employee in employees) { var timeTrackEmployeeResult = GetEmployeeTimeTrack(employee, startDate, endDate, passJournals); timeTrackEmployeeResult.ShortEmployee = DbService.EmployeeTranslator.ShortTranslator.Translate(employee); if (timeTrackEmployeeResult.Error != null) { for (DateTime date = startDate; date <= endDate; date = date.AddDays(1)) { var dayTimeTrack = new DayTimeTrack(); dayTimeTrack.Error = timeTrackEmployeeResult.Error; dayTimeTrack.Date = date; timeTrackEmployeeResult.DayTimeTracks.Add(dayTimeTrack); } } var documentsOperationResult = DbService.TimeTrackDocumentTranslator.Get(employee.UID, startDate, endDate, employee.TimeTrackDocuments); if (!documentsOperationResult.HasError) { var documents = documentsOperationResult.Result; foreach (var document in documents) { document.TimeTrackDocumentType = TimeTrackDocumentTypesCollection.TimeTrackDocumentTypes.FirstOrDefault(x => x.Code == document.DocumentCode); if (document.TimeTrackDocumentType == null) { var documentType = employee.Organisation.TimeTrackDocumnetTypes.FirstOrDefault(x => x.DocumentCode == document.DocumentCode); if (documentType != null) { document.TimeTrackDocumentType = DbService.TimeTrackDocumentTypeTranslator.Translate(documentType); } } if (document.TimeTrackDocumentType != null) { timeTrackEmployeeResult.Documents.Add(document); } } foreach (var document in timeTrackEmployeeResult.Documents) { for (DateTime date = document.StartDateTime; date < new DateTime(document.EndDateTime.Year, document.EndDateTime.Month, document.EndDateTime.Day).AddDays(1); date = date.AddDays(1)) { var dayTimeTracks = timeTrackEmployeeResult.DayTimeTracks.FirstOrDefault(x => x.Date.Date == date.Date); if (dayTimeTracks != null) { dayTimeTracks.Documents.Add(document); } } } } timeTrackResult.TimeTrackEmployeeResults.Add(timeTrackEmployeeResult); } return timeTrackResult; }); }
public EmployeeSelectationViewModel(Guid chiefUID, EmployeeFilter filter) { SelectCommand = new RelayCommand(OnSelect); SelectedEmployee = EmployeeHelper.GetSingleShort(chiefUID); _filter = filter; }
public JsonNetResult GetOrganisationDepartmentEmployees(Guid organisationId, Guid? departmentId) { var filter = new EmployeeFilter(); if (departmentId.HasValue && departmentId.Value != Guid.Empty) { filter.DepartmentUIDs.Add(departmentId.Value); } filter.OrganisationUIDs.Add(organisationId); return GetEmployees(filter); }
public JsonNetResult GetDepartmentEmployees(Guid id) { var filter = new EmployeeFilter {DepartmentUIDs = new List<Guid> {id}}; return GetEmployees(filter); }
public JsonNetResult GetEmptyPositionEmployees(Guid id) { var filter = new EmployeeFilter { OrganisationUIDs = new List<Guid> {id}, IsEmptyPosition = true }; return GetEmployees(filter); }