public async Task <ActionResult> DownloadExemptionReport(string reportdate)
        {
            try
            {
                //Call to get Excel byte array.
                string   fileName = string.Format("Settlement Exemption Report {0}.xlsx", DateTime.Now.ToString("dd-MM-yyyy"));
                DateTime report_date;
                //DateTime end_date;
                var stSuc = DateTime.TryParse(GetDate(reportdate), out report_date);
                //var adSuc = DateTime.TryParse(GetDate(todate), out end_date);
                var data = await _repo.GetExemptionReportAsync(report_date, IsAll : true);

                var rec        = data.Select(d => new { d.MERCHANTID, d.TERMINALID, d.CREATEDATE, d.ERROR_MESSAGE, d.TRANDATETIME, d.TRANAMOUNT, d.PAYMENTREFERENCE, }).ToList();
                var dt         = SmartObj.ToDataTable(rec);
                var excelBytes = DumpExcelExemptionReport(dt, fileName);

                //Set file name.

                return(excelBytes != null?File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName) : null);
            }
            catch
            {
                return(null);
            }
        }
        public async Task <ActionResult> DownloadLoginAttempt(string fromdate, string todate, string userid)
        {
            try
            {
                //Call to get Excel byte array.
                string   fileName = string.Format("Login Attempt Report {0}.xlsx", DateTime.Now.ToString("dd-MM-yyyy"));
                DateTime start_date;
                DateTime end_date;
                var      stSuc = DateTime.TryParse(GetDate(fromdate), out start_date);
                var      adSuc = DateTime.TryParse(GetDate(todate), out end_date);
                var      data  = await _repo.GetLoginAttemptAsync(start_date, end_date, userid : userid, IsAll : true);

                var rec        = data.Select(d => new { d.USERID, d.FULLNAME, d.ATTEMPTDATESTRING, d.IP_ADDRESS, d.BROWSER }).ToList();
                var dt         = SmartObj.ToDataTable(rec);
                var excelBytes = DumpExcelLoginAttempt(dt, fileName);

                //Set file name.

                return(excelBytes != null?File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName) : null);
            }
            catch
            {
                return(null);
            }
        }
        public async Task <ActionResult> DownloadSettEnquiry(SettlementEnquiryObj obj)
        {
            try
            {
                string logopath = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["LogoPath"]) ? Convert.ToString(ConfigurationManager.AppSettings["LogoPath"]) : string.Empty;

                //Call to get Excel byte array.
                string   fileName = string.Format("Settlement Enquiry Report {0}.xlsx", DateTime.Now.ToString("dd-MM-yyyy"));
                DateTime start_date;
                DateTime end_date;
                var      companyname = repoComp.AllEager().FirstOrDefault().COMPANY_NAME;
                var      stSuc       = DateTime.TryParse(GetDate(obj.fromDate), out start_date);
                var      adSuc       = DateTime.TryParse(GetDate(obj.toDate), out end_date);
                var      data        = await _repo2.GetSettlementEnquiryAsync(obj);

                var dt         = SmartObj.ToDataTable(data);
                var excelBytes = ExcelHelper.ExportDatasetWithLogo2(10, dt, logopath, companyname, "Settlement Enquiry");

                //var excelBytes = DumpExcelSettEnquiry(dt, fileName);

                //Set file name.

                return(excelBytes != null?File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName) : null);
            }
            catch
            {
                return(null);
            }
        }
        public ActionResult DownloadSetRecon(string id)
        {
            try
            {
                //Call to get Excel byte array.
                string fileName   = string.Format("System Settlement Reconciliation for {0}.xlsx", DateTime.Now.ToString("dd-MM-yyyy"));
                var    rv         = new SetReconUpldSession();
                var    data       = rv.GetSetRecon(User.Identity.Name);
                var    dt         = SmartObj.ToDataTable(data);
                var    excelBytes = DumpExcelLoginUser(dt, fileName);

                //Set file name.

                return(excelBytes != null?File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName) : null);
            }
            catch
            {
                return(null);
            }
        }
        public async Task <ActionResult> DownloadLoginUser(string fromdate, string todate, string userid)
        {
            try
            {
                //Call to get Excel byte array.
                string fileName = string.Format("Login User Report {0}.xlsx", DateTime.Now.ToString("dd-MM-yyyy"));

                var data = await _repo.GetLoginUserAsync();

                var dt         = SmartObj.ToDataTable(data);
                var excelBytes = DumpExcelLoginUser(dt, fileName);

                //Set file name.

                return(excelBytes != null?File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName) : null);
            }
            catch
            {
                return(null);
            }
        }
        public async Task <ActionResult> DownloadAudit(string fromdate, string todate, string userid)
        {
            try
            {
                //Call to get Excel byte array.
                string   fileName = string.Format("Audit Trail Report {0}.xlsx", DateTime.Now.ToString("dd-MM-yyyy"));
                DateTime start_date;
                DateTime end_date;
                var      stSuc = DateTime.TryParse(GetDate(fromdate), out start_date);
                var      adSuc = DateTime.TryParse(GetDate(todate), out end_date);
                var      data  = await _repo.GetRptAuditAsync(institutionId, start_date, end_date, userid : userid, isAll : true);

                var dt         = SmartObj.ToDataTable(data);
                var excelBytes = DumpExcelAudit(dt, fileName);

                //Set file name.

                return(excelBytes != null?File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName) : null);
            }
            catch
            {
                return(null);
            }
        }