public ActionResult Index() { user user = (user)Session[ECGlobalConstants.CurrentUserMarcker]; if (user == null || user.id == 0) { return(RedirectToAction("Index", "Account")); } UserModel um = new UserModel(user.id); UsersReportIDsViewModel vmAllIDs = um.GetAllUserReportIdsLists(); UsersUnreadReportsNumberViewModel vmUnreadReports = um.GetUserUnreadCasesNumbers(vmAllIDs); /* * List<int> all_active_report_ids = vmAllIDs.all_active_report_ids; * List<int> completed_report_ids = vmAllIDs.all_completed_report_ids; * List<int> spam_report_ids = vmAllIDs.all_spam_report_ids; * List<int> closed_report_ids = vmAllIDs.all_closed_report_ids;*/ var pending_report_ids = vmAllIDs.all_pending_report_ids; ViewBag.pending_report_ids = PendingReports(pending_report_ids); #region Active Reports /*List <int> temp_all_active_report_ids = all_active_report_ids.OrderBy(t => t).ToList(); * int temp_report_count = total_report_count; * if (all_active_report_ids.Count() < temp_report_count) * temp_report_count = all_active_report_ids.Count(); * * List<int> removedIDs = new List<int>(); * int temp_report_id; * for (int i = 0; i < temp_report_count; i++) * { * temp_report_id = all_active_report_ids[i]; * temp_preview_case = new CasePreviewViewModel(temp_report_id, user.id); * preview_list.Add(temp_preview_case); * removedIDs.Add(temp_report_id); * } * for (int i = 0; i < removedIDs.Count; i++) * { * temp_all_active_report_ids.Remove(removedIDs[i]); * } * * ViewBag.ReportPreviewStart = preview_list; * ViewBag.ReportPreviewVM = temp_all_active_report_ids; */ #endregion //ViewBag.um = um; ViewBag.user_id = user.id; //ViewBag.active_report_counters = vmUnreadReports.unread_active_reports; //ViewBag.completed_report_counters = vmUnreadReports.unread_completed_reports; //ViewBag.spam_report_counters = vmUnreadReports.unread_spam_reports; //ViewBag.closed_report_counters = vmUnreadReports.unread_closed_reports; //ViewBag.newCase = Request.Params.AllKeys.FirstOrDefault(x => x == "stylenewcase"); #region EC-CC Viewbag ViewBag.is_cc = is_cc; string cc_ext = ""; if (is_cc) { cc_ext = "_cc"; } ViewBag.cc_extension = cc_ext; #endregion return(View()); }
public ActionResult Completed() { user user = (user)Session[ECGlobalConstants.CurrentUserMarcker]; if (user == null || user.id == 0) { return(RedirectToAction("Index", "Account")); } #region EC-CC Viewbag ViewBag.is_cc = is_cc; string cc_ext = ""; if (is_cc) { cc_ext = "_cc"; } ViewBag.cc_extension = cc_ext; #endregion //var userId = Session["userId"]; //UserModel um = new UserModel(2); UserModel um = new UserModel(user.id); UsersReportIDsViewModel vmAllIDs = um.GetAllUserReportIdsLists(); UsersUnreadReportsNumberViewModel vmUnreadReports = um.GetUserUnreadCasesNumbers(vmAllIDs); List <int> all_active_report_ids = vmAllIDs.all_active_report_ids; List <int> completed_report_ids = vmAllIDs.all_completed_report_ids; List <int> spam_report_ids = vmAllIDs.all_spam_report_ids; List <int> closed_report_ids = vmAllIDs.all_closed_report_ids; var pending_report_ids = vmAllIDs.all_pending_report_ids; ViewBag.pending_report_ids = PendingReports(pending_report_ids); ViewBag.completed_report_ids = completed_report_ids.OrderBy(t => t.ToString()); List <int> temp_all_completed_report_ids = completed_report_ids; int temp_report_count = total_report_count; if (completed_report_ids.Count() < temp_report_count) { temp_report_count = completed_report_ids.Count(); } List <int> removedIDs = new List <int>(); int temp_report_id; for (int i = 0; i < temp_report_count; i++) { temp_report_id = completed_report_ids[i]; temp_preview_case = new CasePreviewViewModel(temp_report_id, user.id); preview_list.Add(temp_preview_case); removedIDs.Add(temp_report_id); } for (int i = 0; i < removedIDs.Count; i++) { temp_all_completed_report_ids.Remove(removedIDs[i]); } ViewBag.ReportPreviewStart = preview_list; ViewBag.ReportPreviewVM = temp_all_completed_report_ids; ViewBag.um = um; ViewBag.user_id = user.id; ViewBag.active_report_counters = vmUnreadReports.unread_active_reports; ViewBag.completed_report_counters = vmUnreadReports.unread_completed_reports; ViewBag.spam_report_counters = vmUnreadReports.unread_spam_reports; ViewBag.closed_report_counters = vmUnreadReports.unread_closed_reports; return(View()); }
public object Get([FromUri] Filter filter) { var _started = DateTime.Now; user user = (user)HttpContext.Current.Session[ECGlobalConstants.CurrentUserMarcker]; if (user == null || user.id == 0) { return(null); } UserModel um = new UserModel(user.id); UsersReportIDsViewModel vmAllIDs = um.GetAllUserReportIdsLists(); UsersUnreadReportsNumberViewModel vmUnreadReports = um.GetUserUnreadCasesNumbers(vmAllIDs); ///old var report_ids = um.ReportsSearchIds(um._user.company_id, filter.ReportFlag); List <int> report_ids = new List <int>(); switch (filter.ReportFlag) { case 1: //active report_ids = vmAllIDs.all_active_report_ids; break; case 2: //completed report_ids = vmAllIDs.all_completed_report_ids; break; case 5: //closed report_ids = vmAllIDs.all_closed_report_ids; break; case 3: //spam report_ids = vmAllIDs.all_spam_report_ids; break; case 4: //pending report_ids = vmAllIDs.all_pending_report_ids; break; default: report_ids = vmAllIDs.all_report_ids; break; } string investigation_status = LocalizationGetter.GetString("Investigation"); int delay_allowed = 2; if (report_ids.Count > 0) { ReportModel tempRm = new ReportModel(report_ids[0]); investigation_status = tempRm.InvestigationStatusString(); delay_allowed = tempRm.GetDelayAllowed(); } if (investigation_status.ToLower().Contains(LocalizationGetter.GetString("Investigation").ToLower())) { investigation_status = LocalizationGetter.GetString("Investigation"); } ////// var reports = report_ids.Select(x => new CasePreviewViewModel(x, user.id)).ToList(); var reports = um.ReportPreviews(report_ids, investigation_status, delay_allowed).ToList(); string title = LocalizationGetter.GetString("ActiveCasesUp"); title = filter.ReportFlag == 2 ? LocalizationGetter.GetString("CompletedcasesUp") : title; title = filter.ReportFlag == 5 ? LocalizationGetter.GetString("ClosedCasesUp") : title; title = filter.ReportFlag == 3 ? LocalizationGetter.GetString("SpamcasesUp") : title; title = filter.ReportFlag == 4 ? LocalizationGetter.GetString("NewReportsUp") : title; var m = new { Mode = filter.ReportFlag, Reports = reports, Counts = new { Active = vmUnreadReports.unread_active_reports, Completed = vmUnreadReports.unread_completed_reports, Spam = vmUnreadReports.unread_spam_reports, Closed = vmUnreadReports.unread_closed_reports, Pending = vmUnreadReports.unread_pending_reports, }, Title = title, counter = (DateTime.Now - _started).TotalMilliseconds, }; return(ResponseObject2Json(m)); }