public MPDatos VericarCliente(Int32 IDIdClienteTmp, string conexion) { bool error = false; string respuesta = ""; var idclienteAfiliacion = new BEClienteTmp(); string Html = string.Empty; try { var Parameter = new SqlParameter[3]; Parameter[0] = new SqlParameter("@IdClienteTmp", SqlDbType.BigInt) { Value = IDIdClienteTmp }; Parameter[1] = new SqlParameter("@Error", SqlDbType.Bit) { Direction = ParameterDirection.Output }; Parameter[2] = new SqlParameter("@Respuesta", SqlDbType.NVarChar, 200) { Direction = ParameterDirection.Output }; using (var read = SqlHelper.ExecuteReader(conexion, CommandType.StoredProcedure, "dbo.validarAfiliacion", Parameter)) { read.Read(); if (read.HasRows && !read.IsDBNull(read.GetOrdinal("IdClienteTmp"))) { idclienteAfiliacion.IdClienteTmp = read.GetInt64(read.GetOrdinal("IdClienteTmp")); idclienteAfiliacion.Nombres = read.GetString(read.GetOrdinal("NOMBRE_AFILIADO")); idclienteAfiliacion.CodigoConfirmacionMovil = read.GetString(read.GetOrdinal("CodigoAfiliacion")); idclienteAfiliacion.Email = read.GetString(read.GetOrdinal("Email")); Html = read.GetString(read.GetOrdinal("Html")); } read.NextResult(); error = (bool)Parameter[1].Value; respuesta = Parameter[2].Value.ToString(); } } catch (Exception ex) { throw ex; } return(new MPDatos { BEClienteTmp = idclienteAfiliacion, Error = error, Respuesta = respuesta, Html = Html }); }
public IActionResult Afiliaa2(AfiliarClienteViewModel Datos) { string Conexion = _connectionString.DefaultConnection; var BEClienteTmp1 = new BEClienteTmp(); BEClienteTmp1.AceptaPolitica = Datos.AceptaPolitica; BEClienteTmp1.ApellidoMaterno = Datos.ApellidoMaterno; BEClienteTmp1.ApellidoPaterno = Datos.ApellidoPaterno; BEClienteTmp1.CodigoAfiliacion = Guid.NewGuid(); BEClienteTmp1.CodigoConfirmacionEmail = ""; BEClienteTmp1.CodigoConfirmacionMovil = ""; BEClienteTmp1.ConfirmoEmail = false; BEClienteTmp1.ConfirmoMovil = false; BEClienteTmp1.Direccion = Datos.xDireccion; BEClienteTmp1.Email = Datos.Email; BEClienteTmp1.FechaEmisionDocumento = Datos.FechaEmisionDocumento; BEClienteTmp1.FechaNacimiento = Datos.FechaNacimiento; BEClienteTmp1.FechaRegistro = new DateTime(); BEClienteTmp1.Genero = Datos.Genero; BEClienteTmp1.IdCanalAfiliacion = 0; //BEClienteTmp1.IdClienteTmp = 0; BEClienteTmp1.IdDepartamento = Datos.IdDepartamento; BEClienteTmp1.IdDistrito = Datos.IdDistrito; BEClienteTmp1.IdEstadoCivil = Datos.IdEstadoCivil; BEClienteTmp1.IdPrefijoDireccion = 0; BEClienteTmp1.IdProvincia = Datos.IdProvincia; BEClienteTmp1.IdReferido = 0; BEClienteTmp1.IdStand = 0; BEClienteTmp1.IdTipoActivacion = 0; BEClienteTmp1.IdTipoCanalAfiliacion = 0; BEClienteTmp1.IdTipoDireccion = 0; BEClienteTmp1.IdTipoDocumento = 1; BEClienteTmp1.IdTipoEnvioTarjeta = 0; BEClienteTmp1.IdTipoOperador = Datos.IdTipoOperador; BEClienteTmp1.IMEI = ""; BEClienteTmp1.Nombres = Datos.Nombres; BEClienteTmp1.NumeroDocumento = Datos.NumeroDocumento; BEClienteTmp1.NumeroIntentosFallidos = 0; BEClienteTmp1.NumeroIntentosFallidosReenvio = 0; BEClienteTmp1.NumeroMovil = Datos.NumeroMovil; BEClienteTmp1.NumeroReenvioPin = 0; BEClienteTmp1.PasswordHash = Datos.PasswordHash; BEClienteTmp1.RangoDiasEntrega = Datos.RangoDiasEntrega; BEClienteTmp1.RangoHorasEntrega = Datos.RangoHorasEntrega; BEClienteTmp1.RecibeBoletin = Datos.RecibeBoletin; BEClienteTmp1.RecibeTarjeta = Datos.RecibeTarjeta; BEClienteTmp1.Referencia = Datos.xReferencia; BEClienteTmp1.TelefonoFijo = ""; BEClienteTmp1.Ubigeo = Datos.IdDepartamento + Datos.IdProvincia + Datos.IdDistrito; BEClienteTmp1.Usuario = Datos.Usuario; BEParametro Mensaje = _iafilicion.AfiliarClienteTemp(BEClienteTmp1, Conexion); if (Mensaje.xDescripcion == "AFILIACION CORRECTA") { var RespuestaAfiliacion = new MPDatos(); RespuestaAfiliacion = _iafilicion.VericarCliente(Mensaje.iConstante, Conexion); if (RespuestaAfiliacion.Error == false) { string Html = RespuestaAfiliacion.Html; string Html1 = string.Empty; string Html2 = string.Empty; if (Html.Contains("@NOMBRE_AFILIADO")) { Html1 = Html.Replace("@NOMBRE_AFILIADO", RespuestaAfiliacion.BEClienteTmp.Nombres); if (Html1.Contains("@CODIGO_EMAIL_CONFIRMACION")) { Html2 = Html1.Replace("@CODIGO_EMAIL_CONFIRMACION", RespuestaAfiliacion.BEClienteTmp.CodigoConfirmacionMovil); } } var servi = new EmailServiceRepositorio(); var correo = new BEemail(); correo.ToAdress = RespuestaAfiliacion.BEClienteTmp.Email; correo.Subject = "Confirmacion De Afiliacion"; correo.Html = Html2; servi.SendEmailASync(correo, ec); } return(RedirectToAction("Afiliacion3", "Afiliacion", Datos)); } else { return(RedirectToAction("Error", "Home")); } }
public BEParametro AfiliarClienteTemp(BEClienteTmp datosAfilia, string conecta) { return(new BLAfilia().insertar_clienteTemp(datosAfilia, conecta)); }
public BEParametro insertar_clienteTemp(BEClienteTmp datos, string conexion) { BEParametro mensaje = null; try { var Parameter = new SqlParameter[40]; Parameter[0] = new SqlParameter("@Nombres", SqlDbType.NVarChar, 100) { Value = datos.Nombres }; Parameter[1] = new SqlParameter("@ApellidoPaterno", SqlDbType.NVarChar, 100) { Value = datos.ApellidoPaterno }; Parameter[3] = new SqlParameter("@ApellidoMaterno", SqlDbType.NVarChar, 100) { Value = datos.ApellidoMaterno }; Parameter[4] = new SqlParameter("@IdTipoDocumento", SqlDbType.Int) { Value = 1 }; Parameter[5] = new SqlParameter("@NumeroDocumento", SqlDbType.NVarChar, 20) { Value = datos.NumeroDocumento }; Parameter[6] = new SqlParameter("@FechaEmisionDocumento", SqlDbType.NVarChar, 7) { Value = datos.FechaEmisionDocumento }; Parameter[7] = new SqlParameter("@Email", SqlDbType.NVarChar, 50) { Value = datos.Email }; Parameter[8] = new SqlParameter("@IdTipoOperador", SqlDbType.Int) { Value = datos.IdTipoOperador }; Parameter[9] = new SqlParameter("@NumeroMovil", SqlDbType.NVarChar, 20) { Value = datos.NumeroMovil }; Parameter[10] = new SqlParameter("@IMEI", SqlDbType.NVarChar, 50) { Value = "0000000000000000000000000000" }; Parameter[11] = new SqlParameter("@FechaNacimiento", SqlDbType.Date) { Value = datos.FechaNacimiento }; Parameter[12] = new SqlParameter("@IdEstadoCivil", SqlDbType.Int) { Value = datos.IdEstadoCivil }; Parameter[13] = new SqlParameter("@Genero", SqlDbType.Bit) { Value = 1 }; //datos.Genero }; Parameter[14] = new SqlParameter("@RecibeBoletin", SqlDbType.Bit) { Value = datos.RecibeBoletin }; Parameter[15] = new SqlParameter("@AceptaPolitica", SqlDbType.Bit) { Value = datos.AceptaPolitica }; Parameter[16] = new SqlParameter("@RecibeTarjeta", SqlDbType.Bit) { Value = datos.RecibeTarjeta }; Parameter[17] = new SqlParameter("@IdTipoCanalAfiliacion", SqlDbType.Int) { Value = 1 }; Parameter[18] = new SqlParameter("@IdTipoEnvioTarjeta", SqlDbType.Int) { Value = 1 }; Parameter[19] = new SqlParameter("@IdStand", SqlDbType.Int) { Value = 1 }; Parameter[20] = new SqlParameter("@Ubigeo", SqlDbType.NVarChar, 6) { Value = datos.IdDepartamento + datos.IdProvincia + datos.IdDistrito }; Parameter[21] = new SqlParameter("@IdTipoDireccion", SqlDbType.Int) { Value = datos.IdTipoDireccion }; Parameter[22] = new SqlParameter("@IdPrefijoDireccion", SqlDbType.Int) { Value = 1 }; Parameter[23] = new SqlParameter("@Direccion", SqlDbType.NVarChar, 100) { Value = datos.Direccion }; Parameter[24] = new SqlParameter("@Referencia", SqlDbType.NVarChar, 100) { Value = datos.Referencia }; Parameter[25] = new SqlParameter("@TelefonoFijo", SqlDbType.NVarChar, 15) { Value = "000000" }; Parameter[26] = new SqlParameter("@RangoDiasEntrega", SqlDbType.NVarChar, 20) { Value = datos.RangoDiasEntrega }; Parameter[27] = new SqlParameter("@RangoHorasEntrega", SqlDbType.NVarChar, 20) { Value = datos.RangoHorasEntrega }; Parameter[28] = new SqlParameter("@ConfirmoMovil", SqlDbType.Bit) { Value = 0 }; Parameter[29] = new SqlParameter("@ConfirmoEmail", SqlDbType.Bit) { Value = 0 }; Parameter[30] = new SqlParameter("@CodigoConfirmacionMovil", SqlDbType.NVarChar, 10) { Value = "" }; Parameter[31] = new SqlParameter("@CodigoConfirmacionEmail", SqlDbType.NVarChar, 10) { Value = "" }; Parameter[32] = new SqlParameter("@NumeroReenvioPin", SqlDbType.Int) { Value = 0 }; Parameter[33] = new SqlParameter("@PasswordHash", SqlDbType.NVarChar, 200) { Value = datos.PasswordHash }; Parameter[34] = new SqlParameter("@NumeroIntentosFallidos", SqlDbType.Int) { Value = datos.NumeroIntentosFallidos }; Parameter[35] = new SqlParameter("@NumeroIntentosFallidosReenvio", SqlDbType.Int) { Value = datos.NumeroIntentosFallidosReenvio }; Parameter[36] = new SqlParameter("@CodigoAfiliacion", SqlDbType.UniqueIdentifier, 200) { Value = datos.CodigoAfiliacion }; // "6F9619FF-8B86-D011-B42D-00C04FC964FF" };//datos.CodigoAfiliacion}; //Parameter[37] = new SqlParameter("@FechaRegistro", SqlDbType.NVarChar, 2) { Value = }; //Parameter[38] = new SqlParameter("@FechaModificacion", SqlDbType.NVarChar, 2) { Value = }; //Parameter[39] = new SqlParameter("@IdReferido", SqlDbType.NVarChar, 2) { Value = }; Parameter[37] = new SqlParameter("@Usuario", SqlDbType.NVarChar, 20) { Value = datos.Nombres + datos.ApellidoPaterno }; Parameter[38] = new SqlParameter("@Respuesta", SqlDbType.NVarChar, 200) { Direction = ParameterDirection.Output }; Parameter[39] = new SqlParameter("@Error", SqlDbType.Bit) { Direction = ParameterDirection.Output }; using (SqlDataReader read = SqlHelper.ExecuteReader(conexion, CommandType.StoredProcedure, "dbo.Insertar_ClienteTemp", Parameter)) { while (read.Read()) { mensaje = new BEParametro(); //read.NextResult(); mensaje.iConstante = read.GetInt32(read.GetOrdinal("IdClienteTmp")); mensaje.xDescripcion = read.GetString(read.GetOrdinal("MENSAJE")); mensaje.lDatoInt = read.GetBoolean(read.GetOrdinal("Error")); } } return(mensaje); } catch (Exception ex) { mensaje = new BEParametro(); mensaje.xDescripcion = ex.ToString(); return(mensaje); throw ex; } }
public BEParametro insertar_clienteTemp(BEClienteTmp datosAfilia, string conecta) { return(new DAafiliacion().insertar_clienteTemp(datosAfilia, conecta)); }