// GET: AlertRecipient public ActionResult Index() { AlertRecipientGridViewModel model = new AlertRecipientGridViewModel(); var selectedCompany = CompanyCookie.SelectedCompany; model.Companies = UserFunctions.GetCompaniesSelectList(selectedCompany); model.SelectedCompany = selectedCompany; model.Areas = UserFunctions.GetAreasSelectList(_db); return(View(model)); }
// GET: AccessDenied public ActionResult Index() { //read selected company from cookie var selectedCompany = CompanyCookie.SelectedCompany; var model = new WorkOrdersGridViewModel { Companies = UserFunctions.GetCompaniesSelectList(selectedCompany), SelectedCompany = selectedCompany }; return(View(model)); }
//public JsonResult GetMobileGridData([DataSourceRequest]DataSourceRequest request, string workOrderType, string workOrderDueType) //{ // // JavaScriptSerializer class used by the Json method cannot serialize object graphs which contain circular references (refer to each other). // //The best solution is to use View Model objects and avoid the serializing the properties which create the circular reference. // var model = _db.Workorders.ToList() // .OrderBy(w => w.Department.AreaName) // .ThenBy(w => w.Department.Name) // .Select(m => new WorkOrdersGridViewModel // { // DepartmentAreaName = m.Department.AreaName, // DepartmentName = m.Department.Name, // Reported = m.Reported, // Details = m.Details, // Priority = m.Priority, // ConsumerName = m.Consumer != null ? m.Consumer.Name : string.Empty, // Closed = m.Closed, // Closer = m.Closer, // Id = m.Id, // Resolution = m.Resolution, // Estimate = m.Estimate, // //Approved = m.Approved ?? false // Approved=m.Approved // }); // //filter by workorder type // if (workOrderType != null) // { // if (workOrderType.Equals("Closed")) // { // model = model.Where(x => x.Closed != null); // } // else if (workOrderType.Equals("Open")) // { // //model = model.Where(x => x.Closed == null && x.Approved == true); // model = model.Where(x => x.Closed == null && x.Approved != null); // } // else if (workOrderType.Equals("Awaiting Approval")) // { // //model = model.Where(x => x.Closed == null && x.Approved == false); // model = model.Where(x => x.Closed == null && x.Approved == null && x.Rejected == null); // } // } // //filter by due (due or overdue) // if (workOrderDueType != null) // { // if (workOrderDueType.Equals("Overdue")) // { // model = model.Where(x => x.Overdue); // } // else if (workOrderDueType.Equals("Due")) // { // model = model.Where(x => x.Overdue == false); // } // } // var data = model; // var requestPageSize = request.PageSize; // request.PageSize = 0; // //get total records // var totalRecords = data.ToDataSourceResult(request).Data.AsQueryable().Count(); // request.PageSize = requestPageSize; // return this.Json(new { Data = model.ToDataSourceResult(request), TotalRecords = totalRecords }); //} public ActionResult Index() { var selectedCompany = CompanyCookie.SelectedCompany; //if (selectedCompany == null) // selectedCompany = SelectCompany(); WorkOrdersGridViewModel model = new WorkOrdersGridViewModel { //fill dropdowns data. required for mobile view Departments = GetMobileFilterDepartmentsSelectList(), Areas = GetMobileFilterAreasSelectList(), Closers = GetMobileFilterClosersSelectList(), Priorities = GetPrioritiesSelectList(null), Companies = UserFunctions.GetCompaniesSelectList(selectedCompany), SelectedCompany = selectedCompany }; return(View(model)); }