private void EmplIntegration(string _firstname, string _secondname, string _middlename, string _workphone, string _mobilephone, string _userId, Guid _departmentId, Guid _titleId, Guid _company, string _managerUserId) { IEmplService _EmplService = DependencyResolver.Current.GetService <IEmplService>(); IWorkScheduleService _WorkScheduleService = DependencyResolver.Current.GetService <IWorkScheduleService>(); Guid?manageId = null; if (_managerUserId != String.Empty) { if (_EmplService.Contains(x => x.CompanyTableId == _company && x.ApplicationUserId == _managerUserId)) { manageId = _EmplService.FirstOrDefault(x => x.CompanyTableId == _company && x.ApplicationUserId == _managerUserId).Id; } } if (!_EmplService.Contains(x => x.CompanyTableId == _company && x.FirstName == _firstname && x.MiddleName == _middlename && x.SecondName == _secondname)) { _EmplService.SaveDomain(new EmplTable() { isIntegratedLDAP = true, FirstName = _firstname, SecondName = _secondname, MiddleName = _middlename, ApplicationUserId = _userId, DepartmentTableId = _departmentId, TitleTableId = _titleId, CompanyTableId = _company, WorkScheduleTableId = _WorkScheduleService.FirstOrDefault(x => x.Id != null).Id, ManageId = manageId }, "Admin"); } else { EmplTable empl = _EmplService.FirstOrDefault(x => x.CompanyTableId == _company && x.FirstName == _firstname && x.MiddleName == _middlename && x.SecondName == _secondname); empl.FirstName = _firstname; empl.SecondName = _secondname; empl.MiddleName = _middlename; empl.DepartmentTableId = _departmentId; empl.TitleTableId = _titleId; empl.isIntegratedLDAP = true; empl.ManageId = manageId; _EmplService.SaveDomain(empl, "Admin"); } }
private void EmplUpdateIntegration(string _firstname, string _secondname, string _middlename, Guid _company, string _managerUserId) { IEmplService _EmplService = DependencyResolver.Current.GetService <IEmplService>(); Guid? manageId = null; if (_managerUserId != String.Empty) { if (_EmplService.Contains(x => x.CompanyTableId == _company && x.ApplicationUserId == _managerUserId)) { manageId = _EmplService.FirstOrDefault(x => x.CompanyTableId == _company && x.ApplicationUserId == _managerUserId).Id; if (_EmplService.Contains(x => x.CompanyTableId == _company && x.FirstName == _firstname && x.MiddleName == _middlename && x.SecondName == _secondname)) { EmplTable empl = _EmplService.FirstOrDefault(x => x.CompanyTableId == _company && x.FirstName == _firstname && x.MiddleName == _middlename && x.SecondName == _secondname); empl.ManageId = manageId; _EmplService.SaveDomain(empl, "Admin"); } } } }