public int Close(PromotionsRecords PromotionRecordObj) { try { using (var db = new HCMEntities()) { PromotionsRecords PromotionRecord = db.PromotionsRecords.Find(PromotionRecordObj.PromotionRecordID); PromotionRecord.PromotionRecordStatusID = PromotionRecordObj.PromotionRecordStatusID; PromotionRecord.ClosingBy = PromotionRecordObj.ClosingBy; PromotionRecord.ClosingTime = PromotionRecordObj.ClosingTime; PromotionRecord.LastUpdatedBy = PromotionRecordObj.LastUpdatedBy; PromotionRecord.LastUpdatedDate = PromotionRecordObj.LastUpdatedDate; foreach (PromotionsRecordsEmployees PromotionRecordEmployeeObj in PromotionRecordObj.PromotionsRecordsEmployees) { PromotionsRecordsEmployees PromotionRecordEmployee = db.PromotionsRecordsEmployees.Find(PromotionRecordEmployeeObj.PromotionRecordEmployeeID); PromotionsRecordsJobsVacancies PromotionRecordJobVacancy = db.PromotionsRecordsJobsVacancies.Find(PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.PromotionRecordJobVacancyID); OrganizationsJobs OrganizationJobVacancy = db.OrganizationsJobs.Find(PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.OrganizationJobID); OrganizationJobVacancy.IsVacant = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.IsVacant; OrganizationJobVacancy.IsReserved = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.IsReserved; OrganizationJobVacancy.LastUpdatedBy = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.LastUpdatedBy.Value; OrganizationJobVacancy.LastUpdatedDate = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.LastUpdatedDate; EmployeesCareersHistory CurrentEmployeeCareerHistory = db.EmployeesCareersHistory.Find(PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.EmployeeCareerHistoryID); CurrentEmployeeCareerHistory.IsActive = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.IsActive; CurrentEmployeeCareerHistory.LastUpdatedBy = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.LastUpdatedBy.Value; CurrentEmployeeCareerHistory.LastUpdatedDate = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.LastUpdatedDate; OrganizationsJobs CurrentOrganizationJob = db.OrganizationsJobs.Find(PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.OrganizationJobID); CurrentOrganizationJob.IsVacant = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.IsVacant; CurrentOrganizationJob.LastUpdatedBy = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.LastUpdatedBy.Value; CurrentOrganizationJob.LastUpdatedDate = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.LastUpdatedDate; EmployeesCareersHistory NewEmployeeCareerHistory = new EmployeesCareersHistory(); NewEmployeeCareerHistory.EmployeeCodeID = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.EmployeeCodeID; NewEmployeeCareerHistory.CareerHistoryTypeID = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CareerHistoryTypeID; NewEmployeeCareerHistory.OrganizationJobID = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.OrganizationJobID; NewEmployeeCareerHistory.JoinDate = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.JoinDate; NewEmployeeCareerHistory.CareerDegreeID = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CareerDegreeID; NewEmployeeCareerHistory.TransactionStartDate = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.TransactionStartDate; NewEmployeeCareerHistory.CreatedBy = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CreatedBy; NewEmployeeCareerHistory.CreatedDate = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CreatedDate; NewEmployeeCareerHistory.IsActive = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.IsActive; PromotionRecordEmployee.NewEmployeesCareersHistory = NewEmployeeCareerHistory; } return(db.SaveChanges()); } } catch { throw; } }
public int Insert(EmployeesCareersHistory EmployeeCareerHistory) { try { using (var db = new HCMEntities()) { db.EmployeesCareersHistory.Add(EmployeeCareerHistory); db.SaveChanges(); return(EmployeeCareerHistory.EmployeeCareerHistoryID); } } catch (Exception ex) { throw ex; } }
public int Delete(int EmployeeCareerHistoryID, int UserIdentity) { try { using (var db = new HCMEntities()) { EmployeesCareersHistory EmployeeCareerHistoryObj = db.EmployeesCareersHistory.FirstOrDefault(x => x.EmployeeCareerHistoryID.Equals(EmployeeCareerHistoryID)); db.EmployeesCareersHistory.Remove(EmployeeCareerHistoryObj); return(db.SaveChanges(UserIdentity)); } } catch { throw; } }
public int UpdateCareerDegree(EmployeesCareersHistory EmployeeCareerHistory) { try { using (var db = new HCMEntities()) { EmployeesCareersHistory EmployeesCareersHistoryObj = db.EmployeesCareersHistory.FirstOrDefault(x => x.EmployeeCareerHistoryID.Equals(EmployeeCareerHistory.EmployeeCareerHistoryID)); EmployeesCareersHistoryObj.CareerDegreeID = EmployeeCareerHistory.CareerDegreeID; EmployeesCareersHistoryObj.LastUpdatedBy = EmployeeCareerHistory.LastUpdatedBy; EmployeesCareersHistoryObj.LastUpdatedDate = EmployeeCareerHistory.LastUpdatedDate; return(db.SaveChanges()); } } catch { throw; } }
public int UpdateIsActive(EmployeesCareersHistory EmployeeCareerHistory) { try { using (var db = new HCMEntities()) { EmployeesCareersHistory EmployeesCareersHistoryObj = db.EmployeesCareersHistory.FirstOrDefault(x => x.EmployeeCareerHistoryID.Equals(EmployeeCareerHistory.EmployeeCareerHistoryID)); EmployeesCareersHistoryObj.IsActive = EmployeeCareerHistory.IsActive; EmployeesCareersHistoryObj.LastUpdatedBy = EmployeeCareerHistory.LastUpdatedBy.HasValue ? EmployeeCareerHistory.LastUpdatedBy : EmployeesCareersHistoryObj.LastUpdatedBy; EmployeesCareersHistoryObj.LastUpdatedDate = EmployeeCareerHistory.LastUpdatedDate; return(db.SaveChanges()); } } catch (Exception ex) { throw ex; } }
public int Update(EmployeesCareersHistory EmployeeCareerHistory) { try { using (var db = new HCMEntities()) { EmployeesCareersHistory EmployeesCareersHistoryObj = db.EmployeesCareersHistory.FirstOrDefault(x => x.EmployeeCareerHistoryID.Equals(EmployeeCareerHistory.EmployeeCareerHistoryID)); EmployeesCareersHistoryObj.OrganizationJobID = EmployeeCareerHistory.OrganizationJobID; EmployeesCareersHistoryObj.TransactionStartDate = EmployeeCareerHistory.JoinDate; EmployeesCareersHistoryObj.JoinDate = EmployeeCareerHistory.JoinDate; EmployeesCareersHistoryObj.CareerHistoryTypeID = EmployeeCareerHistory.CareerHistoryTypeID; EmployeesCareersHistoryObj.CareerDegreeID = EmployeeCareerHistory.CareerDegreeID; EmployeesCareersHistoryObj.LastUpdatedDate = EmployeeCareerHistory.LastUpdatedDate; EmployeesCareersHistoryObj.LastUpdatedBy = EmployeeCareerHistory.LastUpdatedBy; EmployeesCareersHistoryObj.IsActive = EmployeeCareerHistory.IsActive; return(db.SaveChanges()); } } catch { throw; } }