public static WeekList GetWeeksData() { WeekList weeks = null; using (var db = new DataBase("sp_GetWeekData", null)) { var reader = db.ExecuteReader(); if (reader.HasRows) { weeks = new WeekList(); while (reader.Read()) { var week = new Week(); week.Id = reader.GetValueOrDefault<int>("ID"); week.YearWeekNumber = reader.GetValueOrDefault<int>("WeekNo"); week.Year = reader.GetValueOrDefault<int>("WeekNoYear"); week.Month = reader.GetValueOrDefault<int>("WeekNoMonth"); week.Day = reader.GetValueOrDefault<int>("WeekNoDay"); week.MondayDate = reader.GetValueOrDefault<DateTime>("WeekNoStartDate"); weeks.Add(week); } } } return weeks; }
public static ProjectList GetAllInactive() { ProjectList projects = null; using (var db = new DataBase("sp_GetInActiveProjects_NEW", null)) { var reader = db.ExecuteReader(); if (reader.HasRows) { projects = ConvertReaderDataToProjectList(reader); } } return projects; }
public static ProjectList GetProjectsByEmployeeID(int employeeID) { ProjectList projects = null; var parms = new Dictionary<string, string>(); parms.Add("@EmployeeID", employeeID.ToString()); using (var db = new DataBase("sp_GetProjectsByEmployeeID_NEW", parms)) { var reader = db.ExecuteReader(); if (reader.HasRows) { projects = ConvertReaderDataToProjectList(reader); } } return projects; }
public static Project GetById(int projectId) { Project project = null; var parms = new Dictionary<string, string>(); parms.Add("@ProjectId", projectId.ToString()); using (var db = new DataBase("sp_GetProjectById_NEW", parms)) { var reader = db.ExecuteReader(); if (reader.HasRows) { project = ConvertReaderDataToProjectList(reader)[0]; } } return project; }
public static List<Employee> GetEngineersByProjectId(int projectId) { List<Employee> employees = null; var parms = new Dictionary<string, string>(); parms.Add("@ProjectId", projectId.ToString()); using (var db = new DataBase("sp_GetEngineersByProjectID_NEW", parms)) { var reader = db.ExecuteReader(); if (reader.HasRows) { employees = ConvertReaderDataToProjectList(reader); } } return employees; }
public static Employee GetById(int employeeId) { Employee employee = null; var parms = new Dictionary<string, string>(); parms.Add("EmployeeID", employeeId.ToString()); using (var db = new DataBase("sp_GetEmployeeByID", parms)) { var reader = db.ExecuteReader(); if (reader.HasRows) { employee = ConvertReaderDataToProjectList(reader)[0]; } } return employee; }
public static ScheduleItemList GetProjectSchedules(ProjectList projects, DateTime startDate, DateTime endDate) { ScheduleItemList schedules = null; if (projects != null && projects.Count > 0) { var parms = new Dictionary<string, string>(); parms.Add("@ProjectList", string.Join(",", (from p in projects select p.Id).ToArray())); parms.Add("@StartDate", startDate.ToShortDateString()); parms.Add("@EndDate", endDate.ToShortDateString()); using (var db = new DataBase("sp_GetProjectSchedules_NEW", parms)) { var reader = db.ExecuteReader(); if (reader.HasRows) { schedules = ConvertReaderDataToScheduleItemList(reader); } } } return schedules; }