//Check file exists or not before go and get reports public static bool CheckNegFileExist(Int32 UserID, DateTime ReportDate, Int64 BatchNo) { bool res = false; String downloaddir = ConfigurationManager.AppSettings["DownloadFolderPath"]; string downloadfilepath = MppUtility.GetFilelocation(UserID, downloaddir, "search"); string fileName = ConfigurationManager.AppSettings["negfilename"]; string fileName1 = fileName + "-" + MppUtility.DateFormat(ReportDate, 4) + "-" + BatchNo + ".txt"; string filePath = Path.Combine(downloadfilepath, fileName1); if (File.Exists(filePath)) { res = true; } return(res); }
//Check file exists or not before go and get reports public static String CheckFileExist(Int32 UserID, DateTime startdate, DateTime enddate, out String fileName) { String res = String.Empty; String downloaddir = ConfigurationManager.AppSettings["DownloadFolderPath"]; string downloadfilepath = MppUtility.GetFilelocation(UserID, downloaddir, "bulk"); fileName = ConfigurationManager.AppSettings["filename"]; string fileName1 = fileName.PadRight(29) + MppUtility.DateFormat(startdate, 2).PadRight(11) + "-" + MppUtility.DateFormat(enddate, 2).PadLeft(11) + ".csv"; string fileName2 = fileName.PadRight(29) + MppUtility.DateFormat(startdate, 5).PadRight(11) + "-" + MppUtility.DateFormat(enddate, 5).PadLeft(11) + ".csv"; string filePath1 = Path.Combine(downloadfilepath, fileName1); string filePath2 = Path.Combine(downloadfilepath, fileName2);//New format if (File.Exists(filePath1)) { fileName = fileName1; res = filePath1; } else if (File.Exists(filePath2)) { fileName = fileName2; res = filePath2; } return(res); }