public JsonResult WatchList_Print(string watchName) { ReportsWatchListModel reportWatchListModel = new ReportsWatchListModel(); string json = string.Empty; List <ReportsModel> reportsList = new List <ReportsModel>(); try { ReportsWatchListBase reportsWatchListBase = new ReportsWatchListBase(); reportsWatchListBase.WatchName = watchName; actionResult = reportsAction.WatchList_Print(reportsWatchListBase); if (actionResult.IsSuccess) { reportsList = CommonMethods.ConvertTo <ReportsModel>(actionResult.dtResult); } else { json = "fail"; } reportWatchListModel.reportsList = reportsList; } catch (Exception ex) { json = "-1"; ErrorReporting.WebApplicationError(ex); } return(Json(reportsList, JsonRequestBehavior.AllowGet)); }
// GET: Reports/Reports/WatchList public ActionResult WatchList() { ReportsWatchListModel model = new ReportsWatchListModel(); //List<ReportsWatchListModel> watchList = new List<ReportsWatchListModel>(); //actionResult = reportsAction.WatchNames_Load(); //if (actionResult.IsSuccess) //{ // watchList = (from DataRow row in actionResult.dtResult.Rows // select new ReportsWatchListModel // { // Text = row["Description"] != DBNull.Value ? row["Description"].ToString() : "", // Value = row["Description"] != DBNull.Value ? row["Description"].ToString() : "" // }).ToList(); //} //model.ReportsWatchList = watchList; //return View(model); model.WatchList = new List <SelectListItem>(); actionResult = reportsAction.WatchNames_Load(); if (actionResult.IsSuccess) { DataRow row = actionResult.dtResult.Rows[0]; model.WatchList.Add( new SelectListItem { Text = row["WatchName"] != DBNull.Value ? row["WatchName"].ToString() : "", Value = row["WatchID"] != DBNull.Value ? row["WatchID"].ToString() : "" }); } return(View(model)); }