예제 #1
0
        private void guna2GradientCreer_Click(object sender, EventArgs e)
        {
            try
            {
                checkForm();

                Echeance newEcheance = new Echeance
                                       (
                    int.Parse(guna2TxtMontant.Text),
                    guna2TxtTitre.Text.ToUpper(),
                    guna2TxtDescription.Text,
                    DateTime.Parse(guna2DateTimePickerDateDebut.Text),
                    DateTime.Parse(guna2DateTimePickerDateFin.Text),
                    DateTime.Parse(guna2DateTimePickerDelai.Text)
                                       );

                EcheanceBLO echeanceBLO = new EcheanceBLO(ConfigurationManager.AppSettings["DbFolder"]);

                if (this.oldEcheance == null)
                {
                    echeanceBLO.CreateEcheance(newEcheance);
                }
                else
                {
                    echeanceBLO.EditEcheance(oldEcheance, newEcheance);
                }

                MessageBox.Show
                (
                    "Echeance creer !",
                    "Confirmation",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                );

                if (callBack != null)
                {
                    callBack();
                }

                if (oldEcheance != null)
                {
                    Close();
                }

                guna2TxtTitre.Clear();
                guna2TxtDescription.Clear();
                guna2TxtMontant.Clear();

                guna2TxtTitre.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
                );
            }
        }
예제 #2
0
 public FrmEcheanceList()
 {
     InitializeComponent();
     guna2DataGridViewEcheance.AutoGenerateColumns = false;
     echeanceBLO = new EcheanceBLO(ConfigurationManager.AppSettings["DbFolder"]);
 }