Esempio n. 1
0
        public ActionResult Pipa(int?page)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            string _tkn = Session["StringToken"].ToString();

            ViewBag.EsSuperUser = TokenServicio.ObtenerEsSuperUsuario(_tkn);
            var Pagina = page ?? 1;

            if (ViewBag.EsSuperUser)
            {
                ViewBag.Empresas    = CatalogoServicio.Empresas(_tkn);
                ViewBag.CajaGeneral = VentasServicio.ListaVentasCajaGral(_tkn, "").ToPagedList(Pagina, 20);
            }
            else
            {
                ViewBag.Empresas = CatalogoServicio.Empresas(_tkn).SingleOrDefault(x => x.IdEmpresa.Equals(TokenServicio.ObtenerIdEmpresa(_tkn))).NombreComercial;
                ViewBag.ListaPV  = CatalogoServicio.ListaPrecioVentaIdEmpresa(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn).ToPagedList(Pagina, 20);
            }

            if (TempData["RespuestaDTO"] != null)
            {
                ViewBag.MessageExito = TempData["RespuestaDTO"];
            }
            if (TempData["RespuestaDTOError"] != null)
            {
                ViewBag.MessageError = TempData["RespuestaDTOError"];
            }

            ViewBag.MessageError = TempData["RespuestaDTOError"];

            return(View());
        }
Esempio n. 2
0
        // GET: CajaGeneral
        public ActionResult Index(int?page)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            string _tkn = Session["StringToken"].ToString();

            var Pagina = page ?? 1;

            ViewBag.CboxEntidad = VentasServicio.ListaVentasCajaGral(_tkn, "Entidad").Select(x => x.PuntoVenta).Distinct();

            ViewBag.CboxConcepto = VentasServicio.ListaVentasCajaGral(_tkn, "").Select(x => x.Concepto).Distinct();
            ViewBag.EsAdmin      = TokenServicio.ObtenerEsAdministracionCentral(_tkn);
            if (ViewBag.EsAdmin)
            {
                ViewBag.Empresas    = CatalogoServicio.Empresas(_tkn);
                ViewBag.CajaGeneral = VentasServicio.ListaVentasCajaGral(_tkn, "").OrderByDescending(x => x.FechaAplicacion).ToPagedList(Pagina, 20);//.OrderByDescending(y => y.Orden).ToList();
            }
            else
            {
                ViewBag.Empresas    = CatalogoServicio.Empresas(_tkn).SingleOrDefault().NombreComercial;
                ViewBag.CajaGeneral = VentasServicio.ListaVentasCajaGralId(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn).OrderByDescending(x => x.FechaAplicacion).OrderByDescending(y => y.Orden).ToList().ToPagedList(Pagina, 20);
            }

            if (TempData["RespuestaDTO"] != null)
            {
                ViewBag.MessageExito = TempData["RespuestaDTO"];
            }
            if (TempData["RespuestaDTOError"] != null)
            {
                ViewBag.MensajeError          = Validar((RespuestaDTO)TempData["RespuestaDTOError"]);
                TempData["RespuestaDTOError"] = ViewBag.MessageError;
            }
            ViewBag.MessageError = TempData["RespuestaDTOError"];

            return(View());
        }