public ActionResult Index() { initEmpDDL(); DateTime date = DateTime.Now; var firstDayOfMonth = new DateTime(date.Year, date.Month, 1); var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); TimeSheetBusinessLayer timesheetbusinesslayer = new TimeSheetBusinessLayer(); //List<BusinessLayer.TimeSheet> timesheets = timesheetbusinesslayer.ALLTimeSheets.ToList(); List<BusinessLayer.TimeSheet> timesheets = timesheetbusinesslayer.TimeSheetsByNameorInTimeorOutTime(null, false, firstDayOfMonth, lastDayOfMonth, firstDayOfMonth, lastDayOfMonth).ToList(); return View(timesheets); }
public ActionResult Index(String ddlAllEmployees, String ddlActiveEmployees, String ddlInactiveEmployees, String rdbEmployee, String searchInTimeFrom, String searchInTimeTo, String searchOutTimeFrom, String searchOutTimeTo) { initEmpDDL(); TimeSheetBusinessLayer timesheetbusinesslayer = new TimeSheetBusinessLayer(); Guid? GuidEmpID = new Guid(); Boolean? Del = new Boolean(); DateTime? StartInTime=new DateTime(); DateTime? StopInTime = new DateTime(); DateTime? StartOutTime = new DateTime(); DateTime? StopOutTime = new DateTime(); switch(rdbEmployee){ case "All": Del = null; if (ddlAllEmployees.Length > 0) GuidEmpID = Guid.Parse(ddlAllEmployees); else GuidEmpID = null; break; case "Active": Del = false; if (ddlActiveEmployees.Length > 0) GuidEmpID = Guid.Parse(ddlActiveEmployees); else GuidEmpID = null; break; case "Inactive": Del = true; if (ddlInactiveEmployees.Length > 0) GuidEmpID = Guid.Parse(ddlInactiveEmployees); else GuidEmpID = null; break; } if (searchInTimeFrom.Length > 0) StartInTime = DateTime.Parse(searchInTimeFrom); else StartInTime = null; if (searchInTimeTo.Length > 0) StopInTime = DateTime.Parse(searchInTimeTo).AddDays(1).AddTicks(-1); else StopInTime = null; if (searchOutTimeFrom.Length > 0) StartOutTime = DateTime.Parse(searchOutTimeFrom); else StartOutTime = null; if (searchOutTimeTo.Length > 0) StopOutTime = DateTime.Parse(searchOutTimeTo).AddDays(1).AddTicks(-1); else StopOutTime = null; List<BusinessLayer.TimeSheet> timesheets=new List<BusinessLayer.TimeSheet>(); timesheets = timesheetbusinesslayer.TimeSheetsByNameorInTimeorOutTime(GuidEmpID, Del, StartInTime, StopInTime, StartOutTime, StopOutTime).ToList(); return View(timesheets); }