public bool Upload_ApprovalCorrections_Reports(string Company) { bool result = true; if (Company == "RB") { #region 'RB' try { string ReportPaths = ConfigurationSettings.AppSettings["RB_Reports"].ToString(); #region 'Approved Titles' string[] files = Directory.GetFiles(ReportPaths, "MetaData_*.xlsx"); SQLFunction sqlfunc = new SQLFunction(); for (int i = 0; i < files.Length; i++) { string filename = files[i].ToString(); result = sqlfunc.UploadFile_RBMetaData(Company, filename); if (result) { result = sqlfunc.ExecuteProc(Company, "UpdateApprovedTitles"); } string destinationReportPaths = filename.Replace(ConfigurationSettings.AppSettings["RB_Reports"].ToString(), ConfigurationSettings.AppSettings["RB_Reports"].ToString() + "\\Approved_Processed\\"); if (result) { if (File.Exists(destinationReportPaths)) { File.Delete(destinationReportPaths); } File.Move(files[i], destinationReportPaths); } } #endregion if (result) { result = sqlfunc.ExecuteProc(Company, "GenerateContributors"); } #region 'Incorrect Titles' //string[] files_corrections = Directory.GetFiles(ReportPaths, "WFH_MetaData_Correction_*.xlsx"); //for (int i = 0; i < files.Length; i++) //{ // string filename = files[i].ToString(); // sqlfunc.UploadFile(Company, filename); // sqlfunc.ExecuteProc(Company, "UpdateApprovedTitles"); //} #endregion } catch (Exception ex) { result = false; } #endregion } else if (Company == "WFH") { #region 'WFH' try { string ReportPaths = ConfigurationSettings.AppSettings["Reports"].ToString(); #region 'Approved Titles' string[] files = Directory.GetFiles(ReportPaths, "WFH_MetaData_*.xlsx"); SQLFunction sqlfunc = new SQLFunction(); for (int i = 0; i < files.Length; i++) { string filename = files[i].ToString(); sqlfunc.UploadFile_WFHMetaData(Company, filename); result = sqlfunc.ExecuteProc(Company, "UpdateApprovedTitles"); string destinationReportPaths = filename.Replace(ConfigurationSettings.AppSettings["Reports"].ToString(), ConfigurationSettings.AppSettings["Reports"].ToString() + "\\Approved_Processed\\"); if (result) { if (File.Exists(destinationReportPaths)) { File.Delete(destinationReportPaths); } File.Move(files[i], destinationReportPaths); } } #endregion if (result) { result = sqlfunc.ExecuteProc(Company, "GenerateContributors"); } #region 'Incorrect Titles' //string[] files_corrections = Directory.GetFiles(ReportPaths, "WFH_MetaData_Correction_*.xlsx"); //for (int i = 0; i < files.Length; i++) //{ // string filename = files[i].ToString(); // sqlfunc.UploadFile(Company, filename); // sqlfunc.ExecuteProc(Company, "UpdateApprovedTitles"); //} #endregion } catch (Exception ex) { result = false; } #endregion } else { } return(result); }