private void btnSave_Click(object sender, EventArgs e) { try { if (!bln) { hospitalisation.inserts(); MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (bsrc.DataSource != null) { clshospitalisation h = (clshospitalisation)bsrc.Current; new clshospitalisation().update(h); MessageBox.Show("Modification effectuée!", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("Echec de la mise à jour" + ex.Message, "Mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } refresh(); }
private void New() { try { hospitalisation = new clshospitalisation(); bln = false; bindingcls(); txtId_malade.Text = clsDoTraitement.idMalade_hospitalisation.ToString(); txtPaiement.Text = "Non cloturé non payé"; grpSortie.Enabled = false; } catch (Exception) { btnSave.Enabled = false; } }
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) { clshospitalisation h = (clshospitalisation)bsrc.Current; new clshospitalisation().delete(h); MessageBox.Show("Suppression éffectuée", "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("Echec de la suppression " + ex.Message, "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnRest_Click(object sender, EventArgs e) { try { if (((clshospitalisation)lstArchive.SelectedItem).Etatpaiement.ToString() == "Cloturé non payé") { clshospitalisation h = new clshospitalisation(); h.Id = (((clshospitalisation)lstArchive.SelectedItem)).Id; h.Datedebut = (((clshospitalisation)lstArchive.SelectedItem)).Datedebut; h.Id_chambre = (((clshospitalisation)lstArchive.SelectedItem)).Id_chambre; h.Id_malade = (((clshospitalisation)lstArchive.SelectedItem)).Id_malade; h.Datefin = null; h.Etatpaiement = "Non cloturé non payé"; new clshospitalisation().update(h); MessageBox.Show("Dossier restauré avec succès!", "Restauration", MessageBoxButtons.OK, MessageBoxIcon.Information); refresh(); } else { clshospitalisation h = new clshospitalisation(); h.Id = (((clshospitalisation)lstArchive.SelectedItem)).Id; h.Datedebut = (((clshospitalisation)lstArchive.SelectedItem)).Datedebut; h.Id_chambre = (((clshospitalisation)lstArchive.SelectedItem)).Id_chambre; h.Id_malade = (((clshospitalisation)lstArchive.SelectedItem)).Id_malade; h.Datefin = null; h.Etatpaiement = "Non cloturé payé"; new clshospitalisation().update(h); MessageBox.Show("Dossir restauré avec succès!", "Restauration", MessageBoxButtons.OK, MessageBoxIcon.Information); refresh(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ">>>" + "Erreur Inentendue!", "Cloture", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void valider_Click(object sender, EventArgs e) { try { if (bln) { clshospitalisation h = new clshospitalisation(); h.Id = (((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Id; h.Datedebut = (((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Datedebut; h.Id_chambre = (((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Id_chambre; h.Id_malade = (((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Id_malade; if ((((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Etatpaiement == "Non cloturé non payé") { h.Etatpaiement = "Cloturé non payé"; h.Datefin = txtDateFin.Value; if (h.Datefin == null) { MessageBox.Show((((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Id_malade + "", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Information); h.Datefin = DateTime.Today; new clshospitalisation().update(h); MessageBox.Show("Sortie éffectuée avec succès!", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Information); refresh(); } else { if (h.Datedebut > h.Datefin) { MessageBox.Show("La date de sortie ne peut pas etre inférieur à la date d'entrée", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { new clshospitalisation().update(h); MessageBox.Show("Sortie éffectuée avec succès!", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Information); refresh(); //clsDoTraitement.idMaladeDossierPre = ((clsmalade)lstMalade.SelectedItem).Id; //pnAffichage.Controls.Clear(); //frmDossierPreconsultationPaiement frm = new frmDossierPreconsultationPaiement(); //frm.Parent = pnAffichage; } } } else { h.Etatpaiement = "Cloturé"; h.Datefin = txtDateFin.Value; if (h.Datefin == null) { MessageBox.Show((((clshospitalisation)dgvHospitalisation.SelectedRows[0].DataBoundItem)).Id_malade + "", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Information); h.Datefin = DateTime.Today; new clshospitalisation().update(h); MessageBox.Show("Sortie éffectuée avec succès!", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Information); refresh(); } else { if (h.Datedebut > h.Datefin) { MessageBox.Show("La date de sortie ne peut pas etre inférieur à la date d'entrée", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { new clshospitalisation().update(h); MessageBox.Show("Sortie éffectuée avec succès!", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Information); refresh(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message + " >> " + "La date de sortie ne peut pas etre inférieur à la date d'entrée", "Sortie", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }