private void btnAdd_Click(object sender, EventArgs e) { try { if (ValidateIntervention()) { m_adapterIntervention.Insert(m_selectedMaterialID, this.dateIntervention.Value, this.dateLimitIntervention.Value, this.txbDesc.Text, false); if (s_formHomepage != null) { s_formHomepage.RebindInterventions(); } MessageBox.Show("L'intervention a bien été ajoutée"); Close(); } } catch (SqlException sqlex) { MessageBox.Show(sqlex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (ValidateMaterial()) { m_materialName = txbMaterialName.Text; m_materialSerial = Guid.NewGuid(); m_client_id = ((ListItem)cmbClientName.SelectedItem).ID; m_etage_id = ((ListItem)cmbSite.SelectedItem).ID; m_materialtype_id = ((ListItem)cmbMaterialType.SelectedItem).ID; m_description = txbDesc.Text; m_mtbf = Convert.ToInt32(txbMTBF.Text); m_intervention = dateLimitIntervention.Value; m_description = txbDesc.Text; m_adapterMaterials.Insert( m_materialName, m_materialSerial.ToString(), m_materialtype_id, m_client_id, m_selectedSiteID, m_selectedBatimentID, m_selectedEtageID, m_selectedSalleID, m_intervention, m_description); if (s_formHomepage != null) { m_adapterMaterials.Fill(m_tblMaterial); s_formHomepage.RebindMaterials(); s_formHomepage.AddIntervention(m_tblMaterial.FindByid_Materiel(m_tblMaterial.Last().id_Materiel)); s_formHomepage.RebindInterventions(); } MessageBox.Show("Le matériel a bien été ajouté"); Close(); } } catch (SqlException sqlex) { MessageBox.Show(sqlex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }