예제 #1
0
 public List<entReserva> ListarReservaDelDia(String nroDocumento)
 {
     SqlCommand cmd = null;
     SqlDataReader dr = null;
     List<entReserva> Lista = null;
     try
     {
         SqlConnection conex = Conexion.Instancia.Conectar();
         cmd = new SqlCommand("spListarReservasDelDia", conex);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@prmNroDoc", nroDocumento);
         conex.Open();
         dr = cmd.ExecuteReader();
         Lista = new List<entReserva>();
         while (dr.Read())
         {
             entReserva r = new entReserva();
             entPersona p = new entPersona();
             r.IdReserva = Convert.ToInt32(dr["IDRESERVA"]);
             p.IdPersona = Convert.ToInt32(dr["IDPERSONA"]);
             r.Persona = p;
             r.EstadoReserva = Convert.ToChar(dr["ESTADORESERVA"]);
             r.FechaReserva = Convert.ToDateTime(dr["FECHARESERVA"]);
             r.FechaEntrada = Convert.ToDateTime(dr["FECHAENTRADA"]);
             r.FechaSalida = Convert.ToDateTime(dr["FECHASALIDA"]);
             r.NroNoches = Convert.ToInt32(dr["NRONOCHES"]);
             r.MontoPagado = Convert.ToDouble(dr["MONTOPAGADO"]);
             r.Saldo = Convert.ToDouble(dr["SALDO"]);
             Lista.Add(r);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         cmd.Connection.Close();
     }
     return Lista;
 }
예제 #2
0
 public List<entReserva> ListarHistorialReservas(int idCliente)
 {
     SqlCommand cmd = null;
     SqlDataReader dr = null;
     List<entReserva> Lista = null;
     try
     {
         SqlConnection conex = Conexion.Instancia.Conectar();
         cmd = new SqlCommand("spListarHistorialReserva", conex);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@prmIdPersona", idCliente);
         conex.Open();
         dr = cmd.ExecuteReader();
         Lista = new List<entReserva>();
         while (dr.Read())
         {
             entReserva r = new entReserva();
             r.IdReserva = Convert.ToInt32(dr["IDRESERVA"]);
             r.FechaEntrada = Convert.ToDateTime(dr["FECHAENTRADA"]);
             r.FechaSalida = Convert.ToDateTime(dr["FECHASALIDA"]);
             r.MontoPagado = Convert.ToDouble(dr["MONTOPAGADO"]);
             r.Saldo = Convert.ToDouble(dr["SALDO"]);
             r.Total = Convert.ToDouble(dr["TOTAL"]);
             Lista.Add(r);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         cmd.Connection.Close();
     }
     return Lista;
 }