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
            {   }
        }
Exemple #2
0
        private void PictureBox6_Click(object sender, EventArgs e)
        {
            DbEntities db = new DbEntities();

            //EditBye
            var cin = DGVClientInfo.CurrentRow.Cells["P_CIN"].Value.ToString();

            Client old = db.Clients.Where(c => c.CIN == cin).First();

            Client newCL = new Client();

            newCL.CIN    = txtCINNewRV.Text;
            newCL.nomCli = txtNomnewRV.Text;
            newCL.prenom = txtPrenomnewRV.Text;
            if (rdbFnewRV.Checked == true)
            {
                newCL.sex = "Femme";
            }
            else
            {
                newCL.sex = "Homme";
            }
            newCL.addressCli    = richAdressnewRV.Text;
            newCL.Tel           = int.Parse(txtTelnewRV.Text);
            newCL.DateNaissance = Convert.ToDateTime(mskDDN.Text);
            if (checkassurenewRV.Checked == true)
            {
                newCL.Assurer = "Oui";
            }
            else

            {
                newCL.Assurer = "Non";
            }



            old.CIN           = newCL.CIN;
            old.nomCli        = newCL.nomCli;
            old.prenom        = newCL.prenom;
            old.sex           = newCL.sex;
            old.addressCli    = newCL.addressCli;
            old.Tel           = newCL.Tel;
            old.DateNaissance = newCL.DateNaissance;
            old.Assurer       = newCL.Assurer;


            db.SaveChanges();
            SuucedDocs S = new SuucedDocs();

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


            Refresh();
            //Design-------------------------------
            btnConfirmer.Enabled     = true;
            picSave.Visible          = false;
            txtCINNewRV.Enabled      = false;
            txtNomnewRV.Enabled      = false;
            txtPrenomnewRV.Enabled   = false;
            txtTelnewRV.Enabled      = false;
            txtTelnewRV.Enabled      = false;
            richAdressnewRV.Enabled  = false;
            rdbFnewRV.Enabled        = false;
            rdbHnewRV.Enabled        = false;
            checkassurenewRV.Enabled = false;
        }
Exemple #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
            //{

            //}
        }