示例#1
0
 private Automovil MapearAutomovil(DataTable data_table)
 {
     try
     {
         foreach (DataRow row in data_table.Rows)
         {
             Marca  marca_mapper  = new Marca();
             Turno  turno_mapper  = new Turno();
             Chofer chofer_mapper = new Chofer();
             return(new Automovil
             {
                 id = (int)row.ItemArray[0],
                 marca = marca_mapper.Mapear((int)row.ItemArray[1]),
                 modelo = row.ItemArray[2].ToString(),
                 patente = row.ItemArray[3].ToString(),
                 turno = turno_mapper.Mapear((int)row.ItemArray[4]),
                 chofer = chofer_mapper.Mapear((int)row.ItemArray[5]),
                 habilitado = (bool)row.ItemArray[6]
             });
         }
         throw new Exception("Hubo un error al mapear el automovil");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
示例#2
0
 private Viaje MapearViaje(DataTable data_table)
 {
     try
     {
         Automovil automovil_mapper = new Automovil();
         Chofer    chofer_mapper    = new Chofer();
         Turno     turno_mapper     = new Turno();
         Cliente   cliente_mapper   = new Cliente();
         foreach (DataRow row in data_table.Rows)
         {
             return(new Viaje
             {
                 id = Convert.ToInt32(row.ItemArray[0]),
                 automovil = automovil_mapper.Mapear(Convert.ToInt32(row.ItemArray[1])),
                 chofer = chofer_mapper.Mapear(Convert.ToInt32(row.ItemArray[2])),
                 turno = turno_mapper.Mapear(Convert.ToInt32(row.ItemArray[3])),
                 cantidad_kilometros = Convert.ToInt32(row.ItemArray[4]),
                 fecha_inicio = Convert.ToDateTime(row.ItemArray[5]),
                 fecha_fin = Convert.ToDateTime(row.ItemArray[6]),
                 cliente = cliente_mapper.Mapear(Convert.ToInt32(row.ItemArray[7]))
             });
         }
         throw new Exception("Hubo un error al mapear el viaje");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
示例#3
0
 private Rendicion MapearRendicion(DataTable data_table)
 {
     try
     {
         foreach (DataRow row in data_table.Rows)
         {
             Chofer chofer_mapper = new Chofer();
             Turno  turno_mapper  = new Turno();
             Viaje  viaje_mapper  = new Viaje();
             return(new Rendicion
             {
                 id = (int)row.ItemArray[0],
                 fecha = Convert.ToDateTime(row.ItemArray[1]),
                 chofer = chofer_mapper.Mapear((int)row.ItemArray[2]),
                 turno = turno_mapper.Mapear((int)row.ItemArray[3]),
                 importe = Convert.ToDecimal(row.ItemArray[4]),
                 viajes = new List <Viaje>()
             });
         }
         throw new Exception("Hubo un error al mapear la rendicion");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
示例#4
0
 public List <Chofer> ObtenerChoferes()
 {
     try
     {
         List <Chofer> choferes           = new List <Chofer>();
         Conexion      conexion           = new Conexion();
         SqlCommand    store_procedure    = conexion.IniciarStoreProcedure("sp_obtener_choferes");
         DataTable     respuesta_consulta = conexion.EjecutarConsultar(store_procedure);
         Chofer        chofer_mapper      = new Chofer();
         foreach (DataRow row in respuesta_consulta.Rows)
         {
             choferes.Add(chofer_mapper.Mapear(Convert.ToInt32(row.ItemArray[0])));
         }
         return(choferes);
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }