private void guna2GradientCreer_Click(object sender, EventArgs e) { try { checkForm(); Caisse newCaisse = new Caisse ( guna2TxtCompte.Text, int.Parse(guna2TxtMontant.Text), DateTime.Parse(guna2DateTimePickerDateVersement.Text), guna2ComboBoxModePayement.Text, guna2TxtDescription.Text ); CaisseBLO caisseBLO = new CaisseBLO(ConfigurationManager.AppSettings["DbFolder"]); if (this.oldCaisse == null) { caisseBLO.CreateCaisse(newCaisse); } else { caisseBLO.EditCaisse(oldCaisse, newCaisse); } MessageBox.Show ( "Cotisation effectuer !", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); if (callBack != null) { callBack(); } if (oldCaisse != null) { Close(); } guna2TxtCompte.Clear(); guna2TxtDescription.Clear(); guna2TxtCompte.Focus(); } catch (TypingException ex) { MessageBox.Show ( ex.Message, "Typing error", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } catch (DuplicateNameException ex) { MessageBox.Show ( ex.Message, "Duplicate error", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } catch (KeyNotFoundException ex) { MessageBox.Show ( ex.Message, "Not found error", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } catch (Exception ex) { ex.WriteToFile(); MessageBox.Show ( "An error occurred! Please try again later.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
public FrmEnregistrerVersementList() { InitializeComponent(); guna2DataGridViewVersement.AutoGenerateColumns = false; caisseBLO = new CaisseBLO(ConfigurationManager.AppSettings["DbFolder"]); }