private void buttajout_Click(object sender, EventArgs e) { COMPTOIR comptoir = new COMPTOIR ( textCODE.Text, textDESIGNATION.Text, int.Parse(textQUANTITE.Text), float.Parse(textTVA.Text), double.Parse(textPRIX.Text), double.Parse(textTOTAL.Text) //DateTime.Now.ToString(dateTimePicker2.Text) ); VENTEBLO comptoirBLO = new VENTEBLO(ConfigurationManager.AppSettings["Dbfolder"]); comptoirBLO.Commande(comptoir); MessageBox.Show( "save done", "confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); if (callback != null) { callback(); } textCODE.Clear(); textDESIGNATION.Clear(); textQUANTITE.Clear(); textPRIX.Clear(); textTOTAL.Clear(); textTVA.Clear(); //dateTimePicker2.Contain; textCODE.Focus(); }
private void buttajout_Click(object sender, EventArgs e) { try { checkForm(); COMPTOIR newcommande = new COMPTOIR ( textCODE.Text, textDESIGNATION.Text, int.Parse(textQUANTITE.Text), float.Parse(textTVA.Text), double.Parse(textPRIX.Text), double.Parse(textTOTAL.Text) //DateTime.Now.ToString(dateTimePicker2.Text) ); VENTEBLO comptoirBLO = new VENTEBLO(ConfigurationManager.AppSettings["dbfolder"]); if (this.oldcommande == null) { comptoirBLO.Commande(newcommande); } else { comptoirBLO.Editcommande(oldcommande, newcommande); } MessageBox.Show ( "Save done !", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); } 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 ); } if (callback != null) { callback(); } textCODE.Clear(); textDESIGNATION.Clear(); textQUANTITE.Clear(); textPRIX.Clear(); textTOTAL.Clear(); textTVA.Clear(); //dateTimePicker2.Contain; textCODE.Focus(); loadata(); }