Esempio n. 1
0
        private void btnDeleteEmployee_Click(object sender, EventArgs e)
        {
            string idEmployee = dgvEmployee.CurrentRow.Cells[0].Value.ToString();

            try
            {
                if (EmployeeManagement.DeleteEmployeeById(idEmployee))
                {
                    dgvEmployee.DataSource = EmployeeManagement.SelectAllEmployees();
                    FrmMain.Instance.ToolStripLabel.Text = "Se elimino el trabajador";
                }
                else
                {
                    FrmMain.Instance.ToolStripLabel.Text = "Error al eliminar el trabajador";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            if (!IdLabel.Text.Equals("none"))
            {
                if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text) && EmployeeDataGridView.CurrentRow.Cells[0].Value.ToString() != null)
                {
                    int Id = int.Parse(IdLabel.Text);

                    if (EmployeeManagement.DeleteEmployeeById(Id))
                    {
                        FrmMain.Instance.ToolStripLabel.Text = "Se elimino el Empleado correctamente.";
                        Clear();
                        ReloadEmployees();
                    }
                    else
                    {
                        FrmMain.Instance.ToolStripLabel.Text = "Error! No se pudo eliminar el Empleado.";
                    }
                }
                else
                {
                }
            }
        }