private void FamilyView_Load(object sender, EventArgs e)
        {
            model.Username = Log.recby;

            using (CCareMSEntities db = new CCareMSEntities())
            {
                model             = db.FamilyDBs.Where(x => x.Username == model.Username).FirstOrDefault();
                txtName.Text      = model.Name;
                txtNID.Text       = model.NationalID;
                txtAddress.Text   = model.Address;
                txtEmail.Text     = model.Email;
                txtG.Text         = model.Gander;
                picbox.Image      = ConvertBytetoImage(model.NIDPic);
                btn_haire.Enabled = false;
                panelpro.Hide();
                txtName.Enabled    = false;
                txtNID.Enabled     = false;
                txtEmail.Enabled   = false;
                txtG.Enabled       = false;
                txtAddress.Enabled = false;
                picbox.Enabled     = false;
                txtG.Show();
                btn_save.Hide();
                redioFemale.Hide();
                redioMale.Hide();
            }
            populateDataGridView();
        }
Exemplo n.º 2
0
 private void dgvrequest_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvrequest.CurrentRow.Index != -1)
         {
             requF           = Convert.ToString(dgvrequest.CurrentRow.Cells["gdvreq"].Value);
             model4.Username = requF;
             using (CCareMSEntities db = new CCareMSEntities())
             {
                 model4      = db.FamilyDBs.Where(x => x.Username == model4.Username).FirstOrDefault();
                 txtnm.Text  = model4.Name;
                 txtid.Text  = model4.NationalID;
                 txtad.Text  = model4.Address;
                 txtema.Text = model4.Email;
                 txtga.Text  = model4.Gander;
                 pcbox.Image = ConvertBytetoImage(model4.NIDPic);
             }
         }
     }
     catch
     {
         MessageBox.Show("Invalid");
     }
 }
        private void button9_Click(object sender, EventArgs e)
        {
            model.Username = Log.recby;
            using (CCareMSEntities db = new CCareMSEntities())
            {
                model            = db.FamilyDBs.Where(x => x.Username == model.Username).FirstOrDefault();
                model.Name       = txtName.Text.Trim();
                model.NationalID = txtNID.Text.Trim();
                model.NIDPic     = ConvertFiltoByte(this.picbox.ImageLocation);
                model.Gander     = gen;
                model.Email      = txtEmail.Text.Trim();
                model.Address    = txtAddress.Text.Trim();

                db.Entry(model).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                MessageBox.Show("Changes saved successfully");
            }
            redioFemale.Hide();
            redioMale.Hide();
            this.Hide();
            FamilyView fv = new FamilyView();

            fv.Show();
        }