private void btnSubmitBug_Click(object sender, EventArgs e) { ReportMaker.ReportToFile objReport = new ReportMaker.ReportToFile(); try { //---- Get Data Section ---- objReport.Tester = txtTester.Text; objReport.ApplicationName = txtAppName.Text; objReport.BuildNumber = txtBuildNumber.Text; objReport.DateReported = txtDateReported.Text; objReport.Description = txtDescription.Text; objReport.FileName = txtFileName.Text; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } objReport.FormatData(); // Call the Save method if (objReport.Save() == true) { MessageBox.Show("Bug recorded"); txtDescription.Text = ""; } else { MessageBox.Show("There was an error"); } } //end of btnSubmitBug_Click()
private void btnTest_Click(object sender, EventArgs e) { ReportMaker.ReportToFile objReport = new ReportMaker.ReportToFile(); objReport.Tester = "Joe tester"; objReport.ApplicationName = "Test App"; objReport.BuildNumber = "1.1"; objReport.DateReported = System.DateTime.Today.ToShortDateString(); objReport.Description = "This is a test Bug"; objReport.FileName = txtFileName.Text; string strTempString; strTempString = txtFileName.Text.ToLower(); string strXMLPattern = "^.+\\.[x][m][l]$"; string strHTMLPattern = "^.+\\.[h][t][m][l]$"; try { if ((Regex.IsMatch(strTempString, strXMLPattern))) { objReport.FormatData("xml"); } else if ((Regex.IsMatch(strTempString, strHTMLPattern))) { objReport.FormatData("html"); } else { objReport.FormatData(); } objReport.Save(); MessageBox.Show("Saved"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }//end of btnTest_Click