예제 #1
0
        public void bindGridView()
        {
            // Btn_SaveEmp.Show();
            UpdateBtnEmployee.Hide();
            DGV_EmployeeHome.DataSource = null;
            DGV_EmployeeHome.Refresh();
            store = new store();
            var query = store.employee.Where(p => p.Status == false).ToList();

            DGV_EmployeeHome.RowCount = query.Count;


            if (query.Count != 0)
            {
                DGV_EmployeeHome.RowCount = query.Count;


                int i = 0;
                foreach (var item in query)
                {
                    DGV_EmployeeHome.Rows[i].Cells[4].Value = item.ID.ToString();
                    DGV_EmployeeHome.Rows[i].Cells[3].Value = item.EmployeeName.ToString();
                    DGV_EmployeeHome.Rows[i].Cells[1].Value = item.Salary.ToString();
                    DGV_EmployeeHome.Rows[i].Cells[2].Value = item.Phone.ToString();
                    DGV_EmployeeHome.Rows[i].Cells[0].Value = item.Address;

                    i++;
                }
            }
        }
예제 #2
0
 private void BtnAddEmp_Click_1(object sender, EventArgs e)
 {
     // add
     if (Txt_Ee.Visible == false)
     {
         Txt_Ee.Show();
     }
     if (Btn_SaveEmp.Visible == false)
     {
         Btn_SaveEmp.Show();
     }
     UpdateBtnEmployee.Hide();
     EmployeeAddressTxt.Text    = "";
     EmployeeNamrTxt.Text       = "";
     EmployeeSalaryTxt.Text     = "";
     EmployeeNationalIDTxt.Text = "";
     EmployeePhoneTxt.Text      = "";
 }
예제 #3
0
        private void Btn_SaveEmp_Click_1(object sender, EventArgs e)
        {
            // save

            if (Btn_SaveEmp.Visible == false)
            {
                Btn_SaveEmp.Show();
            }
            UpdateBtnEmployee.Hide();
            var nameFilter = store.employee.FirstOrDefault(p => p.EmployeeName == EmployeeNamrTxt.Text);

            if (nameFilter == null)
            {
                Employee employee = new Employee();
                employee.Address      = EmployeeAddressTxt.Text;
                employee.NationalId   = EmployeeNationalIDTxt.Text;
                employee.EmployeeName = EmployeeNamrTxt.Text;
                employee.HireDate     = Txt_EmployeeHireDate.Value;
                employee.Phone        = EmployeePhoneTxt.Text;
                employee.Salary       = float.Parse(EmployeeSalaryTxt.Text);
                store.employee.Add(employee);
                store.SaveChanges();
                bindGridView();
                EmployeeAddressTxt.Text    = "";
                EmployeeNamrTxt.Text       = "";
                EmployeeSalaryTxt.Text     = "";
                EmployeeNationalIDTxt.Text = "";
                EmployeePhoneTxt.Text      = "";
            }
            else
            {
                MessageBox.Show("هذا الموظف  موجود  بالفعل");
                EmployeeNamrTxt.Text = null;
                // AllPro allPro = new AllPro();
            }
        }