public void LeerPagoEnc(PagosEnc p) { Limpiar(p); string sql = "select*from PagosEnc where FolioContrato=@Folio and NoMensualidad=@Mensualidad and NoArregloM=@Arreglo and Pagado='True'"; using (SqlConnection con = new SqlConnection(cx.cadenaConexion)) { con.Open(); using (SqlCommand comando = new SqlCommand(sql, con)) { comando.Parameters.Add("@Folio", SqlDbType.Int).Value = p.FolioContrato; comando.Parameters.Add("@Mensualidad", SqlDbType.Int).Value = p.NoMensualidad; comando.Parameters.Add("@Arreglo", SqlDbType.Int).Value = p.NoArregloM; using (SqlDataReader reader = comando.ExecuteReader()) { while (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) { p[reader.GetName(i)] = reader.IsDBNull(i) ? cx.getNullValue(p[reader.GetName(i)]) : reader.GetValue(i); } } } con.Close(); } } }
private void Limpiar(PagosEnc p) { //FolioContrato = 0; //NoArregloM = 0; //NoMensualidad = 0; ImporteMensualidad = 0; ImporteCapital = 0; ImporteInteres = 0; PorDsctoCapital = 0; ImporteDsctoCapital = 0; PorDsctoInteres = 0; ImporteDsctoInteres = 0; FechaVencimiento = Convert.ToDateTime("01/01/50"); Saldo = 0; SaldoCapital = 0; SaldoInteres = 0; Pagado = "false"; InteresCondonado = 0; FechaPago = Convert.ToDateTime("01/01/50"); Adelantada = "false"; }