/// <summary> /// Genera el formato de solicitud de emisión, muestra imprimir emisión, y envia por } /// correo electronico la solicitud a un analista /// </summary> /// <param name="sender">object sender</param> /// <param name="e">Ext.Net.DirectEventArgs e</param> protected void Emision_Envia(object sender, Ext.Net.DirectEventArgs e) { string mensaje, Info; correoPrybe.wsCorreoPrybe correoEnvia = new correoPrybe.wsCorreoPrybe(); // Guarda en variables de sesión los datos de sexo para la inserción if (this.rbSMa.Checked == true) { Session["Sexo"] = 1; } else { Session["Sexo"] = 0; } if (this.txt_Calle.Text != "" && this.txt_NoExt.Text != "" && this.txt_Nombre_coa.Text != "" && this.txt_ApePat_coa.Text != "" && this.txt_RFC_coa.Text != "" && this.txtNombre1.Text != "" && this.txtApellido1.Text != "" && this.txtRFC.Text != "" && this.txtFechaNac.Text != "" && this.txtFechaIngre.Text != "" && this.txtAvaluo.Text != "" && this.txtCredito.Text != "" && this.sfTasa.RawValue.ToString() != "" && (DateTime.Compare(Convert.ToDateTime(this.txtFechaCredito.Text), Convert.ToDateTime(this.txtFechaIngre.Text)) > 0 && DateTime.Compare(Convert.ToDateTime(this.txtFechaCredito.Text), DateTime.Today.AddDays(1)) < 0)) { // Cambiar a mayusculas el contenido de los controles To_Upper(); // Convertir las fechas en variables Datetime para poder cambiar formato al enviarse fechaNac = Convert.ToDateTime(this.txtFechaNac.Text); fechaIng = Convert.ToDateTime(this.txtFechaIngre.Text); // Insertar socio en la base de datos de PRYBE cachando objeto para verificar si ocurrio un error ErrorOper = opSoc.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["Sexo"]), this.txtEmail.Text, this.txtRFC.Text, "", Convert.ToInt32(this.cb_Ocupacion.SelectedItem.Value), 1, Convert.ToInt32(Session["NoSucursal"]), Convert.ToInt32(this.cbColonia.SelectedItem.Value), 1, this.txt_Calle.Text , this.txt_NoExt.Text, this.txt_NoInt.Text, 1, 1, Convert.ToInt32(this.cbTipoTel.SelectedItem.Value), this.txtLada.Text, this.txtTelefono.Text, "", 4, "", "", "", 2); // Verifica si la insercion socio se realizo de manera correcta if (ErrorOper.Valor == true) { GeneraMensaje("Problema:" + ErrorOper.Mensaje, "No se pudo insertar el socio en la base de datos", 'W'); X.Get("maskDiv_Emite").AddClass("x-hide-display"); } else { ImprimeCotizacion(); this.Imprimir.Show(); Info = "Se recibio una solicitud para la emisión de un Seguro Hipotecario en el portal, con los siguientes datos :" + Environment.NewLine + Environment.NewLine + Session["HTML"] + Environment.NewLine + Environment.NewLine; mensaje = correoEnvia.EnviaCorreo(WebConfigurationManager.AppSettings.Get("correo1"), "*****@*****.**", "Solicitud Seguro Hipotecario", Info, true); GeneraMensaje("Solicitud de emisión", mensaje + ". Imprima su comprobante de solicitud de emisión dando clic en el boton 'Imprimir comprobante'", 'I'); } } else { mensaje=FaltaInfo(2); GeneraMensaje("Solicitud de emisión", "Faltan datos para poder realizar la emisión, verifique que introdujo : " + mensaje, 'I'); X.Get("maskDiv_Emite").AddClass("x-hide-display"); } this.wdEmision.Hide(); X.Get("maskDiv_Emite").AddClass("x-hide-display"); }
/************************************************************************/ /************************************************************************/ /************************************************************************/ 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; } }