Exemplo n.º 1
0
        /************************************************************************/
        /************************************************************************/
        /************************************************************************/

        protected void GuardaEE(object sender, EventArgs e)
        {
            OBD_danos.wsDataConnection inserta = new OBD_danos.wsDataConnection();
            OBD_danos.Error ErrorOper = new OBD_danos.Error();
            OBD_danos.IdSocio NumSocio = new OBD_danos.IdSocio();
            OBD_danos.IdCotizacion NumCot = new OBD_danos.IdCotizacion();

            int eeIdCotiza, eeIdEmite;

            DateTime fechaNac, fechaIng;

            fechaNac = Convert.ToDateTime(txtFechaNac.Text);
            fechaIng = Convert.ToDateTime(txtFechaIngre.Text);


            if (rbSMa.Checked == true)
            {
                Session["sexoEE"] = 1;
            }
            else
            {
                Session["sexoEE"] = 0;
            }


            ErrorOper = inserta.InsertSocio(this.txtNumSocio.Text, this.txtNombre1.Text, this.txtNombre2.Text,
                            this.txtApellido1.Text, this.txtApellido2.Text, fechaNac.ToString("yyyy-MM-dd"), fechaIng.ToString("yyyy-MM-dd"),
                            (int)(Session["sexoEE"]), this.txtEmail.Text, txt_RFC.Text, txt_CURP.Text, 1, 1, Convert.ToInt32(cbSucursal.Value),
                            Convert.ToInt32(this.cbColonia.SelectedItem.Value), 1, txt_Calle.Text, txt_NoExt.Text, txt_NoInt.Text, 1, 1,
                            Convert.ToInt32(this.cb_TipoTel1.SelectedItem.Value), this.txt_Lada1.Text, this.txt_Tel1.Text, "", 
                            4, "000", "0000000", "", 0);

            NumSocio = inserta.ReturnIdSocio(Convert.ToInt32(cbSucursal.Value), this.txtNumSocio.Text);

            if (txtBeneB.Text == "" || txtBeneB.Text.Equals(EmptyValue.EmptyString))
            {
                Session["IdBeneficiario"] = 1;
            }

            bool error;


            eeIdCotiza = Convert.ToInt32(Session["eeIdCotiza"]);
            eeIdEmite = Convert.ToInt32(Session["eeIdEmite"]);

            if (eeIdCotiza != 0)
            {
                eeIdCotiza = Convert.ToInt32(Session["eeIdCotiza"]);
                eeIdEmite = Convert.ToInt32(Session["eeIdEmite"]);
            }
            else
            {
                eeIdCotiza = 0;
                eeIdEmite = 0;
            }

            error = inserta.EE_Inserta(eeIdCotiza, /*Convert.ToInt32(Session["Ejecutivo"])*/1, NumSocio.CIdSocio_IdSoc, Convert.ToInt32(cbVersion.Value),
                Convert.ToInt32(cbTipoServicio.Value), txtSuma.Text, DateTime.Today.ToString(), eeIdEmite, txtPoliza.Text, Convert.ToInt32(cbAseguradora.Value), Convert.ToInt32(cbCobertura.Value),
                txt_NoMotor.Text, txt_NoSerie.Text, txt_Placa.Text, "1", txtPrimaNeta.Text, txtDerechos.Text, txtIVA.Text, txtPrimaTotal.Text, txt_Vigencia.Text, Convert.ToDateTime(txt_Vigencia.Text).AddYears(1).ToString(),
                Convert.ToInt32(cb_RegistroV.Value), txt_RegVeh.Text, "EMISION EXTERNA", Convert.ToInt32(cb_ModoPago.Value), txt_Colonia.Text, Convert.ToString(cbCP.Value), Convert.ToInt32(Session["IdBeneficiario"]), txt_Descripcion.Text,
                DateTime.Today.ToString());

            if (error == true)
            {
                Acceso.GeneraMensaje("Problema:" + "Emisión Externa",
                            "Ocurrio un error al intentar guardar la emisión externa", 'W');
                HabilitaControles(false);
                LimpiaCampos();
                btnModificar.Disabled = false;
                btnGuardar.Disabled = true;
                btnCancelar.Disabled = true;
                
                correoEnvia.EnviaCorreo("*****@*****.**",
                                            "*****@*****.**",
                                            "PORTAL PRYBE - ERROR AL INTENTAR CREAR EMISIÓN EXTERNA",
                                            "SE HA PRESENTADO UN ERROR AL INTENTAR INSERTAR UNA EMISIÓN EXTERNA",
                                            true);
            }

            else
            {
                correoEnvia.EnviaCorreo("*****@*****.**",
                                            "*****@*****.**",
                                            "PORTAL PRYBE - SE HA GENERADO UNA EMISIÓN EXTERNA EXITOSAMENTE",
                                            "PÓLIZA: " + txtPoliza.Text + Environment.NewLine,
                                            true);

                Acceso.GeneraMensaje("Correcto:" + "Emisión Externa",
                            "Se guardo la emisión externa de manera correcta!", 'I');

                
                HabilitaControles(false);
                LimpiaCampos();
                btnModificar.Disabled = false;
                btnGuardar.Disabled = true;
                btnCancelar.Disabled = true;
            }
        }