internal static bool ReportNumberUsed(string ReportNumber) { //check if reportnumber used in detail reports if not then //update reportnumbers table with 'n' bool flag = true; int validReport = 0; validReport = ReportNumbers.ReportNumberUsed(ReportNumber); if (validReport == 0) {//if it exists, the user canceled out of anything but add mode. so we dont change it DataSet Reports = null; int Id = 0; Reports = ReportNumbers.getReportInfo(ReportNumber); int.TryParse(Reports.Tables["Report"].Rows[0]["Id"].ToString(), out Id); if (Id != 0) { ReportNumbers.UpdateReportNumbers(Id, ReportNumber, 'N'); } flag = false; } return(flag); }
internal static void DeleteDetailReport(int reportId, string reportNumber) { //delete the record if success bool success = false; try { success = Incidents.DeleteDetailReport(reportId); if (success == true) { DataSet Reports = null; int Id = 0; Reports = ReportNumbers.getReportInfo(reportNumber); int.TryParse(Reports.Tables["Report"].Rows[0]["Id"].ToString(), out Id); if (Id != 0) { ReportNumbers.UpdateReportNumbers(Id, reportNumber, 'N'); } } }catch { throw new Exception("The delete failed."); } }