Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Click event of the addBtn control.
        /// Shows form to add the employee passing AddRecord method.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void addBtn_Click(object sender, EventArgs e)
        {
            EmployeeForm empForm = new EmployeeForm();

            empForm.EmployeeSaved += AddRecord;
            empForm.ShowDialog();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the editBtn control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void editBtn_Click(object sender, EventArgs e)
        {
            if (NoEmployeeData())
            {
                return;
            }

            EmployeeForm empForm = PrepareEmployeeForm();

            empForm.ShowDialog();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the CellDoubleClick event of the employeesTable control.
        /// Prompts for edit.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
        private void employeesTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (NoEmployeeData())
            {
                return;
            }

            EmployeeForm empForm = PrepareEmployeeForm();

            switch (e.ColumnIndex)
            {
            case 0:
                empForm.ActiveControl = empForm.Controls["idTxt"];
                break;

            case 1:
                empForm.ActiveControl = empForm.Controls["nameTxt"];
                break;

            case 2:
                empForm.ActiveControl = empForm.Controls["addressTxt"];
                break;

            case 3:
                empForm.ActiveControl = empForm.Controls["phoneTxt"];
                break;

            case 4:
                empForm.ActiveControl = empForm.Controls["emailTxt"];
                break;

            case 5:
                empForm.ActiveControl = empForm.Controls["designationTxt"];
                break;

            case 6:
                empForm.ActiveControl = empForm.Controls["departmentCBox"];
                break;

            case 7:
                empForm.ActiveControl = empForm.Controls["hourlyWageTxt"];
                break;
            }
            empForm.ShowDialog();
        }