public ActionResult GetOrganizationsJobs(string JobNo, string OrganizationName, string JobName, string RankName, string JobCode, string JobCategoryName) { OrganizationsJobsBLL OrganizationsJobs = new OrganizationsJobsBLL() { Search = Search, Order = Order, OrderDir = OrderDir, StartRec = StartRec, PageSize = PageSize }; var data = OrganizationsJobs.GetOrganizationsJobs(JobNo, OrganizationName, JobName, RankName, JobCode, JobCategoryName, out TotalRecordsOut, out RecFilterOut) .Select(c => new { JobName = c.Job.JobName, OrganizationName = c.OrganizationStructure.OrganizationName, RankName = c.Rank.RankName, JobNo = c.JobNo, OrganizationJobID = c.OrganizationJobID, JobCode = c.Job.JobCode, JobCategoryName = c.Job.JobCategory.JobCategoryName, IsVacant = c.IsVacant, IsActive = c.IsActive }); return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = data }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(OrganizationsJobsViewModel OrganizationsJobsVM) { OrganizationsJobsBLL organizationJob = new OrganizationsJobsBLL(); organizationJob.Rank = new RanksBLL() { RankID = (int)OrganizationsJobsVM.RankID }; organizationJob.OrganizationStructure = new OrganizationsStructuresBLL() { OrganizationID = OrganizationsJobsVM.OrganizationID }; organizationJob.Job = new JobsBLL() { JobID = OrganizationsJobsVM.JobID }; organizationJob.JobNo = OrganizationsJobsVM.JobNo; organizationJob.LoginIdentity = UserIdentity; organizationJob.OrganizationJobStatus = new OrganizationsJobsStatusBLL() { OrganizationJobStatusID = OrganizationsJobsVM.OrganizationJobStatusID }; Result result = organizationJob.Creation(); if ((System.Type)result.EnumType == typeof(OrganizationJobValidationEnum)) { if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseOfExistsActiveJobWithJobNoAndRankID.ToString()) { throw new CustomException(Resources.Globalization.ValidationJobOrganizationAlreadyExistsText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseThereIsNoActiveOrganizationJob.ToString()) { throw new CustomException(Resources.Globalization.ValidationThereIsNoActiveJobOrganizationText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseThereIsNoEmployeeCareerHistoryRelatedToThisOrganizationJob.ToString()) { throw new CustomException(Resources.Globalization.ValidationNoEmployeeCareerHistoryRelatedToThisOrganizationJobText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseThisOrganizationJobIsNotVacant.ToString()) { throw new CustomException(Resources.Globalization.ValidationIsNotVacantText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseInPushingUpNextRankShouldBiggerThanCurrent.ToString()) { throw new CustomException(Resources.Globalization.ValidationPushingUpNextRankShouldBiggerThanCurrentText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseInPushingUpNextRankShouldLessThanCurrent.ToString()) { throw new CustomException(Resources.Globalization.ValidationPushingUpNextRankShouldLessThanCurrentText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseOperationDateLessThanOtherExists.ToString()) { throw new CustomException(Resources.Globalization.ValidationRejectedBecauseOperationDateLessThanOtherExistsText); } } return(View(OrganizationsJobsVM)); }
//public List<EmployeesCareersHistoryBLL> GetDeservedEmployeesInPromotion(int RankID, DateTime PromotionEndDate, int DaysCount) //{ // List<EmployeesCareersHistoryBLL> DeservedEmployeesBLLList = new List<EmployeesCareersHistoryBLL>(); // List<EmployeesCareersHistory> DeservedEmployeesList = new EmployeesCareersHistoryDAL().GetActiveEmployeesByRankID(RankID).Where(x => PromotionEndDate >= x.JoinDate.AddDays(DaysCount)).ToList(); // foreach (var item in DeservedEmployeesList) // { // DeservedEmployeesBLLList.Add(new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(item)); // } // return DeservedEmployeesBLLList; //} // public EmployeesCareersHistoryBLL GetDeservedEmployeeInPromotionByEmployeeCodeID(int EmployeeCodeID, DateTime PromotionEndDate, int DaysCount) // { //reutthis.GetEmployeeCurrentJob(EmployeeCodeID) // } public EmployeesCareersHistoryBLL Get(OrganizationsJobsBLL OrganizationJob, CareersHistoryTypesEnum CareerHistoryType, EmployeesCodesBLL EmployeeCode) { EmployeesCareersHistory EmployeeCareerHistory = new EmployeesCareersHistoryDAL().GetByOrganizationJobIDEmployeeCodeIDCareerHistoryTypeID(OrganizationJob.OrganizationJobID, (int)CareerHistoryType, EmployeeCode.EmployeeCodeID); EmployeesCareersHistoryBLL EmployeeCareerHistoryBLL = null; if (EmployeeCareerHistory != null) { EmployeeCareerHistoryBLL = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(EmployeeCareerHistory); } return(EmployeeCareerHistoryBLL); }
public HttpResponseMessage SaveModulation(JobOperationModulationViewModel jobOperationModulationVM) { Result result = null; OrganizationsJobsBLL modulationMrganizationJob = new OrganizationsJobsBLL().GetByOrganizationJobID(jobOperationModulationVM.OrganizationJobID); modulationMrganizationJob.OrganizationStructure = new OrganizationsStructuresBLL() { OrganizationID = jobOperationModulationVM.OrganizationID }; modulationMrganizationJob.Job = new JobsBLL() { JobID = jobOperationModulationVM.JobID }; modulationMrganizationJob.JobOperationDate = jobOperationModulationVM.JobOperationDate; modulationMrganizationJob.LoginIdentity = UserIdentity; result = modulationMrganizationJob.Modulation(); if ((System.Type)result.EnumType == typeof(OrganizationJobValidationEnum)) { if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseOfExistsActiveJobWithJobNoAndRankID.ToString()) { throw new CustomException(Resources.Globalization.ValidationJobOrganizationAlreadyExistsText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseThereIsNoActiveOrganizationJob.ToString()) { throw new CustomException(Resources.Globalization.ValidationThereIsNoActiveJobOrganizationText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseThereIsNoEmployeeCareerHistoryRelatedToThisOrganizationJob.ToString()) { throw new CustomException(Resources.Globalization.ValidationNoEmployeeCareerHistoryRelatedToThisOrganizationJobText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseThisOrganizationJobIsNotVacant.ToString()) { throw new CustomException(Resources.Globalization.ValidationIsNotVacantText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseInPushingUpNextRankShouldBiggerThanCurrent.ToString()) { throw new CustomException(Resources.Globalization.ValidationPushingUpNextRankShouldBiggerThanCurrentText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseInPushingUpNextRankShouldLessThanCurrent.ToString()) { throw new CustomException(Resources.Globalization.ValidationPushingUpNextRankShouldLessThanCurrentText); } else if (result.EnumMember == OrganizationJobValidationEnum.RejectedBecauseOperationDateLessThanOtherExists.ToString()) { throw new CustomException(Resources.Globalization.ValidationRejectedBecauseOperationDateLessThanOtherExistsText); } } return(new HttpResponseMessage(HttpStatusCode.OK)); }
public JsonResult GetAllOrganizationsJobs() { OrganizationsJobsBLL OrganizationsJobs = new OrganizationsJobsBLL(); var data = OrganizationsJobs.GetAllOrganizationsJobs().Select(c => new { JobName = c.Job.JobName, OrganizationName = c.OrganizationStructure.OrganizationName, RankName = c.Rank.RankName, JobNo = c.JobNo, JobCode = c.Job.JobCode, JobCategoryName = c.Job.JobCategory.JobCategoryName, IsVacant = c.IsVacant }); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetOrganizationJobHistory(int OrganizationJobID) { List <OrganizationsJobsBLL> OrganizationsJobsBLLList = new OrganizationsJobsBLL().GetOrganizationJobHistoryOperationByOrganizationJobID(OrganizationJobID); var data = OrganizationsJobsBLLList.Select(x => new { JobNo = x.JobNo, OrganizationName = x.OrganizationStructure.OrganizationName, JobName = x.Job.JobName, RankName = x.Rank.RankName, JobOperationTypeName = x.JobOperationType.JobOperationTypeName, JobOperationDate = x.JobOperationDate, IsActive = x.IsActive, }); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetOrganizationsJobs(string JobNo, string OrganizationName, string JobName, string RankName) { var data = new OrganizationsJobsBLL() { Search = Search, Order = Order, OrderDir = OrderDir, StartRec = StartRec, PageSize = PageSize }.GetActiveOrganizationsJobs(JobNo, OrganizationName, JobName, RankName, "", "", out TotalRecordsOut, out RecFilterOut).Select(x => new { OrganizationJobID = x.OrganizationJobID, OrganizationName = x.OrganizationStructure.OrganizationName, JobName = x.Job.JobName, RankName = x.Rank.RankName, JobNo = x.JobNo, x.IsVacant }); return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = data }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// This function called by Windows services and schedule to run on daily basis /// This function to get all EOS records from EOStable with isprocessed null/0 and EOSDate is <= Current Date /// Following action is performed: /// 1 - Create Employee Career History record for EOS type /// 2 - Deactivate all Employee Career History records of each EOS record /// 3 - Deactivate employee /// 4 - Set Job as Vacant /// 5 - Mark isProcessed = 1 after successful of above 4 steps /// </summary> /// <returns></returns> public virtual Result StartProcess() { try { Result result = new Result(); List <EndOfServicesBLL> EndOfServicesNotProcessed = this.GetEndOfServicesNotProcessed(); foreach (EndOfServicesBLL item in EndOfServicesNotProcessed) { if (DateTime.Now.Date >= item.EndOfServiceDate.Date) { #region Adding new record with new career history type End of service EmployeesCareersHistoryBLL EmployeeCareerHistory = new EmployeesCareersHistoryBLL().Get(item.EmployeeCareerHistory.OrganizationJob, CareersHistoryTypesEnum.EndOfService, item.EmployeeCareerHistory.EmployeeCode); if (EmployeeCareerHistory == null) { result = new EmployeesCareersHistoryBLL() { EmployeeCode = item.EmployeeCareerHistory.EmployeeCode, OrganizationJob = item.EmployeeCareerHistory.OrganizationJob, CareerHistoryType = new CareersHistoryTypesBLL() { CareerHistoryTypeID = (int)CareersHistoryTypesEnum.EndOfService }, CareerDegree = item.EmployeeCareerHistory.CareerDegree, JoinDate = item.EndOfServiceDate, TransactionStartDate = item.EndOfServiceDate, IsActive = false, LoginIdentity = item.CreatedBy, }.Add(); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } else { #region Deactivate all career history of employee new EmployeesCareersHistoryBLL() { LoginIdentity = item.CreatedBy }.DeactivateAllCareerHistoryOfEmployee(item.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID); #endregion } } #endregion #region Deactivate employee result = new EmployeesCodesBLL() { LoginIdentity = item.CreatedBy }.DeactivateEmployee(item.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } #endregion #region Set his job as job vacant result = new OrganizationsJobsBLL() { LoginIdentity = item.CreatedBy }.SetJobAsVacant(item.EmployeeCareerHistory.OrganizationJob.OrganizationJobID); #endregion #region Update is process to true result = new EndOfServicesBLL() { LoginIdentity = item.CreatedBy }.MarkIsProcessToDone(item.EndOfServiceID); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } #endregion } } return(result); } catch (Exception ex) { throw ex; } }
/// <summary> /// it will be called by windows service to disactive employee based on transfer date /// </summary> /// <returns></returns> public virtual Result StartProcess() { try { Result result = new Result(); List <BaseTransfersBLL> TransfersNotProcessed = this.GetTransfersNotProcessed(); foreach (var item in TransfersNotProcessed) { CareersHistoryTypesEnum CareerHistoryTypeEnum = item.TransferType.TransferTypeID == Convert.ToInt16(TransfersTypesEnum.TransferEmployeeWithJob) ? CareersHistoryTypesEnum.TransfareWithJob : CareersHistoryTypesEnum.TransfareWithoutJob; if (DateTime.Now.Date >= item.TransferDate.Date) { #region Adding new record with new career history type (Transfare With Job) in career history of employees // check if the job was is exists or not EmployeesCareersHistoryBLL EmployeeCareerHistory = new EmployeesCareersHistoryBLL().Get(item.EmployeeCareerHistory.OrganizationJob, CareerHistoryTypeEnum, item.EmployeeCareerHistory.EmployeeCode); if (EmployeeCareerHistory == null) { result = new EmployeesCareersHistoryBLL() { EmployeeCode = item.EmployeeCareerHistory.EmployeeCode, OrganizationJob = item.EmployeeCareerHistory.OrganizationJob, CareerHistoryType = new CareersHistoryTypesBLL() { CareerHistoryTypeID = (int)CareerHistoryTypeEnum }, CareerDegree = item.EmployeeCareerHistory.CareerDegree, JoinDate = item.TransferDate, TransactionStartDate = item.TransferDate, IsActive = false, LoginIdentity = item.CreatedBy, }.Add(); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } else { #region Disactive all career hsitory of employee new EmployeesCareersHistoryBLL() { LoginIdentity = item.CreatedBy }.DeactivateAllCareerHistoryOfEmployee(item.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID); #endregion } } #endregion #region Disactive employee result = new EmployeesCodesBLL() { LoginIdentity = item.CreatedBy }.DeactivateEmployee(item.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } #endregion #region Disactive his job in case of transfer type is "Transfare with his job" if (item.TransferType.TransferTypeID == (int)TransfersTypesEnum.TransferEmployeeWithJob) { result = new OrganizationsJobsBLL() { LoginIdentity = item.CreatedBy }.Transferring(item.EmployeeCareerHistory.OrganizationJob.OrganizationJobID); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } } #endregion #region Set his job as job vacant in case of transfer type is "Transfare without his job" if (item.TransferType.TransferTypeID == (int)TransfersTypesEnum.TransferEmployeeWithoutJob) { result = new OrganizationsJobsBLL() { LoginIdentity = item.CreatedBy }.SetJobAsVacant(item.EmployeeCareerHistory.OrganizationJob.OrganizationJobID); } #endregion #region Update is procees to true result = new BaseTransfersBLL() { LoginIdentity = item.CreatedBy }.MarkIsProcessToDone(item.TransferID); if (result.EnumMember != CareersHistoryValidationEnum.Done.ToString()) { return(result); } #endregion } } return(result); } catch (Exception ex) { throw ex; } }
public virtual int AddHiringNewEmployee(EmployeesBLL EmployeesBLL, EmployeesCodesBLL EmployeesCodesBLL, EmployeesCareersHistoryBLL EmployeesCareersHistoryBLL, EmployeesQualificationsBLL EmployeesQualificationsBLL, ContractorsBasicSalariesBLL ContractorsBasicSalariesBLL, List <EmployeesAllowancesBLL> EmployeesAllowancesBLLLst) { try { EmployeesDAL employeeDal = new EmployeesDAL(); Employees employee = new Employees() { EmployeeIDNo = this.EmployeeIDNo, FirstNameAr = this.FirstNameAr, MiddleNameAr = this.MiddleNameAr, GrandFatherNameAr = this.GrandFatherNameAr, FifthNameAr = this.FifthNameAr, LastNameAr = this.LastNameAr, FirstNameEn = this.FirstNameEn, MiddleNameEn = this.MiddleNameEn, GrandFatherNameEn = this.GrandFatherNameEn, FifthNameEn = this.FifthNameEn, LastNameEn = this.LastNameEn, EmployeeBirthDate = (DateTime)this.EmployeeBirthDate.Value.Date, EmployeeBirthPlace = this.EmployeeBirthPlace, EmployeeMobileNo = this.EmployeeMobileNo, EmployeePassportNo = this.EmployeePassportNo, EmployeeEMail = this.EmployeeEMail, EmployeeIDIssueDate = this.EmployeeIDIssueDate != null ? (DateTime)this.EmployeeIDIssueDate.Value.Date : (DateTime?)null, EmployeePassportSource = this.EmployeePassportSource, EmployeePassportIssueDate = this.EmployeePassportIssueDate != null ? (DateTime)this.EmployeePassportIssueDate.Value.Date : (DateTime?)null, EmployeePassportEndDate = this.EmployeePassportEndDate != null ? (DateTime)this.EmployeePassportEndDate.Value.Date : (DateTime?)null, EmployeeIDExpiryDate = this.EmployeeIDExpiryDate, EmployeeIDCopyNo = this.EmployeeIDCopyNo, EmployeeIDIssuePlace = this.EmployeeIDIssuePlace, DependentCount = this.DependentCount, MaritalStatusID = this.MaritalStatus.MaritalStatusID, GenderID = this.Gender.GenderID, NationalityID = this.Nationality.CountryID, CreatedDate = DateTime.Now, CreatedBy = this.LoginIdentity.EmployeeCodeID, }; EmployeesCodes employeesCode = new EmployeesCodes() { EmployeeCodeNo = EmployeesCodesBLL.EmployeeCodeNo, EmployeeTypeID = EmployeesCodesBLL.EmployeeType.EmployeeTypeID, IsActive = true, CreatedDate = DateTime.Now, CreatedBy = this.LoginIdentity.EmployeeCodeID }; EmployeesCareersHistory employeeCareerHistory = new EmployeesCareersHistory() { CareerHistoryTypeID = EmployeesCareersHistoryBLL.CareerHistoryType.CareerHistoryTypeID, CareerDegreeID = EmployeesCareersHistoryBLL.CareerDegree.CareerDegreeID, OrganizationJobID = EmployeesCareersHistoryBLL.OrganizationJob.OrganizationJobID, JoinDate = EmployeesCareersHistoryBLL.JoinDate.Date, TransactionStartDate = EmployeesCareersHistoryBLL.JoinDate.Date, IsActive = true, CreatedBy = this.LoginIdentity.EmployeeCodeID, CreatedDate = DateTime.Now }; EmployeesQualifications employeeQualification = new EmployeesQualifications(); employeeQualification.QualificationDegreeID = EmployeesQualificationsBLL.QualificationDegree.QualificationDegreeID; employeeQualification.QualificationID = EmployeesQualificationsBLL.Qualification.QualificationID; employeeQualification.GeneralSpecializationID = EmployeesQualificationsBLL.GeneralSpecialization.GeneralSpecializationID; employeeQualification.ExactSpecializationID = EmployeesQualificationsBLL.ExactSpecialization.ExactSpecializationID == 0 ? (int?)null : EmployeesQualificationsBLL.ExactSpecialization.ExactSpecializationID; employeeQualification.UniSchName = EmployeesQualificationsBLL.UniSchName; employeeQualification.Department = EmployeesQualificationsBLL.Department; employeeQualification.FullGPA = EmployeesQualificationsBLL.FullGPA; employeeQualification.GPA = EmployeesQualificationsBLL.GPA; employeeQualification.StudyPlace = EmployeesQualificationsBLL.StudyPlace; employeeQualification.GraduationDate = EmployeesQualificationsBLL.GraduationDate; employeeQualification.GraduationYear = EmployeesQualificationsBLL.GraduationYear; employeeQualification.Percentage = EmployeesQualificationsBLL.Percentage; employeeQualification.QualificationTypeID = EmployeesQualificationsBLL.QualificationType.QualificationTypeID == 0 ? (int?)null : EmployeesQualificationsBLL.QualificationType.QualificationTypeID; employeeQualification.CreatedDate = DateTime.Now; employeeQualification.CreatedBy = this.LoginIdentity.EmployeeCodeID; ContractorsBasicSalaries contractorBasicSalary = new ContractorsBasicSalaries(); contractorBasicSalary.BasicSalary = ContractorsBasicSalariesBLL.BasicSalary; contractorBasicSalary.TransfareAllowance = ContractorsBasicSalariesBLL.TransfareAllowance; contractorBasicSalary.CreatedDate = DateTime.Now; contractorBasicSalary.CreatedBy = this.LoginIdentity.EmployeeCodeID; List <EmployeesAllowances> employeesAllowancesList = new List <EmployeesAllowances>(); foreach (var EmployeeAllowanceBLL in EmployeesAllowancesBLLLst) { employeesAllowancesList.Add(new EmployeesAllowances() { AllowanceID = EmployeeAllowanceBLL.Allowance.AllowanceID, AllowanceStartDate = EmployeeAllowanceBLL.AllowanceStartDate, IsActive = EmployeeAllowanceBLL.IsActive, CreatedBy = this.LoginIdentity.EmployeeCodeID, CreatedDate = DateTime.Now }); } employee.EmployeesCodes = new List <EmployeesCodes>(); employee.EmployeesCodes.Add(employeesCode); employeesCode.EmployeesCareersHistory = new List <EmployeesCareersHistory>(); employeesCode.EmployeesCareersHistory.Add(employeeCareerHistory); employeesCode.EmployeesQualifications = new List <EmployeesQualifications>(); employeesCode.EmployeesQualifications.Add(employeeQualification); #region check if the new employee is contractor then add financial advantages to him OrganizationsJobsBLL OrganizationsJobsBLL = new OrganizationsJobsBLL().GetByOrganizationJobID(employeeCareerHistory.OrganizationJobID); if (OrganizationsJobsBLL.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualExpats || OrganizationsJobsBLL.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualSaudis) { employeesCode.ContractorsBasicSalaries = new List <ContractorsBasicSalaries>(); employeesCode.ContractorsBasicSalaries.Add(contractorBasicSalary); employeeCareerHistory.EmployeesAllowances = employeesAllowancesList; } #endregion employeeDal.Insert(employee); return(this.EmployeeID); } catch { throw; } }