public int Insert(EmployeesCodes EmployeesCode) { try { using (var db = new HCMEntities()) { db.EmployeesCodes.Add(EmployeesCode); db.SaveChanges(); return(EmployeesCode.EmployeeCodeID); } } catch { throw; } }
public EmployeesCodes GetByEmployeeCodeNo(EmployeesCodes EmployeeCode) { try { var db = new HCMEntities(); return(db.EmployeesCodes.Include("Employees") //.Include("EmployeesCareersHistory.OrganizationsJobs") .Include("EmployeesCareersHistory.OrganizationsJobs.Jobs") .Include("EmployeesCareersHistory.OrganizationsJobs.Ranks") .Include("EmployeesCareersHistory.OrganizationsJobs.OrganizationsStructures") .FirstOrDefault(x => x.EmployeeCodeNo.Equals(EmployeeCode.EmployeeCodeNo))); } catch { throw; } }
public int UpdateIsActive(EmployeesCodes EmployeesCode) { try { using (var db = new HCMEntities()) { EmployeesCodes EmployeesCodeObj = db.EmployeesCodes.FirstOrDefault(x => x.EmployeeCodeID.Equals(EmployeesCode.EmployeeCodeID)); EmployeesCodeObj.IsActive = EmployeesCode.IsActive; EmployeesCodeObj.LastUpdatedDate = EmployeesCode.LastUpdatedDate; EmployeesCodeObj.LastUpdatedBy = EmployeesCode.LastUpdatedBy; return(db.SaveChanges()); } } catch { throw; } }