示例#1
0
        private void guna2GradientCreer_Click(object sender, EventArgs e)
        {
            try
            {
                // checkForm();

                Assemble newAssemble = new Assemble
                                       (
                    guna2TxtHote.Text,
                    DateTime.Parse(guna2DateTimePickerDatePremiereRencontre.Text),
                    DateTime.Parse(guna2DateTimePickerHeureAssemble.Text),
                    guna2ComboBoxTypeAssemble.Text,
                    guna2TxtSanctionRetard.Text,
                    guna2TxtSanctionAbsence.Text
                                       );

                AssembleBLO assembleBLO = new AssembleBLO(ConfigurationManager.AppSettings["DbFolder"]);

                if (this.oldAssemble == null)
                {
                    assembleBLO.CreateAssemble(newAssemble);
                }
                else
                {
                    assembleBLO.EditAssemble(oldAssemble, newAssemble);
                }

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

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

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

                guna2TxtHote.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
                );
            }
        }
示例#2
0
 public FrmAssembleList()
 {
     InitializeComponent();
     guna2DataGridViewVersement.AutoGenerateColumns = false;
     assembleBLO = new AssembleBLO(ConfigurationManager.AppSettings["DbFolder"]);
 }