/// <summary> /// Creates the edit updated employee view. /// </summary> /// <param name="onboardInfo">The onboard information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">onboardInfo</exception> public IEmployeeOnBoardView CreateEditUpdatedEmployeeView(IEmployeeOnBoardView onboardInfo) { if (onboardInfo == null) { throw new ArgumentNullException(nameof(onboardInfo)); } return(onboardInfo); }
/// <summary> /// Creates the updated employee view. /// </summary> /// <param name="onboardInfo">The onboard information.</param> /// <param name="maritalStatusCollection">The marital status collection.</param> /// <param name="companyCollection">The company collection.</param> /// <param name="employeeCollection">The employee collection.</param> /// <param name="religionCollection">The religion collection.</param> /// <param name="genderCollection">The gender collection.</param> /// <param name="departmentCollection">The department collection.</param> /// <param name="levelCollection">The level collection.</param> /// <param name="gradeCollection">The grade collection.</param> /// <param name="jobTitleCollection">The job title collection.</param> /// <param name="countryCollection">The country collection.</param> /// <param name="stateCollection">The state collection.</param> /// <param name="processMessage">The process message.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">onboardInfo</exception> public IEmployeeOnBoardView CreateUpdatedEmployeeView(IEmployeeOnBoardView onboardInfo, IList <IMaritalStatus> maritalStatusCollection, IList <IEmployee> employeeCollection, IList <IReligion> religionCollection, IList <IYourGender> genderCollection, IList <IDepartment> departmentCollection, IList <ILevel> levelCollection, IList <IGrade> gradeCollection, IList <IPayScale> payScaleCollection, IList <IJobTitle> jobTitleCollection, IList <ICountry> countryCollection, IList <IState> stateCollection, IList <IEmploymentType> employmentTypeCollection, string processMessage) { if (onboardInfo == null) { throw new ArgumentNullException(nameof(onboardInfo)); } var maritalStatusDDL = GetDropDownList.MaritalStatusListItems(maritalStatusCollection, onboardInfo.MaritalStatusId); var religionDDL = GetDropDownList.ReligionListItems(religionCollection, onboardInfo.ReligionId); var genderDDL = GetDropDownList.GenderListItems(genderCollection, onboardInfo.GenderId); var departmentDDL = GetDropDownList.DepartmentListItems(departmentCollection, onboardInfo.DepartmentId); var gradeDDL = GetDropDownList.GradeListItems(gradeCollection, onboardInfo.GradeID); var jobTitleDDL = GetDropDownList.JobTitlesListItems(jobTitleCollection, onboardInfo.JobTitleID); var levelDDL = GetDropDownList.LevelListItems(levelCollection, onboardInfo.LevelID); var employeeDDL = GetDropDownList.EmployeeListitems(employeeCollection, onboardInfo.SupervisorEmployeeId); var countryDDL = GetDropDownList.CountryListItem(countryCollection, onboardInfo.NationalityId); var permanentStateDDL = GetDropDownList.StateListItem(stateCollection, onboardInfo.PermanentAddressStateId); var homeStateDDL = GetDropDownList.StateListItem(stateCollection, onboardInfo.HomeAddressStateId); var employmentTypeDDL = GetDropDownList.EmploymentTypeListItem(employmentTypeCollection, onboardInfo.EmploymentTypeId); var payScaleDDL = GetDropDownList.PayScaleListItem(payScaleCollection, onboardInfo.LevelGradeId); onboardInfo.ProcessingMessage = processMessage; //Updating drop down list onboardInfo.MaritalStatusDropDownList = maritalStatusDDL; onboardInfo.ReligionDropDownList = religionDDL; onboardInfo.GradeDropDownList = gradeDDL; onboardInfo.DepartmentDropDownList = departmentDDL; onboardInfo.JobTitleDropDownList = jobTitleDDL; onboardInfo.LevelDropDownList = levelDDL; onboardInfo.GenderDropDownList = genderDDL; onboardInfo.CountryDropDownList = countryDDL; onboardInfo.PermanentStateDropDownList = permanentStateDDL; onboardInfo.HomeStateDropDownList = homeStateDDL; onboardInfo.EmployeeDropDownList = employeeDDL; onboardInfo.EmploymentTypeDropDownList = employmentTypeDDL; onboardInfo.PayScaleDropDownList = payScaleDDL; return(onboardInfo); }
/// <summary> /// Updates the on boarding information. /// </summary> /// <param name="onBoardingViewInfo">The on boarding view information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">onBoardingViewInfo</exception> public string UpdateOnBoardingInfo(IEmployeeOnBoardView onBoardingViewInfo) { if (onBoardingViewInfo == null) { throw new ArgumentNullException(nameof(onBoardingViewInfo)); } var result = string.Empty; try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var newOnBoarding = dbContext.Employees.Find(onBoardingViewInfo.EmployeeID); newOnBoarding.StaffNumber = onBoardingViewInfo.StaffNumber; newOnBoarding.LastName = onBoardingViewInfo.LastName; newOnBoarding.FirstName = onBoardingViewInfo.FirstName; newOnBoarding.MiddleName = onBoardingViewInfo.MiddleName; newOnBoarding.Email = onBoardingViewInfo.Email; newOnBoarding.MobileNumber = onBoardingViewInfo.MobileNumber; newOnBoarding.PermanentAddress = onBoardingViewInfo.PermanentAddress; newOnBoarding.PermanentAddressCity = onBoardingViewInfo.PermanentAddressCity; newOnBoarding.PermanentAddressState = onBoardingViewInfo.PermanentAddressStateId; newOnBoarding.HomeAddress = onBoardingViewInfo.HomeAddress; newOnBoarding.HomeAddressCity = onBoardingViewInfo.HomeAddressCity; newOnBoarding.HomeAddressState = onBoardingViewInfo.HomeAddressStateId; newOnBoarding.OtherEmail = onBoardingViewInfo.OtherEmail; newOnBoarding.Birthday = onBoardingViewInfo.Birthday; newOnBoarding.MaritalStatusId = onBoardingViewInfo.MaritalStatusId; newOnBoarding.GenderId = onBoardingViewInfo.GenderId; newOnBoarding.About = onBoardingViewInfo.About; newOnBoarding.SkillSet = onBoardingViewInfo.SkillSet; newOnBoarding.SeatingLocation = onBoardingViewInfo.SeatingLocation; newOnBoarding.MaidenName = onBoardingViewInfo.MaidenName; newOnBoarding.ReligionId = onBoardingViewInfo.ReligionId; newOnBoarding.JobTitleId = onBoardingViewInfo.JobTitleID; newOnBoarding.Nationality = onBoardingViewInfo.NationalityId; newOnBoarding.SupervisorEmployeeId = onBoardingViewInfo.SupervisorEmployeeId; newOnBoarding.DepartmentId = onBoardingViewInfo.DepartmentId; newOnBoarding.CompanyId = onBoardingViewInfo.CompanyID; if (onBoardingViewInfo.PhotoDigitalFileId > 0) { newOnBoarding.PhotoDigitalFileId = onBoardingViewInfo.PhotoDigitalFileId; } newOnBoarding.IsLocked = onBoardingViewInfo.IsLocked; newOnBoarding.EmploymentTypeId = onBoardingViewInfo.EmploymentTypeId; newOnBoarding.GenderOther = onBoardingViewInfo.GenderOther; newOnBoarding.ReligionOther = onBoardingViewInfo.ReligionOther; newOnBoarding.IsApproved = onBoardingViewInfo.IsApproved; dbContext.SaveChanges(); } } catch (Exception e) { result = string.Format("UpdateOnBoardingInfo - {0} , {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } return(result); }
/// <summary> /// Saves the on boarding information. /// </summary> /// <param name="onboardInfo">The onboard information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">onboardInfo</exception> public string SaveOnBoardingInfo(IEmployeeOnBoardView onboardInfo) { if (onboardInfo == null) { throw new ArgumentNullException(nameof(onboardInfo)); } var result = string.Empty; var newRecord = new Employee { CompanyId = onboardInfo.CompanyID, EmployeeId = onboardInfo.EmployeeID, EmploymentTypeId = onboardInfo.EmploymentTypeId, StaffNumber = onboardInfo.StaffNumber, LastName = onboardInfo.LastName, FirstName = onboardInfo.FirstName, MiddleName = onboardInfo.MiddleName, Email = onboardInfo.Email, LevelId = onboardInfo.LevelID, GradeId = onboardInfo.GradeID, JobTitleId = onboardInfo.JobTitleID, MobileNumber = onboardInfo.MobileNumber, PermanentAddress = onboardInfo.PermanentAddress, PermanentAddressCity = onboardInfo.PermanentAddressCity, PermanentAddressState = onboardInfo.PermanentAddressStateId, HomeAddress = onboardInfo.HomeAddress, HomeAddressCity = onboardInfo.HomeAddressCity, HomeAddressState = onboardInfo.HomeAddressStateId, OtherEmail = onboardInfo.OtherEmail, Birthday = onboardInfo.Birthday, MaritalStatusId = onboardInfo.MaritalStatusId, GenderId = onboardInfo.GenderId, DateExited = DateTime.Now, About = onboardInfo.About, SkillSet = onboardInfo.SkillSet, SupervisorEmployeeId = onboardInfo.SupervisorEmployeeId, SeatingLocation = onboardInfo.SeatingLocation, DepartmentId = onboardInfo.DepartmentId, MaidenName = onboardInfo.MaidenName, PhotoDigitalFileId = onboardInfo.PhotoDigitalFileId, ReligionId = onboardInfo.ReligionId, Nationality = onboardInfo.NationalityId, IsActive = true, DateCreated = DateTime.Now, IsLocked = false, IsExit = false, GenderOther = onboardInfo.GenderOther, ReligionOther = onboardInfo.ReligionOther, IsApproved = true }; try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { dbContext.Employees.Add(newRecord); dbContext.SaveChanges(); } } catch (Exception e) { result = string.Format("Save OnBoarding Info - {0} , {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } return(result); }