Ejemplo n.º 1
0
 private void cleanForm()
 {
     txtName.Clear();
     btnSaveModify.Text = "Guardar";
     chbStatus.Checked  = true;
     selectedFunction   = null;
     errorProvider.Clear();
 }
Ejemplo n.º 2
0
 private void dgvFunctions_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try {
         int index = e.RowIndex;
         if (index >= 0)
         {
             selectedFunction   = functions[index];
             btnSaveModify.Text = "Modificar";
             fillSelectedData(selectedFunction);
         }
     }
     catch (Exception ex)
     {
         FormUtils.defaultErrorMessage(ex);
     }
 }
Ejemplo n.º 3
0
        private void updateData(Funcione currentFunction)
        {
            Operation <Funcione> operation = functionController.updateRecord(currentFunction);

            if (operation.State)
            {
                MessageBox.Show("Función actualizada con éxito",
                                "OPERACIÓN EXITOSA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                loadTable();
                cleanForm();
            }
            else
            {
                MessageBox.Show("Ocurrió un error inesperado al actualizar la función: " + operation.Error,
                                "ERROR AL ACTUALIZAR DATOS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        private void saveData()
        {
            Funcione tempFunc = new Funcione
            {
                nombre  = txtName.Text,
                baja    = chbStatus.Checked,
                idNivel = 0
            };
            Operation <Funcione> operation = functionController.addRecord(tempFunc);

            if (operation.State)
            {
                MessageBox.Show("Función registrada con éxito",
                                "OPERACIÓN EXITOSA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                loadTable();
                cleanForm();
            }
            else
            {
                MessageBox.Show("Ocurrió un error inesperado al registrar la función: " + operation.Error,
                                "ERROR AL INGRESAR DATOS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 5
0
 private void fillSelectedData(Funcione currentFunction)
 {
     txtName.Text      = currentFunction.nombre;
     chbStatus.Checked = currentFunction.baja;
 }