public static void UpdateActingDHead(string depcode, int empid, string sdate, string edate) { using (StationeryEntities smodel = new StationeryEntities()) { try { if (EFBroker_DeptEmployee.GetEmployeeListForActingDHeadSelectedCount(depcode) <= 0) { Employee emp = smodel.Employees.Where(p => p.DeptCode == depcode && p.EmpID == empid).First <Employee>(); emp.IsTempHead = "Y"; emp.StartDate = Convert.ToDateTime(sdate); emp.EndDate = Convert.ToDateTime(edate); smodel.SaveChanges(); } else { Employee orgemp = smodel.Employees.Where(q => q.DeptCode == depcode && q.IsTempHead == "Y").First <Employee>(); orgemp.IsTempHead = "N"; orgemp.StartDate = null; orgemp.EndDate = null; Employee emp = smodel.Employees.Where(p => p.DeptCode == depcode && p.EmpID == empid).First <Employee>(); emp.IsTempHead = "Y"; emp.StartDate = Convert.ToDateTime(sdate); emp.EndDate = Convert.ToDateTime(edate); smodel.SaveChanges(); } } catch (Exception e) { } } }
//Department Acting Head public int GetEmployeeListForActingDHeadSelectedCount(string deptcode) { return(EFBroker_DeptEmployee.GetEmployeeListForActingDHeadSelectedCount(deptcode)); }