Example #1
0
        private void btnSupprimer_Click_1(object sender, EventArgs e)
        {
            try
            {
                using (DbEntities dbDelete = new DbEntities())
                {
                    DialogResult myResult;
                    myResult = MessageBox.Show("ce dossier va supprimer completement!!! , Est que vous voulez vraiment supprimer ce document ?",
                                               " confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (myResult == DialogResult.Yes)
                    {
                        var             ID   = int.Parse(DGVDocument.CurrentRow.Cells["Docs"].Value.ToString());
                        DocumentsClient Docs = dbDelete.DocumentsClients.Where(w => w.id == ID).FirstOrDefault();
                        RendezVou       RV   = dbDelete.RendezVous.Where(w => w.id == ID).FirstOrDefault();
                        Client          Cl   = dbDelete.Clients.Where(w => w.id == ID).FirstOrDefault();



                        dbDelete.DocumentsClients.Remove(Docs);
                        dbDelete.RendezVous.Remove(RV);
                        dbDelete.Clients.Remove(Cl);
                        dbDelete.SaveChanges();

                        lblOK.Visible     = true;
                        gifDelete.Visible = true;
                        Refresh();
                        enabletext();
                    }
                }
            }
            catch
            {
            }
        }
Example #2
0
        private void BtnRenregister_Click(object sender, EventArgs e)
        {
            try
            {
                using (DbEntities dbdocument = new DbEntities())
                {
                    if (txtLongeur.Text == "" && txtPoid.Text == "" && txtmaladie.Text == "" && txtMaladieCronich.Text == "")
                    {
                        MessageBox.Show("assurez-vous d'insérer des champs obligatoires");
                    }
                    else
                    {
                        var Id  = int.Parse(DGVDocument.CurrentRow.Cells[0].Value.ToString());
                        var old = dbdocument.DocumentsClients.Where(a => a.id == Id).First();

                        DocumentsClient docsnew = new DocumentsClient();
                        docsnew.id               = int.Parse(txtid.Text);
                        docsnew.Maladie          = txtmaladie.Text;
                        docsnew.maladieChronique = txtMaladieCronich.Text;
                        docsnew.Poids            = Convert.ToDouble(txtPoid.Text);
                        docsnew.Longueur         = Convert.ToDouble(txtLongeur.Text);
                        docsnew.operation        = richTextBox1.Text;
                        old.id               = docsnew.id;
                        old.Maladie          = docsnew.Maladie;
                        old.maladieChronique = docsnew.maladieChronique;
                        old.Poids            = docsnew.Poids;
                        old.Longueur         = docsnew.Longueur;
                        old.operation        = docsnew.operation;
                        dbdocument.SaveChanges();
                        pnlAddDocument.Visible = false;

                        SuucedDocs sucdoc = new SuucedDocs();
                        sucdoc.Show();
                        pnlAddDocument.Visible = false;
                        picDelete.Enabled      = true;
                        Refresh();
                        Clear();
                        pnlAddDocument.Visible = false;
                        enabletext();
                        btnRenregister.Visible = false;
                        lblannuler.Visible     = false;
                    }
                }
            }
            catch
            {   }
        }
Example #3
0
        private void btnConfirmer_Click(object sender, EventArgs e)
        {
            //try
            //{
            using (DbEntities dbnewRV = new DbEntities())
            {
                var TimeRv = TimeSpan.Parse(dateTimePicker1.Value.ToString("HH:mm"));
                var DateRv = Convert.ToDateTime(dtpRVdatenewEV.Value.ToString("MM-dd-yyyy"));

                if (dbnewRV.RendezVous.Any(w => w.RVdate == DateRv && w.RVTime == TimeRv))

                {
                    MessageBox.Show("ce rendez-vous est déjà pris", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    dbnewRV.Clients.Any(a => a.CIN == txtCINNewRV.Text);
                    RendezVou       RV      = new RendezVou();
                    Client          Clnewrv = new Client();
                    DocumentsClient docs    = new DocumentsClient();
                    cl.CIN           = txtCINNewRV.Text;
                    cl.nomCli        = txtNomnewRV.Text;
                    cl.prenom        = txtPrenomnewRV.Text;
                    cl.DateNaissance = Convert.ToDateTime(mskDDN.Text);
                    cl.addressCli    = richAdressnewRV.Text;
                    cl.Tel           = int.Parse(txtTelnewRV.Text);
                    if (rdbFnewRV.Checked == true)
                    {
                        cl.sex = "Femme";
                    }
                    else
                    {
                        cl.sex = "Homme";
                    }
                    if (checkassurenewRV.Checked == true)
                    {
                        cl.Assurer = "Oui";
                    }
                    else

                    {
                        cl.Assurer = "Non";
                    }


                    ////------tabel RV
                    //if (dbnewRV.RendezVous.Any(a => a.RVdate == dtpRVdatenewEV.Value &&
                    //a.RVTime.Value.Hours == dateTimePicker1.Value.Hour &&
                    //a.RVTime.Value.Minute == dateTimePicker1.Value.Minute).ToString().First();
                    //{

                    //}
                    RendezVou rv = new RendezVou();
                    rv.RVdate = dtpRVdatenewEV.Value;
                    rv.RVTime = TimeSpan.Parse(dateTimePicker1.Text);
                    rv.id     = cl.id;
                    docs.id   = cl.id;


                    dbnewRV.Clients.Add(cl);
                    dbnewRV.RendezVous.Add(rv);
                    dbnewRV.DocumentsClients.Add(docs);

                    SuucedDocs S = new SuucedDocs();
                    S.picSuuceAddDocs.Visible = false;
                    S.pictureBox1.Visible     = true;
                    S.Show();

                    dbnewRV.SaveChanges();
                    Refresh();
                }
            }
            //}
            //catch
            //{

            //}
        }
Example #4
0
        private void BtnCommancer_Click_1(object sender, EventArgs e)
        {
            try
            {
                using (DbEntities db = new DbEntities())
                {
                    var             TimeRv = TimeSpan.Parse(dtpRVtime.Value.ToString("HH:mm"));
                    var             DateRv = Convert.ToDateTime(dtpRVdate.Value.ToString("MM-dd-yyyy"));
                    Client          cl     = new Client();
                    RendezVou       rv     = new RendezVou();
                    DocumentsClient docs   = new DocumentsClient();

                    if (txtCIN.Text == "" || txtNom.Text == "" || txtPrenom.Text == "" || dtpRVdate.Value == null || dtpRVtime.Text == null ||
                        txtTel.Text == "")
                    {
                        MessageBox.Show("Assurez-vous d'insérer des champs obligatoires", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else

                    if (db.RendezVous.Any(w => w.RVdate == DateRv && w.RVTime == TimeRv))

                    {
                        MessageBox.Show("ce rendez-vous est déjà pris", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    else
                    if (db.Clients.Any(a => a.CIN == txtCIN.Text))
                    {
                        MessageBox.Show("Ce Patiany est Deja existe");
                    }



                    else
                    {
                        cl.CIN           = txtCIN.Text;
                        cl.nomCli        = txtNom.Text;
                        cl.prenom        = txtPrenom.Text;
                        cl.DateNaissance = Convert.ToDateTime(mskDDN.Text);
                        cl.addressCli    = richAdress.Text;
                        cl.Tel           = int.Parse(txtTel.Text);
                        if (rdbF.Checked == true)
                        {
                            cl.sex = "Femme";
                        }
                        else
                        {
                            cl.sex = "Homme";
                        }
                        if (checkassure.Checked == true)
                        {
                            cl.Assurer = "Oui";
                        }
                        else

                        {
                            cl.Assurer = "Non";
                        }



                        //------tabel RV

                        rv.RVdate = dtpRVdate.Value;
                        rv.RVTime = TimeSpan.Parse(dtpRVtime.Text);

                        //Document Cl
                        docs.id = cl.id;
                        rv.id   = cl.id;

                        db.Clients.Add(cl);
                        db.RendezVous.Add(rv);
                        db.DocumentsClients.Add(docs);
                        db.SaveChanges();
                        Clear();
                        AvecSuccee av = new AvecSuccee();
                        av.Show();
                        this.Hide();
                        //MessageBox.Show("Ajouté Avec succès", "Message ℹ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch
            {
            }
        }