public Custom_Dashboard GetMainDashBoardInfo(int DashboardId) { DataSet ds = new DataSet(); StoredProcedure sp = new StoredProcedure(); Custom_Dashboard model = new Custom_Dashboard(); ds = sp.GetDashboardContent(0, Convert.ToInt32(DashboardId), 0); if (ds != null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { model.Id = dt.Rows[0]["Id"] == DBNull.Value ? 0 : Convert.ToInt32(dt.Rows[0]["Id"]); model.Name = Convert.ToString(dt.Rows[0]["DisplayName"]); model.Rows = dt.Rows[0]["Rows"] == DBNull.Value ? 2 : Convert.ToInt32(dt.Rows[0]["Rows"]); model.Columns = dt.Rows[0]["Columns"] == DBNull.Value ? 2 : Convert.ToInt32(dt.Rows[0]["Columns"]); if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { DataView dvDashContents = new DataView(ds.Tables[1]); dvDashContents.RowFilter = "DashboardId = " + model.Id; DataTable dtContents = new DataTable(); dtContents = dvDashContents.ToTable(); model.DashboardContent = GetDashboardComponents(model.Id, dtContents); } } } return(model); }
/// <summary> /// Add By Nandish Shah /// Get Custom Report List /// </summary> /// <returns>List<CurrencyModel.ClientCurrency></returns> public ActionResult GetCustomReport(string DashboardId = "", string ConnectionString = "") { Custom_Dashboard model = new Custom_Dashboard(); CustomDashboard cd = new CustomDashboard(); if (!string.IsNullOrEmpty(DashboardId)) { int DashId = int.Parse(DashboardId.ToString()); model = cd.GetMainDashBoardInfo(DashId); string regularConnectionString = ConnectionString; string ReportDBConnString = string.Empty; if (!string.IsNullOrEmpty(Convert.ToString(regularConnectionString))) { ReportDBConnString = Convert.ToString(regularConnectionString.ToString().Replace(@"\", @"\\")); } string AuthorizedReportAPIUserName = string.Empty; if (ConfigurationManager.AppSettings.Count > 0) { if (!string.IsNullOrEmpty(Convert.ToString(ConfigurationManager.AppSettings["AuthorizedReportAPIUserName"]))) { AuthorizedReportAPIUserName = System.Configuration.ConfigurationManager.AppSettings.Get("AuthorizedReportAPIUserName"); } } string AuthorizedReportAPIPassword = string.Empty; if (ConfigurationManager.AppSettings.Count > 0) { if (!string.IsNullOrEmpty(Convert.ToString(ConfigurationManager.AppSettings["AuthorizedReportAPIPassword"]))) { AuthorizedReportAPIPassword = System.Configuration.ConfigurationManager.AppSettings.Get("AuthorizedReportAPIPassword"); } } string ApiUrl = string.Empty; if (ConfigurationManager.AppSettings.Count > 0) { if (!string.IsNullOrEmpty(Convert.ToString(ConfigurationManager.AppSettings["IntegrationApi"]))) { ApiUrl = System.Configuration.ConfigurationManager.AppSettings.Get("IntegrationApi"); } } ViewBag.ReportDBConnString = ReportDBConnString; ViewBag.AuthorizedReportAPIUserName = AuthorizedReportAPIUserName; ViewBag.AuthorizedReportAPIPassword = AuthorizedReportAPIPassword; ViewBag.ApiUrl = ApiUrl; } return(View("Index", model)); }
public ActionResult Index(string DashboardId, string DashboardPageId) { try { int DashId = 0; int DashPageId = 0; if (int.TryParse(Convert.ToString(DashboardId), out DashId) && Sessions.AppMenus.Where(w => w.Description == "javascript:void(0)" && w.MenuApplicationId == DashId).Any()) { int.TryParse(Convert.ToString(DashboardPageId), out DashPageId); if (string.IsNullOrEmpty(Sessions.StartDate)) { Sessions.StartDate = DateTime.Now.AddMonths(6).ToString("MM/dd/yyyy"); Sessions.EndDate = DateTime.Now.AddDays(-1).ToString("MM/dd/yyyy"); if (Convert.ToDateTime(Sessions.StartDate) > Convert.ToDateTime(Sessions.EndDate)) { Sessions.StartDate = Convert.ToDateTime(Sessions.EndDate).AddMonths(-6).ToString("MM/dd/yyyy"); } } WebClient client = new WebClient(); string regularConnectionString = Sessions.User.UserApplicationId.Where(o => o.ApplicationTitle == Enums.ApplicationCode.RPC.ToString()).Select(o => o.ConnectionString).FirstOrDefault(); string ReportDBConnString = string.Empty; if (!string.IsNullOrEmpty(Convert.ToString(regularConnectionString))) { ReportDBConnString = Convert.ToString(regularConnectionString); } string AuthorizedReportAPIUserName = string.Empty; string AuthorizedReportAPIPassword = string.Empty; string ApiUrl = string.Empty; if (ConfigurationManager.AppSettings.Count > 0) { if (!string.IsNullOrEmpty(Convert.ToString(ConfigurationManager.AppSettings["AuthorizedReportAPIUserName"]))) { AuthorizedReportAPIUserName = System.Configuration.ConfigurationManager.AppSettings.Get("AuthorizedReportAPIUserName"); } if (!string.IsNullOrEmpty(Convert.ToString(ConfigurationManager.AppSettings["AuthorizedReportAPIPassword"]))) { AuthorizedReportAPIPassword = System.Configuration.ConfigurationManager.AppSettings.Get("AuthorizedReportAPIPassword"); } if (!string.IsNullOrEmpty(Convert.ToString(ConfigurationManager.AppSettings["IntegrationApi"]))) { ApiUrl = System.Configuration.ConfigurationManager.AppSettings.Get("IntegrationApi"); if (!string.IsNullOrEmpty(ApiUrl) && !ApiUrl.EndsWith("/")) { ApiUrl += "/"; } } } Custom_Dashboard model = new Custom_Dashboard(); string url = ApiUrl + "api/Dashboard/GetDashboardContent?DashboardId=" + DashId + "&DashboardPageId=" + DashPageId + "&UserId=" + Sessions.User.UserId + "&ConnectionString=" + ReportDBConnString + "&UserName="******"&Password="******"Years", Value = "Y" }); li.Add(new SelectListItem { Text = "Quarters", Value = "Q" }); li.Add(new SelectListItem { Text = "Months", Value = "M" }); li.Add(new SelectListItem { Text = "Weeks", Value = "W" }); //Insertion start #2416 mark Selected=true if Sessions.ViewByValue is not null if (!string.IsNullOrEmpty(Sessions.ViewByValue)) { var selectedViewBy = li.Where(x => x.Value == Sessions.ViewByValue).First(); selectedViewBy.Selected = true; } else { var selectedViewBy = li.Where(x => x.Value == Convert.ToString(Enums.viewByOption.Q)).First(); selectedViewBy.Selected = true; } //Insertion end #2416 mark Selected=true if Sessions.ViewByValue is not null ViewData["ViewBy"] = li; ViewBag.ViewBy = li; ViewBag.DashboardID = DashId; ViewBag.DashboardPageID = DashPageId; ViewBag.AuthorizedReportAPIUserName = AuthorizedReportAPIUserName; ViewBag.AuthorizedReportAPIPassword = AuthorizedReportAPIPassword; ViewBag.ApiUrl = ApiUrl; ViewBag.DashboardList = Common.GetSpDashboarData(Sessions.User.ID); ViewBag.DashboardAccess = true; return(View("Index", model)); } else { ViewBag.DashboardID = DashId; ViewBag.DashboardPageID = DashPageId; ViewBag.AuthorizedReportAPIUserName = string.Empty; ViewBag.AuthorizedReportAPIPassword = string.Empty; ViewBag.ApiUrl = string.Empty; ViewBag.DashboardList = Common.GetSpDashboarData(Sessions.User.ID); ViewBag.DashboardAccess = false; Custom_Dashboard model = new Custom_Dashboard(); return(View("Index", model)); } } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); throw; } }