Exemplo n.º 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++;
                }
            }
        }
Exemplo n.º 2
0
        private void deleteBtnEmp_Click_1(object sender, EventArgs e)
        {
            store = new store();
            DGV_EmployeeHome.DataSource = null;
            DGV_EmployeeHome.Update();
            DGV_EmployeeHome.Refresh();
            var id    = int.Parse(DGV_EmployeeHome.SelectedRows[0].Cells[4].Value.ToString());
            var query = store.employee.FirstOrDefault(p => p.ID == id);

            query.Status = true;
            store.SaveChanges();
            bindGridView();
        }
Exemplo n.º 3
0
 private void EmployeeFormNew_Load(object sender, EventArgs e)
 {
     // load
     bindGridView();
     DGV_EmployeeHome.Refresh();
 }