private void guna2GradientCreer_Click(object sender, EventArgs e) { try { checkForm(); Cycle newCycle = new Cycle ( guna2TxtDureeCycle.Text, guna2ComboBoxFrequenceAssemble.Text, guna2ComboBoxTypeRencontre.Text, guna2ComboBoxJourSemaine.Text, DateTime.Parse(guna2DateTimePickerDatePremiereRencontre.Text), DateTime.Parse(guna2DateTimePickerHeureRencontre.Text), int.Parse(guna2TxtSanctionRetard.Text), int.Parse(guna2TxtSanctionAbsence.Text) ); CycleBLO cycleBLO = new CycleBLO(ConfigurationManager.AppSettings["DbFolder"]); if (this.oldCycle == null) { cycleBLO.CreateCycle(newCycle); } else { cycleBLO.EditCycle(oldCycle, newCycle); } MessageBox.Show ( "Cycle creer !", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); if (callBack != null) { callBack(); } if (oldCycle != null) { Close(); } guna2TxtDureeCycle.Clear(); guna2TxtSanctionRetard.Clear(); guna2TxtSanctionAbsence.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 FrmCycleList() { InitializeComponent(); guna2DataGridViewCycle.AutoGenerateColumns = false; cycleBLO = new CycleBLO(ConfigurationManager.AppSettings["DbFolder"]); }