//Get Data Queue Statistics report of API Usages public ActionResult OIAPIUsageStatisticsGrid(bool IsDownload = false) { OIDashboardFacade fac = new OIDashboardFacade(this.CurrentClient.ApplicationDBConnectionString); DataSet ds = fac.GetDashboardQueueCount(); DataTable dt = new DataTable(); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; if (dt != null && dt.Rows != null && dt.Rows.Count != 0) { if (dt.Rows[0]["Importdate"] == DBNull.Value) { dt.Rows[0]["Importdate"] = DateTime.Now; } DataRow firstRow = (dt.Rows[0] as DataRow).Copy(); dt.Rows.Add(firstRow.ItemArray); dt.Rows.RemoveAt(0); } } if (dt != null && IsDownload) { string fileName = "OI Data Queue Statistics_" + DateTime.Now.Ticks.ToString() + ".xlsx"; string SheetName = "OI Data Queue Statistics"; byte[] response = CommonExportMethods.ExportExcelFile(dt, fileName, SheetName); return(File(response, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName)); } else { ViewBag.DownloadErrormessage = CommonMessagesLang.msgCommanErrorMessage; } return(View("~/Views/OI/OIHome/OIAPIUsageStatisticsGrid.cshtml", dt)); }
public ActionResult DownloadScreeningResult(string name) { List <ScreenResponseEntity> lstScreenRespinseData = JsonConvert.DeserializeObject <List <ScreenResponseEntity> >(SessionHelper.ScreenResultData); DataTable dt = CommonMethod.ToDataTable <ScreenResponseEntity>(lstScreenRespinseData); string filename = name + " - ScreeningDetails.xlsx"; byte[] response = CommonExportMethods.ExportExcelFile(dt, filename, "ScreeningDetails"); return(File(response, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename)); }
public ActionResult ExportUnprocessedRecords() { int totalCount = 0; UnprocessedInputFacade fac = new UnprocessedInputFacade(this.CurrentClient.ApplicationDBConnectionString); List <UnprocessedInputEntity> lstUnprocesseds = fac.GetUnprocessedInputRecords("", 50, -1, out totalCount); DataTable dtUnprocesseds = CommonMethod.ToDataTable(lstUnprocesseds); string fileName = "Input Records_" + DateTime.Now.Ticks.ToString() + ".xlsx"; string SheetName = "Input Records"; byte[] response = CommonExportMethods.ExportExcelFile(dtUnprocesseds, fileName, SheetName); return(File(response, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName)); }
public ActionResult ExportExcel() { long searchResultId = Convert.ToInt64(Session["Id"]); CompanyFacade fac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName); var data = fac.ExportBuildResult(searchResultId); if (searchResultId <= 0) { data = new System.Data.DataTable(); } string fileName = "BuildList_" + DateTime.Now.Ticks.ToString() + ".xlsx"; string SheetName = "BuildList"; byte[] response = CommonExportMethods.ExportExcelFile(data, fileName, SheetName); return(File(response, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName)); }
public ActionResult CacheDataPopup(string ClientCode, string CountryISOAlpha2Code) { List <DownloadCacheDataModel> model = new List <DownloadCacheDataModel>(); if (ModelState.IsValid) { try { string APIFamily = string.Empty; Clients api = new Clients(); // API Call for Download Cache Data model = api.DownloadCacheData(ClientCode, CountryISOAlpha2Code, APIFamily); if (model != null) { List <DownloadCacheDataModel> lstResult = new List <DownloadCacheDataModel>(); lstResult = model; DataTable data = ToDataTable(lstResult); if (lstResult == null) { data = new DataTable(); } string fileName = "CacheData" + DateTime.Now.Ticks.ToString() + ".xlsx"; string SheetName = "CacheData"; // Exporting the cache data in an excel format byte[] response = CommonExportMethods.ExportExcelFile(data, fileName, SheetName); return(File(response, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName)); } else { Session["Message"] = ExportLang.msgNoRecordFound; return(RedirectToAction("Index", "DNBFeature")); } } catch (Exception) { Session["Message"] = CommonMessagesLang.msgCommanErrorMessage; return(RedirectToAction("Index", "DNBFeature")); } } Session["Message"] = CommonMessagesLang.msgCommanInsertMessage; return(RedirectToAction("Index", "DNBFeature")); }
public ActionResult ExportToExcel() { List <Result> lstResult = new List <Result>(); lstResult = JsonConvert.DeserializeObject <List <Result> >(Session["OIExportToExcel"].ToString()); if (lstResult == null) { int?pagevalue = null; int pageSize = pagevalue.HasValue ? pagevalue.Value : 30; OIBuildListSearchModelEntity model = new OIBuildListSearchModelEntity(); string[] hostParts = new System.Uri(Request.Url.AbsoluteUri).Authority.Split('.'); string SubDomain = hostParts[0]; model.request_fields = JsonConvert.DeserializeObject <RequestFields>(Session["OIBuildDataRequestFields"].ToString()); Utility.OI.OIBuildList api = new Utility.OI.OIBuildList(); OIBuildListSearchModelEntity objResponse = api.OIBuildAList(model, pageSize, SubDomain); Session["OIBuildDataResults"] = JsonConvert.SerializeObject(objResponse.results); lstResult = JsonConvert.DeserializeObject <List <Result> >(Session["OIBuildDataResults"].ToString()); } else { lstResult = JsonConvert.DeserializeObject <List <Result> >(Session["OIExportToExcel"].ToString()); } DataTable data = CommonMethod.ToDataTable(lstResult); if (lstResult == null) { data = new DataTable(); } string fileName = "OIBuildList_" + DateTime.Now.Ticks.ToString() + ".xlsx"; string SheetName = "OIBuildList"; byte[] response = CommonExportMethods.ExportExcelFile(data, fileName, SheetName); return(File(response, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName)); }