Exemple #1
0
 public List <Turno> ObtenerTurnos()
 {
     try
     {
         List <Turno> turnos             = new List <Turno>();
         Conexion     conexion           = new Conexion();
         SqlCommand   store_procedure    = conexion.IniciarStoreProcedure("sp_obtener_turnos");
         DataTable    respuesta_consulta = conexion.EjecutarConsultar(store_procedure);
         Turno        turno_mapper       = new Turno();
         foreach (DataRow row in respuesta_consulta.Rows)
         {
             turnos.Add(turno_mapper.Mapear(Convert.ToInt32(row.ItemArray[0])));
         }
         return(turnos);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
Exemple #2
0
 public Rendicion Mapear(DateTime fecha, Chofer chofer, Turno turno)
 {
     try
     {
         Conexion   conexion        = new Conexion();
         SqlCommand store_procedure = conexion.IniciarStoreProcedure("sp_obtener_rendicion");
         store_procedure.Parameters.Add(new SqlParameter("@fecha", fecha));
         store_procedure.Parameters.Add(new SqlParameter("@chofer", chofer.id));
         store_procedure.Parameters.Add(new SqlParameter("@turno", turno.id));
         DataTable respuesta_consulta = conexion.EjecutarConsultar(store_procedure);
         if (respuesta_consulta.Rows.Count == 0)
         {
             throw new Exception("Rendicion no encontrada");
         }
         return(MapearRendicion(respuesta_consulta));
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }