private void Button_Click(object sender, RoutedEventArgs e) { try { Conexion Conectar = new Conexion(); Conectar.Abrir(); string comando = "SELECT * FROM CLIENTES WHERE ID_CLIENTE=@DOC"; SqlCommand cmd = new SqlCommand(comando, Conectar.Conectarbd); cmd.Parameters.AddWithValue("@DOC", Convert.ToInt64(NroDocumento.Text)); SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { string Nombre = read["NOMBRE"].ToString(); string Apellido = read["APELLIDO"].ToString(); string Telefono = read["TELEFONO"].ToString(); string Direccion = read["DIRECCION"].ToString(); string Genero = read["GENERO"].ToString(); string TipoDoc = read["DOC_CLIENTE"].ToString(); string Estatura = read["ESTATURA_IN"].ToString(); textNombre.Text = Nombre; textApellido.Text = Apellido; textDireccion.Text = Direccion; textTelefono.Text = Telefono; textGenero.Text = Genero; textTipoDoc.Text = TipoDoc; textEstatura.Text = Estatura; } Conectar.Cerrar(); string FechaHoy = DateTime.Now.ToString("yyyy-MM-dd"); DateTime FechaH = Convert.ToDateTime(FechaHoy); string comando2 = "SELECT * FROM INGRESOS WHERE FECHA_INGRE = (SELECT MAX(FECHA_INGRE) FROM INGRESOS WHERE DOC_CLIENTE = @DOC) AND DOC_CLIENTE = @DOC"; Conectar.Abrir(); SqlCommand cmd2 = new SqlCommand(comando2, Conectar.Conectarbd); cmd2.Parameters.AddWithValue("@DOC", Convert.ToInt64(NroDocumento.Text)); SqlDataReader LFecha = cmd2.ExecuteReader(); while (LFecha.Read()) { string FechaUlt = LFecha["FECHA_INICIO"].ToString(); string FechaUlti2 = LFecha["FECHA_INGRE"].ToString(); string TipoPago = LFecha["TIPO_INGRE"].ToString(); //textUlyimoPago.Text = LFecha["FECHA_INGRE"].ToString(); DateTime fecha = Convert.ToDateTime(FechaUlt); textTipoPago.Text = TipoPago; textUlyimoPago.Text = FechaUlti2; DateTime FechaVen; Console.WriteLine(TipoPago); if (TipoPago == "Mensual ") { FechaVen = fecha.AddMonths(1); TOTAL = 1; } else { if (TipoPago == "Quincenal ") { FechaVen = fecha.AddDays(15); TOTAL = 2; } else { if (TipoPago == "Semanal ") { FechaVen = fecha.AddDays(7); TOTAL = 3; } else { if (TipoPago == "Diario ") { FechaVen = fecha.AddDays(1); TOTAL = 4; } else { if (TipoPago == "2 Meses ") { FechaVen = fecha.AddMonths(2); TOTAL = 5; } else { if (TipoPago == "3 Meses ") { FechaVen = fecha.AddMonths(3); TOTAL = 6; } else { if (TipoPago == "6 Meses ") { FechaVen = fecha.AddMonths(3); TOTAL = 7; } else { if (TipoPago == "Anual ") { FechaVen = fecha.AddYears(1); TOTAL = 8; } else { FechaVen = fecha; } } } } } } } } pTPago = FechaVen.ToString("yyyy-MM-dd"); if (FechaVen > FechaH) { textEstado.Text = "ACTIVO"; } else { textEstado.Text = "VENCIDO"; } Console.WriteLine(FechaVen); Console.WriteLine(FechaH); } Conectar.Cerrar(); } catch (Exception exe) { MessageBox.Show(exe.ToString()); } try { ConexionHuella conexionHuella = new ConexionHuella(); conexionHuella.Abrir(); string comando = "SELECT * FROM HUELLASCLIENTES WHERE ID=@ID"; SqlCommand cmd = new SqlCommand(comando, conexionHuella.Conectarbd); cmd.Parameters.AddWithValue("@ID", Convert.ToInt64(NroDocumento.Text)); SqlDataReader reader = cmd.ExecuteReader(); int ok = 0; while (reader.Read()) { ok = ok + 1; } if (ok == 1) { button6.Visibility = Visibility.Visible; button6_Copy.Visibility = Visibility.Collapsed; } else { button6_Copy.Visibility = Visibility.Visible; button6.Visibility = Visibility.Collapsed; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }