private void btnAddModels_Click(object sender, RoutedEventArgs e) { try { if (btnAddModels.Content.ToString() == "Add") { setAddModelsMode(); } else { string modelName = txtModels.Text; if (modelName.Length == 0 || modelName.Trim() == "") { throw new DAOException("Model Name was invalid"); } Response res = dl.AddModel(modelName); if (res.success) { System.Threading.Thread.Sleep(1000); setViewModelsMode(); populateModels(); } else if (res.isException) { throw new DAOException(res.exception); } } }catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void tempBtnAddModelClick(object sender, RoutedEventArgs e) { DataLayer dl = new DataLayer(); Response res = dl.AddModel(txtCompanyName.Text); if (res.success) { MessageBox.Show("Model added"); } else if (res.isException) { MessageBox.Show(res.exception); } }