Exemple #1
0
        public HttpResponseMessage GetTipos()
        {
            TipoDal d      = new TipoDal();
            var     result = d.Listar().OrderBy(m => m.Nome);

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
        public ActionResult Index(string tipo, string marca, int?ai, int?af, int?pagina)
        {
            try
            {
                var    e          = this.RouteData.Values;
                string actionName = (string)e["action"];

                ViewBag.Action     = actionName;
                ViewBag.Pagina     = pagina;
                ViewBag.MarcaF     = marca;
                ViewBag.TipoF      = tipo;
                ViewBag.AnoInicioF = ai;
                ViewBag.AnoFimF    = af;
                Diretorios();

                TipoDal td = new TipoDal();
                ViewBag.Tipo = td.Listar();

                //var lista = veiculoDal.ListarByFilto(tipo, marca, ai, af);
                Random rnd = new Random();
                IOrderedEnumerable <Veiculo> lista = veiculoDal.ListarByFilto(tipo, marca, ai, af, Constantes.IDEMPRESA).AsEnumerable().OrderBy((i => rnd.Next()));
                int paginaTamanho = 12;
                int paginaNumero  = (pagina ?? 1);

                Aviso();
                return(View(lista.ToPagedList(paginaNumero, paginaTamanho)));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
 public VeiculosController()
 {
     veiculoDal   = new VeiculoDal();
     tipoDal      = new TipoDal();
     arquivodal   = new ArquivoDal();
     marcaDal     = new MarcaDal();
     anoModeloDal = new AnoModeloDal();
 }
Exemple #4
0
 public VeiculosController()
 {
     veiculoDal     = new VeiculoDal();
     combustivelDal = new CombustivelDal();
     tipoDal        = new TipoDal();
     anoModeloDal   = new AnoModeloDal();
     marcaDal       = new MarcaDal();
     arquivoDal     = new ArquivoDal();
     empresaDal     = new EmpresaDal();
 }
        public ActionResult Index(string q, int?pagina, string so, string cs, int?pt)
        {
            Aviso();
            TipoDal d = new TipoDal();

            ViewBag.Tipo = d.Listar();
            if (q == null)
            {
                q = "";
            }

            var lista         = marcaDal.Listar(null).Where(x => x.Nome.ToLower().Contains(q.ToLower()));
            int paginaTamanho = (pt ?? 10);
            int paginaNumero  = (pagina ?? 1);

            ViewBag.Action        = ActionCorrente();
            ViewBag.Pagina        = pagina;
            ViewBag.PaginaTamanho = pt;
            ViewBag.CurrentSort   = so;
            ViewBag.SortOrder     = so;
            ViewBag.Query         = q;


            switch (so)
            {
            case "marca":

                if (so.Equals(cs))
                {
                    return(View(lista.OrderByDescending(x => x.Nome).ToPagedList(paginaNumero, paginaTamanho)));
                }
                else
                {
                    return(View(lista.OrderBy(x => x.Nome).ToPagedList(paginaNumero, paginaTamanho)));
                }
                break;

            case "tipo":

                if (so.Equals(cs))
                {
                    return(View(lista.OrderByDescending(x => x.Tipo.Nome).ToPagedList(paginaNumero, paginaTamanho)));
                }
                else
                {
                    return(View(lista.OrderBy(x => x.Tipo.Nome).ToPagedList(paginaNumero, paginaTamanho)));
                }
                break;

            default:
                return(View(lista.ToPagedList(paginaNumero, paginaTamanho)));

                break;
            }
        }
Exemple #6
0
        public static Tipo Get(int id)
        {
            Tipo tipo = null;

            try
            {
                tipo = TipoDal.Get(id);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(tipo);
        }
        public ActionResult Index()
        {
            try
            {
                //BannerDal d = new BannerDal();
                //List<Banner> banners = d.Listar(true);

                Helpers.RegistraLogDeAcesso("HOME");

                //string versao_frame;
                //int arq_bits;
                //arq_bits = IntPtr.Size * 8;
                //versao_frame = Environment.Version.ToString();

                //ViewBag.Mensagem = "Sua hospedagem está configurada em: " + arq_bits + " bits" + "Sua hospedagem está configurada para utilizar o framework: " + versao_frame;

                Diretorios();
                TipoDal td = new TipoDal();
                ViewBag.Tipo = td.Listar();
                MarcaDal mdc = new MarcaDal();
                ViewBag.MarcaCarro = mdc.ListarByTipo("carro", true);
                MarcaDal mdm = new MarcaDal();
                ViewBag.MarcaMoto = mdm.ListarByTipo("moto", true);

                Random     rnd = new Random();
                VeiculoDal vd  = new VeiculoDal();
                IOrderedEnumerable <Veiculo> Items = vd.Listar(null, true).AsEnumerable().OrderBy((i => rnd.Next()));
                //List<Veiculo> Itens2 = new List<Veiculo>();
                //Itens2 = vd.Listar(null, true);
                ViewBag.Popular = Items.Where(x => x.Arquivo.Nome != "_semfoto.jpg").Where(x => x.Destaque == true).Take(4);

                //return View(banners);
                return(View());
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #8
0
        public static List <Tipo> Get()
        {
            List <Tipo> tipoLIst = null;

            try
            {
                tipoLIst = TipoDal.GetList();
            }
            catch (SqlException ex)
            {
                Methods.GenerateLogsRelease("TipoBrl", "ListTipo",
                                            string.Format("{0} {1} Error: {2}", DateTime.Now.ToShortDateString(),
                                                          DateTime.Now.ToShortTimeString(), ex.Message));
                throw ex;
            }
            catch (Exception ex)
            {
                Methods.GenerateLogsRelease("TipoBrl", "LisTipo", string.Format("{0} {1} Error: {2}",
                                                                                DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), ex.Message));
                throw ex;
            }
            return(tipoLIst);
        }
        public ActionResult Index()
        {
            try
            {
                TipoDal td = new TipoDal();
                ViewBag.Tipo = td.Listar();
                MarcaDal mdc = new MarcaDal();
                ViewBag.MarcaCarro = mdc.ListarByTipo("carro", true, Constantes.IDEMPRESA);
                MarcaDal mdm = new MarcaDal();
                ViewBag.MarcaMoto = mdm.ListarByTipo("moto", true, Constantes.IDEMPRESA);
                Diretorios();

                Random     rnd = new Random();
                VeiculoDal vd  = new VeiculoDal();
                IOrderedEnumerable <Veiculo> Items = vd.Listar(null, true, Constantes.IDEMPRESA).AsEnumerable().OrderBy((i => rnd.Next()));
                ViewBag.Popular = Items.Where(x => x.Arquivo.Nome != "_semfoto.jpg").Where(x => x.Destaque == true).Take(4);
            }
            catch (Exception)
            {
                throw;
            }

            return(View());
        }