Пример #1
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (Nuevo == true)
         {
             if (superValidator1.Validate() == true)
             {
                 using (Profit_RGEntities context = new Profit_RGEntities())
                 {
                     context.pInsertarEmpresa(txtCo_empresa.Text.Trim(), txtDes_emp.Text.Trim(), txtEmail.Text.Trim(),
                                              txtServidor.Text.Trim(), txtPuerto.Value, OptSSL.CheckState == CheckState.Checked ? 1 : 0,
                                              MC.GetBytes(txtClave.Text.Trim()),
                                              txtAlma.Text.Trim(),
                                              txtCo_tran.Text.Trim(),
                                              txtFpago.Text.Trim(),
                                              txtCo_moneda.Text.Trim(),
                                              txtCo_sucu.Text.Trim(),
                                              txtNomina.Text.Trim(),
                                              txtContab.Text.Trim());
                 }
                 Navegar(5);
             }
         }
         else
         {
             if (superValidator1.Validate() == true)
             {
                 using (Profit_RGEntities context = new Profit_RGEntities())
                 {
                     context.pActualizarEmpresa(txtCo_empresa.Text.Trim(), txtDes_emp.Text.Trim(), txtEmail.Text.Trim(), MC.GetBytes(txtClave.Text.Trim()),
                                                txtServidor.Text.Trim(), txtPuerto.Value, OptSSL.CheckState == CheckState.Checked ? 1 : 0,
                                                txtAlma.Text.Trim(), Validador,
                                                txtCo_tran.Text.Trim(),
                                                txtFpago.Text.Trim(),
                                                txtCo_moneda.Text.Trim(),
                                                txtCo_sucu.Text.Trim(),
                                                txtNomina.Text.Trim(),
                                                txtContab.Text.Trim());
                 }
                 Navegar(5);
             }
         }
         MessageBox.Show(this, "Se ha guardado la informacion satisfactoriamente.", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (EntityException ex)
     {
         MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex1)
     {
         MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (Nuevo == true)
         {
             if (superValidator1.Validate() == true)
             {
                 using (Profit_RGEntities context = new Profit_RGEntities())
                 {
                     context.pInsertarEmpresa(txtCo_empresa.Text.Trim(), txtDes_emp.Text.Trim(), txtEmail.Text.Trim(),
                                              txtServidor.Text.Trim(), txtPuerto.Value, OptSSL.CheckState == CheckState.Checked ? 1 : 0, MC.GetBytes(txtClave.Text.Trim()));
                 }
                 Navegar(5);
             }
         }
         else
         {
             if (superValidator1.Validate() == true)
             {
                 using (Profit_RGEntities context = new Profit_RGEntities())
                 {
                     context.pActualizarEmpresa(txtCo_empresa.Text.Trim(), txtDes_emp.Text.Trim(), txtEmail.Text.Trim(), MC.GetBytes(txtClave.Text.Trim()),
                                                txtServidor.Text.Trim(), txtPuerto.Value, OptSSL.CheckState == CheckState.Checked ? 1 : 0, Validador);
                 }
                 Navegar(5);
             }
         }
     }
     catch (EntityException ex)
     {
         MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex1)
     {
         MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }