public ActionResult DeleteConfirmed(int id)
        {
            TipoCoche tipoCoche = db.TipoCoche.Find(id);

            db.TipoCoche.Remove(tipoCoche);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public TipoCocheVo(TipoCoche tipoCoche)
 {
     Id          = tipoCoche.Id;
     IconUrl     = tipoCoche.IconoDefault != null ? tipoCoche.IconoDefault.PathIcono : string.Empty;
     Codigo      = tipoCoche.Codigo;
     Descripcion = tipoCoche.Descripcion;
     Empresa     = tipoCoche.Empresa != null ? tipoCoche.Empresa.RazonSocial : string.Empty;
     Linea       = tipoCoche.Linea != null ? tipoCoche.Linea.Descripcion : string.Empty;
 }
 public ActionResult Edit([Bind(Include = "IdTipoCoche,NombreTipo")] TipoCoche tipoCoche)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tipoCoche).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoCoche));
 }
Exemplo n.º 4
0
 private static void SetMobileDefaultValues(Coche mobile, Linea linea, TipoCoche tipo)
 {
     mobile.Empresa           = linea.Empresa;
     mobile.Linea             = linea;
     mobile.TipoCoche         = tipo;
     mobile.Marca.Descripcion = mobile.Marca != null ? mobile.Marca.Descripcion : String.Empty;
     mobile.ModeloDescripcion = mobile.Modelo != null ? mobile.Modelo.Descripcion : String.Empty;
     mobile.NroChasis         = mobile.NroChasis ?? String.Empty;
     mobile.NroMotor          = mobile.NroMotor ?? String.Empty;
     mobile.Poliza            = mobile.Poliza ?? String.Empty;
 }
        public ActionResult Create([Bind(Include = "IdTipoCoche,NombreTipo")] TipoCoche tipoCoche)
        {
            if (ModelState.IsValid)
            {
                db.TipoCoche.Add(tipoCoche);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tipoCoche));
        }
Exemplo n.º 6
0
        public IEnumerable <MobileEvent> GetMobilesEventsByDistritoBase(int distritoId, int baseId)
        {
            LogMensaje log     = null;
            Coche      coche   = null;
            TipoCoche  tCoche  = null;
            Empleado   chofer  = null;
            Mensaje    mensaje = null;

            var q = NHibernate.SessionHelper.Current
                    .QueryOver(() => log)
                    .Inner.JoinAlias(() => log.Coche, () => coche)
                    .Inner.JoinAlias(() => coche.TipoCoche, () => tCoche)
                    .Inner.JoinAlias(() => log.Chofer, () => chofer)
                    .Inner.JoinAlias(() => log.Mensaje, () => mensaje)
                    .Where(() => log.Estado > 0)
                    .Select(Projections.ProjectionList()
                            .Add(Projections.Property(() => coche.Interno).As("Intern"))
                            .Add(Projections.Property(() => tCoche.Descripcion).As("MobileType"))
                            .Add(Projections.Property(() => chofer.Entidad.Descripcion).As("Driver"))
                            //.Add(Projections.Property(() => log.Fecha.ToDisplayDateTime()).As("EventTime"))
                            //.Add(Projections.Property(() => log.FechaAlta.HasValue ? log.FechaAlta.Value.ToDisplayDateTime() : (DateTime?)null).As("Reception"))
                            .Add(Projections.Property(() => log.Texto).As("Message"))
                            .Add(Projections.Property(() => mensaje.Id).As("IdMensaje"))
                            .Add(Projections.Property(() => log.Latitud).As("Latitude"))
                            .Add(Projections.Property(() => log.Longitud).As("Longitude"))
                            //.Add(Projections.Property(() => log.GetIconUrl()).As("IconUrl"))
                            //.Add(Projections.Property(() => log.FechaFin != null ? log.FechaFin.Value.ToDisplayDateTime() : log.FechaFin).As("EventEndTime"))
                            .Add(Projections.Property(() => log.LatitudFin).As("FinalLatitude"))
                            .Add(Projections.Property(() => log.LongitudFin).As("FinalLongitude"))
                            .Add(Projections.Property(() => log.Id).As("Id"))
                            .Add(Projections.Property(() => coche.Chofer.Entidad.Descripcion).As("Responsable"))
                            .Add(Projections.Property(() => log.TieneFoto).As("TieneFoto"))
                            .Add(Projections.Property(() => log.IdPuntoDeInteres).As("IdPuntoInteres"))
                            .Add(Projections.Property(() => log.Estado).As("Atendido"))
                            .Add(Projections.Property(() => log.Usuario).As("Usuario"))
                            //.Add(Projections.Property(() => log.Estado > 0 ? DAOFactory.AtencionEventoDAO.GetByEvento(log.Id) : null).As("AtencionEvento"))
                            );

            if (distritoId != -1)
            {
                q = q.Where(m => coche.Empresa.Id == distritoId);
            }

            if (baseId != -1)
            {
                q = q.Where(m => coche.Linea.Id == baseId);
            }

            q = q.TransformUsing(Transformers.AliasToBean <MobileEvent>());

            return(q.Future <MobileEvent>());
        }
        // GET: TipoCoches/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TipoCoche tipoCoche = db.TipoCoche.Find(id);

            if (tipoCoche == null)
            {
                return(HttpNotFound());
            }
            return(View(tipoCoche));
        }
Exemplo n.º 8
0
 public virtual int GetVelocidadMaxima(TipoCoche tipoCoche)
 {
     return(GetVelocidadMaxima(tipoCoche.Id));
 }