private void button1_Click(object sender, EventArgs e) { panelpro.Show(); btn_haire.Enabled = true; btn_save.Show(); try { if (dgvNannies.CurrentRow.Index != -1) { search = txtSearch1.Text; using (CCareMSEntities db = new CCareMSEntities()) { model1 = db.NannyDatas.Where(x => x.Username == search).FirstOrDefault(); model2 = db.WorkCharts.Where(x => x.Username == search).FirstOrDefault(); txt_n.Text = model1.Name; txtt.Text = model1.Username; txtBirth.Text = Convert.ToString(model1.BirthDate); txtedu.Text = model1.Education; txtem.Text = model1.Email; txtexperience.Text = model1.Experience; txtexsal.Text = model1.ExSalary; NidPic.Image = ConvertBytetoImage(model1.NIDPic); userpic.Image = ConvertBytetoImage(model1.UserPic); txtmobile.Text = model1.Mobile; txtGen.Text = model1.Gander; if (model2.Saturday == "Free") { free = " Saturday"; } if (model2.Sunday == "Free") { free = free + " Sunday"; } if (model2.Monday == "Free") { free = free + " Monday"; } if (model2.Tuesday == "Free") { free = free + " Tuesday"; } if (model2.Wednesday == "Free") { free = free + " Wednesday"; } if (model2.Thursday == "Free") { free = free + " Thursday"; } if (model2.Friday == "Free") { free = free + " Friday"; } txtFree.Text = free; } } } catch { MessageBox.Show("Something wrong happend"); } }
private void NannyView_Load(object sender, EventArgs e) { model.Username = Log.recby; model1.Username = Log.recby; preq.Hide(); using (CCareMSEntities db = new CCareMSEntities()) { model = db.NannyDatas.Where(x => x.Username == model.Username).FirstOrDefault(); model1 = db.WorkCharts.Where(x => x.Username == model1.Username).FirstOrDefault(); txtname.Text = model.Name;; txtNID.Text = model.NationalID; txtAddress.Text = model.Address; txtemail.Text = model.Email; userpic.Image = ConvertBytetoImage(model.UserPic); picbox.Image = ConvertBytetoImage(model.NIDPic); txtexsal.Text = model.ExSalary; txtexperience.Text = model.Experience; txtedu.Text = model.Education; txtLabel.Text = model.Username; txtt.Text = model.Type; txtmobile.Text = model.Mobile; txtname.Enabled = false; txtNID.Enabled = false; txtAddress.Enabled = false; txtemail.Enabled = false; userpic.Enabled = false; picbox.Enabled = false; txtexsal.Enabled = false; txtexperience.Enabled = false; txtedu.Enabled = false; txtLabel.Enabled = false; txtt.Enabled = false; checkBox3.Enabled = false; checkBox4.Enabled = false; checkBox5.Enabled = false; checkBox6.Enabled = false; btn_sat.Enabled = false; btn_sun.Enabled = false; btn_mon.Enabled = false; btn_tues.Enabled = false; btn_wed.Enabled = false; btn_thurs.Enabled = false; btn_fri.Enabled = false; if (model1.Saturday == "Free") { free = " Saturday"; } if (model1.Sunday == "Free") { free = free + " Sunday"; } if (model1.Monday == "Free") { free = free + " Monday"; } if (model1.Tuesday == "Free") { free = free + " Tuesday"; } if (model1.Wednesday == "Free") { free = free + " Wednesday"; } if (model1.Thursday == "Free") { free = free + " Thursday"; } if (model1.Friday == "Free") { free = free + " Friday"; } txtFree.Text = free; } row1 = dgvrequest.RowCount; row.Text = Convert.ToString(row1); }