Ejemplo n.º 1
0
 private void editBtnEmp_Click_1(object sender, EventArgs e)
 {
     // edit
     if (DGV_EmployeeHome.SelectedRows.Count == 0)
     {
         MessageBoxIcon.Warning.ToString();
         MessageBox.Show("يجب ان تختار موظف من الموظفين");
     }
     else
     {
         if (Txt_Ee.Visible == false)
         {
             Txt_Ee.Show();
         }
         if (Btn_SaveEmp.Visible == true)
         {
             Btn_SaveEmp.Hide();
         }
         UpdateBtnEmployee.Show();
         Btn_SaveEmp.Hide();
         p_id = int.Parse(DGV_EmployeeHome.SelectedRows[0].Cells[4].Value.ToString());
         var query = store.employee.FirstOrDefault(p => p.ID == p_id);
         EmployeeNamrTxt.Text       = query.EmployeeName;
         EmployeeAddressTxt.Text    = query.Address;
         EmployeePhoneTxt.Text      = query.Phone;
         EmployeeSalaryTxt.Text     = query.Salary.ToString();
         EmployeeNationalIDTxt.Text = query.NationalId;
     }
 }
Ejemplo n.º 2
0
        private void UpdateBtnEmployee_Click_1(object sender, EventArgs e)
        {
            // save
            var query = store.employee.FirstOrDefault(p => p.ID == p_id);

            query.EmployeeName = EmployeeNamrTxt.Text.ToString();
            query.Address      = EmployeeAddressTxt.Text.ToString();
            query.NationalId   = EmployeeNationalIDTxt.Text.ToString();
            query.Salary       = float.Parse(EmployeeSalaryTxt.Text.ToString());
            query.Phone        = EmployeePhoneTxt.Text.ToString();
            store.SaveChanges();
            bindGridView();
            EmployeeAddressTxt.Text    = "";
            EmployeeNamrTxt.Text       = "";
            EmployeeSalaryTxt.Text     = "";
            EmployeeNationalIDTxt.Text = "";
            EmployeePhoneTxt.Text      = "";
            UpdateBtnEmployee.Show();
        }