コード例 #1
0
ファイル: FormCategoria.cs プロジェクト: Gussoft/ManPctec
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Editarse == false)
            {
                try
                {
                    entidad.NombreCat      = txtNombre.Text.ToUpper();
                    entidad.DescripcionCat = txtDescripcion.Text.ToUpper();

                    negocio.InsertarCategoria(entidad);
                    MessageBox.Show("Se Guardo Correctamente el Registro!");
                    mostrarCategoria("");
                    habilitar(false, true);
                    CleanText();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se pudo Guardar el Registro : " + ex);
                }
            }
            else
            {
                try
                {
                    entidad.IdCat          = Convert.ToInt32(idCategoria);
                    entidad.NombreCat      = txtNombre.Text.ToUpper();
                    entidad.DescripcionCat = txtDescripcion.Text.ToUpper();

                    negocio.EditarCategoria(entidad);
                    MessageBox.Show("Se Edito Correctamente el Registro!");
                    mostrarCategoria("");
                    habilitar(false, true);
                    CleanText();
                    Editarse = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se pudo Editar el Registro : " + ex);
                }
            }
        }
コード例 #2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (Editarse == false)
     {
         try
         {
             objEntidad.NombreCategoria      = txtNombre.Text.ToUpper();
             objEntidad.DescripcionCategoria = txtDescripcion.Text.ToUpper();
             objNegocio.InsertarCategoria(objEntidad);
             MessageBox.Show("Se Guardo el Registro");
             mostrarBuscarTabla("");
             LimpiarCajas();
         }
         catch (Exception ex)
         {
             MessageBox.Show("No Se Pudo Guardar el Mensaje" + ex.Message);
         }
     }
     if (Editarse == true)
     {
         try
         {
             objEntidad.IdCategoria          = Convert.ToInt32(IdCategoria);
             objEntidad.NombreCategoria      = txtNombre.Text.ToUpper();
             objEntidad.DescripcionCategoria = txtDescripcion.Text.ToUpper();
             objNegocio.EditarCategoria(objEntidad);
             MessageBox.Show("Se Guardo el Registro");
             mostrarBuscarTabla("");
             LimpiarCajas();
             Editarse = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show("No Se Pudo Editar el Mensaje" + ex.Message);
         }
     }
 }