Beispiel #1
0
        private void btnAddNewEmployee_Click(object sender, EventArgs e)
        {
            frmAddUpdateEmployee frm = new frmAddUpdateEmployee();

            frm.CurrentEmployee = new Employee();

            frm.ShowDialog();

            this.refreshEmpoyeeDetils();
        }
Beispiel #2
0
        private void btnUpdateEmployee_Click(object sender, EventArgs e)
        {
            frmAddUpdateEmployee frm = new frmAddUpdateEmployee();

            frm.CurrentEmployee = (Employee)employeeBindingSource.Current;

            frm.ShowDialog();

            int currentEmployeeID = ((Employee)employeeBindingSource.Current).EmployeeID;

            this.refreshEmpoyeeDetils();

            int iCurrentIndex = 0;

            foreach (Employee EmployeeObj in employeeBindingSource.List)
            {
                if (EmployeeObj.EmployeeID == currentEmployeeID)
                {
                    employeeBindingSource.Position = iCurrentIndex;
                }
                iCurrentIndex++;
            }
        }