Ejemplo n.º 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.pInsertarNaviera(txtCo_naviera.Text.Trim(), txtNavi_des.Text.Trim(),
                                              txtEmpresa.Text.Trim(), txtEmp_des.Text.Trim(),
                                              txtCo_prov.Text.Trim(), txtProv_des.Text.Trim());
                 }
                 Navegar(5);
             }
         }
         else
         {
             if (superValidator1.Validate() == true)
             {
                 using (Profit_RGEntities context = new Profit_RGEntities())
                 {
                     context.pActualizarNaviera(txtCo_naviera.Text.Trim(), txtNavi_des.Text.Trim(),
                                                txtEmpresa.Text.Trim(), txtEmp_des.Text.Trim(),
                                                txtCo_prov.Text.Trim(), txtProv_des.Text.Trim(), Validador);
                 }
                 Navegar(5);
             }
         }
         MessageBox.Show(this, "Se ha guardado la informacion satisfactoriamente.", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (DataException ex0)
     {
         MessageBox.Show(ex0.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex1)
     {
         MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }