private void btnDelete_Click(object sender, EventArgs e) { try { DialogResult result = MessageBox.Show("Voulez - vous vraiment supprimer cet enregistrement ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (bsrc.DataSource != null) { clsmalade s = new clsmalade(); Object[] obj = ((DataRowView)bsrc.Current).Row.ItemArray; int i = 0; foreach (DataColumn dtc in ((DataRowView)bsrc.Current).Row.Table.Columns) { if (dtc.ToString().Equals("numero")) { s.Numero = ((string)obj[i]); } else if (dtc.ToString().Equals("idMal")) { s.Id = ((int)obj[i]); } else if (dtc.ToString().Equals("id_personne")) { s.Id_personne = ((int)obj[i]); } else if (dtc.ToString().Equals("id_categoriemalade")) { s.Id_categoriemalade = ((int)obj[i]); } else if (dtc.ToString().Equals("id_etablissement")) { s.Id_etablissement = ((int)obj[i]); } else if (dtc.ToString().Equals("id_airsante")) { s.Id_airsante = ((int)obj[i]); } else if (dtc.ToString().Equals("id_profession")) { s.Id_profession = ((int)obj[i]); } else if (dtc.ToString().Equals("photo")) { s.Photo = (obj[i] == DBNull.Value) ? ((Byte[])null) : ((Byte[])obj[i]); } i++; } new clsmalade().delete(s); MessageBox.Show("Suppression éffectuée", "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.New(); refresh(); } } } catch (Exception ex) { MessageBox.Show("Echec de la suppression " + ex.Message, "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void loadData() { //bsrc.DataSource = clsMetier.GetInstance().getAllClsmaladeDt(clsDoTraitement.IdMalade); try { personne = clsMetier.GetInstance().getClsmalade(clsDoTraitement.IdMalade); a = clsMetier.GetInstance().getClsdossieravance(clsDoTraitement.IdMalade); personne.Id = clsDoTraitement.IdMalade; bsrc.DataSource = clsMetier.GetInstance().getAllClsmalade_avance1(personne.Id); dgvAvance.DataSource = bsrc; txtNom.Text = personne.Nom; txtPNom.Text = personne.Postnom; txtPrenom.Text = personne.Prenom; txtSexe.Text = personne.Sexe; txtTelephone.Text = personne.Telephone; txtDateNaissance.Text = personne.Datenaissance.ToString(); txtEtatCivil.Text = personne.Etatcivil; txtNumero.Text = personne.Numero; txtIdMalade.Text = personne.Id.ToString(); string pnom = string.IsNullOrEmpty(personne.Postnom) ? "" : " " + personne.Postnom; string prenom = string.IsNullOrEmpty(personne.Prenom) ? "" : " " + personne.Prenom; string nom_complet = personne.Nom + pnom + prenom; txtPersonne.Text = nom_complet; txtProfession.Text = clsMetier.GetInstance().getClsprofession(personne.Id_profession.ToString()).Designation; txtEntreprise.Text = clsMetier.GetInstance().getClsetablissementpriseencharge(Convert.ToInt32(personne.Id)).Denomination; txtAirSante.Text = clsMetier.GetInstance().getClsairsante(personne.Id_airsante.ToString()).Designation; try { if (personne.Photo != null) { pbPhotoPersonne.Image = (new clsDoTraitement()).getImageFromByte(personne.Photo); } else { pbPhotoPersonne.Image = null; } } catch (Exception) { pbPhotoPersonne.Image = null; } bindignlst(); bln = true; try { ////Recupération du cumul actuel de l'avance du malade sélectionné cumul_avance = clsMetier.GetInstance().getClsmalade_avanceMontantCumul(personne.Id); txtCumulMontant.Text = cumul_avance.ToString(); } catch (Exception) { } RefreshDossier(); } catch (Exception) { } }
private void cboMalade_SelectedIndexChanged(object sender, EventArgs e) { try { personne = clsMetier.GetInstance().getClsmalade(((clsmalade)cboMalade.SelectedItem).Id); txtIdPers.Text = personne.IdPers.ToString(); txtNumero.Text = personne.Numero; txtNom.Text = personne.Nom; txtPNom.Text = personne.Postnom; txtPrenom.Text = personne.Prenom; txtSexe.Text = personne.Sexe; txtTelephone.Text = personne.Telephone; txtDateNaissance.Text = personne.Datenaissance.ToString(); txtEtatCivil.Text = personne.Etatcivil; txtCategorie.Text = clsMetier.GetInstance().getClscategoriemalade(Convert.ToInt32(personne.Id_categoriemalade)).Designation; txtProfession.Text = clsMetier.GetInstance().getClsprofession(Convert.ToInt32(personne.Id_profession)).Designation; txtEtablissement.Text = clsMetier.GetInstance().getClsetablissementpriseencharge(Convert.ToInt32(personne.Id_etablissement)).Denomination; txtAireSante.Text = clsMetier.GetInstance().getClsairsante(Convert.ToInt32(personne.Id_airsante)).Designation; pbPhotoPersonne.Image = (new clsDoTraitement()).getImageFromByte(personne.Photo); } catch (Exception) { }//{ MessageBox.Show("Erreur lors de la sélection de la personne", "Erreur de sélection"); } }
private void loadData() { //bsrc.DataSource = clsMetier.GetInstance().getAllClsmaladeDt(clsDoTraitement.IdMalade); try { personne = clsMetier.GetInstance().getClsmalade(clsDoTraitement.IdMalade); d = clsMetier.GetInstance().getClsdossierpreconsultation(clsDoTraitement.IdMalade); personne.Id = clsDoTraitement.IdMalade; lstDossierEncCours.DataSource = clsMetier.GetInstance().getAllClsdossierpreconsultation1(clsDoTraitement.IdMalade); setMembersalllst(lstDossierEncCours, "Date", "Id"); txtNom.Text = personne.Nom; txtPNom.Text = personne.Postnom; txtPrenom.Text = personne.Prenom; txtSexe.Text = personne.Sexe; txtTelephone.Text = personne.Telephone; txtDateNaissance.Text = personne.Datenaissance.ToString(); txtEtatCivil.Text = personne.Etatcivil; txtNumero.Text = personne.Numero; txtNumeroFiche.Text = personne.Numero_fiche; txtProfession.Text = clsMetier.GetInstance().getClsprofession(personne.Id_profession.ToString()).Designation; txtEntreprise.Text = clsMetier.GetInstance().getClsetablissementpriseencharge(Convert.ToInt32(personne.Id)).Denomination; txtAirSante.Text = clsMetier.GetInstance().getClsairsante(personne.Id_airsante.ToString()).Designation; try { if (personne.Photo != null) { pbPhotoPersonne.Image = (new clsDoTraitement()).getImageFromByte(personne.Photo); } else { pbPhotoPersonne.Image = null; } } catch (Exception) { pbPhotoPersonne.Image = null; } if (clsMetier.GetInstance().getAllClsdossierpreconsultation1(clsDoTraitement.IdMalade).Count == 0) { bdNav.Enabled = true; grpDossier.Enabled = false; tabControl1.Enabled = true; //S'il n'ya aucune donné concernant la préconsultation dgvPreconsultation.DataSource = null; //refresh(); try { New(); } catch (Exception) { btnSave.Enabled = false; } } else { if (lstDossierEncCours.Items.Count == 0) { } else { bindignlst(); bln = true; txtDateOuvertureDossier.Text = ((clsdossierpreconsultation)lstDossierEncCours.SelectedItem).Date.ToString(); txtEtatPaiement.Text = ((clsdossierpreconsultation)lstDossierEncCours.SelectedItem).Etatpaiement.ToString(); bdNav.Enabled = false; grpDossier.Enabled = true; } } } catch (Exception) { } }
private void btnSave_Click(object sender, EventArgs e) { try { if (!bln) { if (cboCategorie.Text == "Non abonné" && cboEtablissement.Text == "Privée") { malade.inserts(); MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (cboCategorie.Text == "Abonné" && cboEtablissement.Text != "Privée") { malade.inserts(); MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Un abonné ne peut pas être privé et Un non abonné ne peut pas avoir une entreprise de prise en charge. Sélectionnez Privée comme entreprise si ca n'exite pas,créez la avec cette écriture:'Privée' ", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { if (bsrc.DataSource != null) { clsmalade s = new clsmalade(); Object[] obj = ((DataRowView)bsrc.Current).Row.ItemArray; int i = 0; foreach (DataColumn dtc in ((DataRowView)bsrc.Current).Row.Table.Columns) { if (dtc.ToString().Equals("numero")) { s.Numero = ((string)obj[i]); } else if (dtc.ToString().Equals("numero_fiche")) { s.Numero_fiche = ((string)obj[i]); } else if (dtc.ToString().Equals("idMal")) { s.Id = ((int)obj[i]); } else if (dtc.ToString().Equals("id_personne")) { s.Id_personne = ((int)obj[i]); } else if (dtc.ToString().Equals("id_categoriemalade")) { s.Id_categoriemalade = ((int)obj[i]); } else if (dtc.ToString().Equals("id_etablissement")) { s.Id_etablissement = ((int)obj[i]); } else if (dtc.ToString().Equals("id_airsante")) { s.Id_airsante = ((int)obj[i]); } else if (dtc.ToString().Equals("id_profession")) { s.Id_profession = ((int)obj[i]); } else if (dtc.ToString().Equals("id_groupesanguin")) { s.Id_groupesanguin = ((int)obj[i]); } i++; } if (cboCategorie.Text == "Non abonné" && cboEtablissement.Text == "Privée") { new clsmalade().update(s); MessageBox.Show("Modification effectuée!", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (cboCategorie.Text == "Abonné" && cboEtablissement.Text != "Privée") { new clsmalade().update(s); //malade.inserts(); MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Un abonné ne peut pas être privé et Un non abonné ne peut pas avoir une entreprise de prise en charge. Sélectionnez Privée comme entreprise si ca n'exite pas,créez la avec cette écriture:'Privée' ", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } try { loadData(); } catch (Exception ex) { MessageBox.Show("Erreur lors du chargement des informations du malade sélectionné =>" + ex.Message, "Affichage informations malade", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show("Echec de la mise à jour" + ex.Message, "Mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //this.New(); //refresh(); }
private void New() { malade = new clsmalade(); bln = false; bindingcls(); btnAfficherDonnees.Enabled = false; txtNom.Clear(); txtPNom.Clear(); txtPrenom.Clear(); txtTelephone.Clear(); txtAdresse.Clear(); txtSexe.Clear(); txtEtatCivil.Clear(); txtNumero.Clear(); pbPhotoPersonne.Image = null; txtPersonne.Clear(); txtAge.Clear(); txtPersonne.Focus(); try { bsrc.DataSource = clsMetier.GetInstance().getAllClsmaladeDt2(-100); dgvMalade.DataSource = bsrc; if (cboCategorie.Items.Count > 0) { cboCategorie.SelectedIndex = 0; } if (cboEtablissement.Items.Count > 0) { cboEtablissement.SelectedIndex = 0; } if (cboProfession.Items.Count > 0) { cboProfession.SelectedIndex = 0; } if (cboAireSante.Items.Count > 0) { cboAireSante.SelectedIndex = 0; } if (cboGpSanguin.Items.Count > 0) { cboGpSanguin.SelectedIndex = 0; } } catch (Exception) { } RecherchePersonneFrm frm = new RecherchePersonneFrm(); frm.setFormPrincipal(principal); frm.Icon = principal.Icon; frm.ShowDialog(); if (clsDoTraitement.doubleclicRecherchePersonneDg) { btnSave.Enabled = true; clsDoTraitement.doubleclicRecherchePersonneDg = false; txtPersonne.Text = clsDoTraitement.FullNamePersonne; } else { btnSave.Enabled = false; } }