private void SaveTS_Click(object sender, RoutedEventArgs e) { if (TestCasesDG.ItemsSource is null) { MessageBox.Show("You must add at least one test case before you save the test suite"); } else { bool bSuccess = true; List <XmlDocument> xmls = new List <XmlDocument>(); DButils tsdb = DButils.Instance; nTestSuite.TestCases = nTestCaseList; XMLCreator TestSuite = new XMLCreator(); xmls = TestSuite.CreateXML(nTestSuite); nTestSuite.TestSuiteDefinition = xmls[0].InnerXml; nTestSuite.RegressionDefinition = xmls[1].InnerXml; nTestSuite.SmokeDefinition = xmls[2].InnerXml; bSuccess = tsdb.SaveTestSuite(nTestSuite, bUpdate); bUpdate = false; if (bSuccess) { TestCasesDG.ItemsSource = null; TestCasesDG.Items.Refresh(); TSNameTB.Clear(); TSJiraTB.Clear(); VersionCB.SelectedIndex = 0; BrandCB.SelectedIndex = 0; } } }
private void ImportTSButton_Click(object sender, RoutedEventArgs e) { Home _home = null; bool bSuccess = false; _home = GetHome(out bSuccess); if (bSuccess) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { XmlDocument doc = new XmlDocument(); using (var myStream = ofd.OpenFile()) { try { doc.Load(myStream); XMLCreator xmlImporter = new XMLCreator(); TestSuite nTestSuite = xmlImporter.GetTestSuiteInformation(doc); DButils tsdb = DButils.Instance; nTestSuite.TestSuiteID = tsdb.getLastID("TestSuite") + 1; tsdb.SaveTestSuite(nTestSuite, false); _home.LoadTestSuites(); } catch { } } } } else { MessageBox.Show("You need to be in home screen to import a test suite"); } }