public ActionResult ViewTimeSheet(ViewTimeSheetModel model) { // var selectedtimeSheetData = ""; try { int uid = int.Parse(Session["UserID"].ToString()); int pid = Convert.ToInt32(model.ProjectName); using (DSRCManagementSystemEntities1 dbHrms = new DSRCManagementSystemEntities1()) { var selectedtimeSheetData = (from data in dbHrms.TimesheetDatas join userdata in dbHrms.Users on data.UserID equals userdata.UserID join projectdata in dbHrms.Projects on data.ProjectID equals projectdata.ProjectID where data.UserID == uid && data.ProjectID == pid && EntityFunctions.TruncateTime(data.DateOFSheet) >= model.StartDate && EntityFunctions.TruncateTime(data.DateOFSheet) <= model.EndDate select new SelectedTimeSheet() { EmployeeName = ((userdata.FirstName) + " " + (userdata.LastName ?? "")).Trim(), ProjectName = projectdata.ProjectName, Date = data.DateOFSheet, ProjectId = data.ProjectID, UserId = data.UserID }).ToList(); return(Json(selectedtimeSheetData, JsonRequestBehavior.AllowGet)); } } catch (Exception Ex) { string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName); } return(Json(JsonRequestBehavior.AllowGet)); }
public ActionResult ViewTimeSheet() { ViewTimeSheetModel obj = new ViewTimeSheetModel(); try { using (DSRCManagementSystemEntities1 dbHrms = new DSRCManagementSystemEntities1()) { obj.ProjectNames = GetProjects(); obj.EmployeeNames = new List <SelectListItem>(); } } catch (Exception Ex) { string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName); } return(View(obj)); }