Exemplo n.º 1
0
        /// <summary>
        /// Gets mobile maintenance aggregat data for the specified vehicles.
        /// </summary>
        /// <param name="desde"></param>
        /// <param name="hasta"></param>
        /// <param name="vehiculos"></param>
        /// <returns></returns>
        public IEnumerable <MobileMaintenance> GetMobileMaintenanceData(DateTime desde, DateTime hasta, IEnumerable <Coche> vehiculos)
        {
            MobileMaintenance mm = null;

            int[] ids = vehiculos.Select(c => c.Id).ToArray();

            DetachedCriteria dc = GetDatamartDetachedCriteria(ids).FilterBeginBetween(desde, hasta);

            ProjectionList pl = Projections.ProjectionList();

            pl.Add(Projections.Sum <Datamart>(dm => dm.MovementHours).WithAlias(() => mm.HsMarcha));
            pl.Add(Projections.Sum <Datamart>(dm => dm.Kilometers).WithAlias(() => mm.Kilometros));
            pl.Add(Projections.Group <Datamart>(dm => dm.Vehicle.Id).WithAlias(() => mm.IdVehiculo));

            ICriteria crit = GetDatamartCriteria(0, dc, pl, null, typeof(MobileMaintenance));
            IList <MobileMaintenance> results = crit.List <MobileMaintenance>();

            var cocheDAO = new CocheDAO();

            foreach (MobileMaintenance r in results)
            {
                Coche coche = cocheDAO.FindById(r.IdVehiculo);
                r.Interno      = coche.Interno;
                r.TipoVehiculo = coche.TipoCoche != null ? coche.TipoCoche.Descripcion : null;
                r.Patente      = coche.Patente;
                r.Referencia   = coche.Referencia;
            }
            return(results);
        }
Exemplo n.º 2
0
 public MobileManteinanceVo(MobileMaintenance t)
 {
     TipoVehiculo = t.TipoVehiculo;
     Interno      = t.Interno;
     Patente      = t.Patente;
     Referencia   = t.Referencia;
     Kilometros   = t.Kilometros;
     HorasMarcha  = t.HorasMarcha;
     HorasPlanta  = t.HorasPlanta;
     HorasTaller  = t.HorasTaller;
 }