public List <Cours> CourseListDL(string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord) { try { DateTime todayDate = System.DateTime.Now; using (TrainingManagementEntities1 entityObject = new TrainingManagementEntities1()) { var tempList = (from a in entityObject.Courses where a.StartDate > todayDate select a ); totalRecord = tempList.Count(); tempList = tempList.OrderBy(sort + " " + sortdir); if (pageSize > 0) { tempList = tempList.Skip(skip).Take(pageSize); } return(tempList.ToList()); } } catch (Exception e) { throw e; } }
public string AcceptRejectDL(int id, string Option, string reason) { Request RequestObj = new Request(); try { using (TrainingManagementEntities1 entityObject = new TrainingManagementEntities1()) { if (Option == "Accept") { RequestObj = entityObject.Requests.Where(a => a.RequestID == id).Single(); RequestObj.Status = "Accepted"; RequestObj.Reason = reason; entityObject.SaveChanges(); } if (Option == "Reject") { RequestObj = entityObject.Requests.Where(a => a.RequestID == id).Single(); RequestObj.Status = "Rejected"; RequestObj.Reason = reason; entityObject.SaveChanges(); } } } catch (Exception e) { throw e; } return("Done"); }
public List <Request> ViewRequest(int MID, string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord) { List <Request> requestList = new List <Request>(); totalRecord = 0; try { DateTime todayDate = System.DateTime.Now; using (TrainingManagementEntities1 dc = new TrainingManagementEntities1()) { var tempList = (from data in dc.Requests where data.ManagerID == MID && data.StartDate > todayDate && (data.Status == "Requested" | data.Status == "Accepted") && data.Status != "Cancelled" select data); totalRecord = tempList.Count(); tempList = tempList.OrderBy(sort + " " + sortdir); if (pageSize > 0) { tempList = tempList.Skip(skip).Take(pageSize); requestList = tempList.ToList(); } } } catch { } return(requestList); }
public List <Employee> GetEmployeesDL(int MID, string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord) { List <Employee> employees = new List <Employee>(); try { using (TrainingManagementEntities1 entityObject = new TrainingManagementEntities1()) { var employeeDetails = (from data in entityObject.Employees where data.MID == MID select data); totalRecord = employeeDetails.Count(); employeeDetails = employeeDetails.OrderBy(sort + " " + sortdir); if (pageSize > 0) { employeeDetails = employeeDetails.Skip(skip).Take(pageSize); employees = employeeDetails.ToList(); } } return(employees); } catch (Exception e) { throw e; } }
public List <Request> ViewHistory(int ID, string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord) { using (TrainingManagementEntities1 entityObject = new TrainingManagementEntities1()) { var list = (from a in entityObject.Requests where a.EmployeeID == ID select a); totalRecord = list.Count(); list = list.OrderBy(sort + " " + sortdir); if (pageSize > 0) { list = list.Skip(skip).Take(pageSize); } return(list.ToList()); } }
public List <Trainer> TrainersListDL(string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord) { try { using (TrainingManagementEntities1 entityObject = new TrainingManagementEntities1()) { var Trainers = (from data in entityObject.Trainers select data); totalRecord = Trainers.Count(); Trainers = Trainers.OrderBy(sort + " " + sortdir); if (pageSize > 0) { Trainers = Trainers.Skip(skip).Take(pageSize); } return(Trainers.ToList()); } } catch (Exception e) { throw e; } }