public IActionResult OnGet(string fileName) { if (string.IsNullOrEmpty(fileName)) { return(RedirectToPage("/Index")); } RemoveFile = _fileProvider.GetFileInfo(fileName); if (!RemoveFile.Exists) { return(RedirectToPage("/Index")); } return(Page()); }
private IEnumerable <AccountBalance> GetAccountBalances(string fileName) { var theFile = _balanceFileProvider.GetFileInfo(fileName); DataSet dataSet = new DataSet(); dataSet.ReadXml(theFile.PhysicalPath, XmlReadMode.InferSchema); var tblAccountBalance = dataSet.Tables["column"]; var lenght = tblAccountBalance.Rows.Count; for (int i = 0; i < lenght; i += 14) { if (i + 13 >= lenght) { break; } if (string.IsNullOrEmpty(tblAccountBalance.Rows[i][0].ToString())) { continue; } yield return(new AccountBalance { Branch = tblAccountBalance.Rows[i][0].ToString(), AccountId = tblAccountBalance.Rows[i + 1][0].ToString(), OldAccountId = tblAccountBalance.Rows[i + 2][0].ToString(), AccountName1 = tblAccountBalance.Rows[i + 3][0].ToString(), CustomerCode = tblAccountBalance.Rows[i + 4][0].ToString(), ShortName = tblAccountBalance.Rows[i + 5][0].ToString(), CustomerName1 = tblAccountBalance.Rows[i + 6][0].ToString(), CustomerName2 = tblAccountBalance.Rows[i + 7][0].ToString(), ProductCode = tblAccountBalance.Rows[i + 8][0].ToString(), ProductName = tblAccountBalance.Rows[i + 9][0].ToString(), Currency = tblAccountBalance.Rows[i + 10][0].ToString(), AvailableBalance = tblAccountBalance.Rows[i + 11][0].ToString(), ActualBalance = tblAccountBalance.Rows[i + 12][0].ToString(), CustomerOfficer = tblAccountBalance.Rows[i + 13][0].ToString() }); } }
public IActionResult OnGetDownloadPhysical(string fileName) { var downloadFile = _balanceFileProvider.GetFileInfo(fileName); return(PhysicalFile(downloadFile.PhysicalPath, MediaTypeNames.Application.Octet, fileName)); }