public FormStudentList() { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; studentBLO = new StudentBLO(ConfigurationManager.AppSettings["DbFolder"]); schoolBLO = new SchoolBLO(ConfigurationManager.AppSettings["DbFolder"]); }
private void btnSave_Click(object sender, EventArgs e) { try { School newSchool = new School ( txtName.Text.ToUpper(), txtLocalisation.Text, long.Parse(txtContact.Text), pictureBox1.ImageLocation ); SchoolBLO schoolBLO = new SchoolBLO(ConfigurationManager.AppSettings["DbFolder"]); if (this.oldSchool == null) { SchoolBLO.CreateSchool(oldSchool, newSchool); } else { SchoolDAO.EditSchool(oldSchool, newSchool); } MessageBox.Show ( "Save done !", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); Close(); } catch (TypingException ex) { MessageBox.Show ( ex.Message, "Typing 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 FormSchoolEdit() { InitializeComponent(); schoolBLO = new SchoolBLO(ConfigurationManager.AppSettings["DbFolder"]); oldSchool = schoolBLO.GetSchool(); if (oldSchool != null) { txtEmail.Text = oldSchool.EmailSchool; txtName.Text = oldSchool.NameSchool; txtContact.Text = oldSchool.ContactSchool.ToString(); pictureBox1.ImageLocation = oldSchool.Logo; } }
public FrmSchoolEdit() { InitializeComponent(); schoolBLO = new SchoolBLO(); }
private void btnSave_Click(object sender, EventArgs e) { try { checkForm(); School newSchool = new School ( txtNom.Text, txtEmail.Text, int.Parse(txtTel.Text), txtContact.Text, !string.IsNullOrEmpty(pictureBox1.ImageLocation) ? File.ReadAllBytes(pictureBox1.ImageLocation) : this.oldSchool?.Photo ); SchoolBLO schoolBLO = new SchoolBLO(ConfigurationManager.AppSettings["DbFolder"]); if (this.oldSchool == null) { schoolBLO.CreateSchool(newSchool); } else { schoolBLO.EditSchool(oldSchool, newSchool); } MessageBox.Show ( "Save done !", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information ); if (callBack != null) { callBack(); } if (oldSchool != null) { Close(); } txtNom.Clear(); txtEmail.Clear(); txtTel.Clear(); txtContact.Clear(); } 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 ); } }