예제 #1
0
 private void btnConfirmar_Click(object sender, EventArgs e)
 {
     if (controlActions.Status != ControlActions.STAND_BY)
     {
         if (Validator.validaCampos(new Object[] { textBoxNome }))
         {
             bool sucess = false;
             classe.Nome = textBoxNome.Text;
             if (controlActions.Status == ControlActions.INSERIR)
             {
                 sucess = dao.inserir(classe);
                 if (sucess)
                 {
                     setFieldsEnable(false);
                     getDadosTable();
                     controlActions.setButtonsEnable(true);
                     reset();
                     controlActions.Status = ControlActions.STAND_BY;
                 }
             }
             else if (controlActions.Status == ControlActions.EDITAR)
             {
                 sucess = dao.editar(classe, idProfessoresExcluir);
                 if (sucess)
                 {
                     setFieldsEnable(false);
                     getDadosTable();
                     controlActions.setButtonsEnable(true);
                     reset();
                     controlActions.Status = ControlActions.STAND_BY;
                 }
             }
             else
             {
                 controlActions.Status = ControlActions.STAND_BY;
             }
             if (isSubCadastro && sucess)
             {
                 this.Close();
             }
         }
     }
 }