Ejemplo n.º 1
0
        public ActionResult Nuevo(RegistrarPedidoModel _model = null, string msj = null)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            string _tkn = Session["StringToken"].ToString();

            ViewBag.Estatus = PedidosServicio.ObtenerEstatusPedidos(_tkn).ToList();
            //if (TempData["Mod"] != null)
            //{
            //    _model = (PedidoModel)TempData["Mod"];
            //}
            ViewBag.Unidades = AgregarTUnidades();
            if (TempData["RespuestaDTO"] != null)
            {
                if (!((RespuestaDTO)TempData["RespuestaDTO"]).Exito)
                {
                    ViewBag.MensajeError = Validar((RespuestaDTO)TempData["RespuestaDTO"]);
                }
                else
                {
                    ViewBag.Msj = TempData["RespuestaDTO"];
                }
            }
            if (msj != "" || msj != null)
            {
                ViewBag.MensajeError = msj;
            }
            return(View(_model));
        }
Ejemplo n.º 2
0
 public ActionResult InventarioXPuntoVenta(InventarioPorPuntoVentaModel model = null)
 {
     if (Session["StringToken"] == null)
     {
         return(RedirectToAction("Index", "Home"));
     }
     tkn = Session["StringToken"].ToString();
     if (TempData["DataSource"] != null)
     {
         TempData["DataSource"] = null;
     }
     if (model == null)
     {
         model = new InventarioPorPuntoVentaModel();
     }
     model.Pipas      = PedidosServicio.ObtenerPipas(TokenServicio.ObtenerIdEmpresa(tkn), tkn).Select(x => { x.Activo = false; return(x); }).ToList();
     model.Estaciones = CatalogoServicio.GetListaEstacionCarburacion(tkn).Select(x => { x.Activo = false; return(x); }).ToList();
     if (model != null && !model.Fecha.Equals(DateTime.MinValue))
     {
         ViewData["Periodo"]    = model.Fecha;
         ViewData["Reporte"]    = TiposReporteConst.InventarioPorPuntoVenta;
         TempData["DataSource"] = ReporteServicio.BuscarInventarioPorPuntoVenta(model, tkn);
     }
     return(View(model));
 }
Ejemplo n.º 3
0
        public ActionResult _Pipas(ClientesModel _model)
        {
            _tkn = Session["StringToken"].ToString();
            var Id  = TokenServicio.ObtenerIdEmpresa(_tkn);
            var lst = PedidosServicio.ObtenerPipas(Id, _tkn);

            return(PartialView(lst));
        }
Ejemplo n.º 4
0
        // GET: Pedidos
        public ActionResult Index(int?idpedido, string msj = null, string tel1 = null, string rfc = null)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            _tkn = Session["StringToken"].ToString();
            if (!string.IsNullOrEmpty(msj))
            {
                ViewBag.Msj = msj; ViewBag.Tipo = "alert-success";
            }

            if (TempData["RespuestaDTO"] != null)
            {
                if (!((RespuestaDTO)TempData["RespuestaDTO"]).Exito)
                {
                    ViewBag.Tipo             = "alert-danger";
                    ViewBag.MensajeError     = Validar((RespuestaDTO)TempData["RespuestaDTO"]);
                    TempData["RespuestaDTO"] = ViewBag.MensajeError;
                    ViewBag.MensajeError     = TempData["RespuestaDTO"];
                }
                else
                {
                    ViewBag.Tipo = "alert-success";
                }
            }
            ViewBag.EsAdmin = TokenServicio.ObtenerEsAdministracionCentral(_tkn);
            if (ViewBag.EsAdmin)
            {
                ViewBag.Empresas = CatalogoServicio.Empresas(_tkn);
            }
            else
            {
                ViewBag.Empresas = CatalogoServicio.Empresas(_tkn).SingleOrDefault().NombreComercial;
            }

            List <PedidoModel> lstPmodel = PedidosServicio.ObtenerPedidos(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn);
            PedidoModel        model     = new PedidoModel();

            //{
            model.Pedidos = lstPmodel;
            //};

            if (idpedido > 0 || (tel1 != null && tel1 != "") || (rfc != null && rfc != ""))
            {
                model.Pedidos = PedidosServicio.ObtenerPedidosFiltro(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn, idpedido, rfc, tel1);
                if (model.Pedidos.Count == 0)
                {
                    ViewBag.Msj = "No se encontraron resultados"; ViewBag.Tipo = "alert-danger";
                }
            }

            if (TempData["Msj"] != null)
            {
                ViewBag.MensajeError = TempData["Msj"];
            }
            return(View(model));
        }
Ejemplo n.º 5
0
        public JsonResult GuardarEncuesta(List <EncuestaModel> calificacion)
        {
            string _tkn        = Session["StringToken"].ToString();
            var    lstEncuesta = PedidosServicio.AltaEncuestaPedido(calificacion, _tkn);

            var JsonInfo = JsonConvert.SerializeObject(lstEncuesta);

            return(Json(JsonInfo, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
 public MVAlbaran(tallerEntities ent)
 {
     tallerEnt   = ent;
     albServ     = new AlbaranServicio(tallerEnt);
     pedidosServ = new PedidosServicio(tallerEnt);
     listaAlba   = new ListCollectionView(albServ.getAll().ToList());
     pediServ    = new ServicioGenerico <pedidos>(tallerEnt);
     prodServ    = new ServicioGenerico <productos>(tallerEnt);
     prdNuevo    = new productos();
 }
Ejemplo n.º 7
0
        public ActionResult EditarCliente(int idPedido)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            _tkn            = Session["StringToken"].ToString();
            ViewBag.Estatus = PedidosServicio.ObtenerEstatusPedidos(_tkn).ToList();
            var model = PedidosServicio.ObtenerIdPedido(idPedido, _tkn);

            model.Cantidad     = model.Cantidad.Replace("Kg", "");
            ViewBag.Camionetas = PedidosServicio.ObtenerCamionetas(model.IdEmpresa, _tkn);
            ViewBag.Pipas      = PedidosServicio.ObtenerPipas(model.IdEmpresa, _tkn);
            return(View(model));
        }
Ejemplo n.º 8
0
        public IEnumerable <PedidoMapa> ObtenerPendientes(string emailDelivery, string JWT)
        {
            var user = AspNetUsersServicio.obtenerPorEmail(emailDelivery);

            if (user != null)
            {
                if (user.JWT == JWT)
                {
                    var pedidosPendientes = PedidosServicio.ObtenerPendientesApi();
                    return(pedidosPendientes);
                }
            }
            List <PedidoMapa> listaVacia = new List <PedidoMapa>();

            return(listaVacia);
        }
Ejemplo n.º 9
0
        public ActionResult CancelarPedido(int idPedido, string MotivoCancela = null)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            string _tkn   = Session["StringToken"].ToString();
            var    _model = PedidosServicio.ObtenerIdPedido(idPedido, _tkn);

            //_model.cliente.IdTipoPersona = 0;
            //_model.cliente.IdRegimenFiscal = 0;
            //_model.Pedidos = null;
            _model.MotivoCancelacion = MotivoCancela;

            var Respuesta = PedidosServicio.EliminarPedido(_model, Session["StringToken"].ToString());

            ViewData["RespuestaDTO"] = Respuesta;
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 10
0
        public ActionResult GuardarEdicionPedido(RegistrarPedidoModel _model)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            string _tkn = Session["StringToken"].ToString();
            //_model.cliente.IdTipoPersona = 0;
            //_model.cliente.IdRegimenFiscal = 0;

            var Respuesta = PedidosServicio.ActualizarPedido(_model, Session["StringToken"].ToString());

            if (Respuesta.Exito)
            {
                return(RedirectToAction("RevisarPedido", new { idPedido = _model.IdPedido, msj = Respuesta.Mensaje }));
            }
            else
            {
                TempData["RespuestaDTO"] = Respuesta;
                return(RedirectToAction("RevisarPedido", new { idPedido = _model.IdPedido }));
            }
        }
Ejemplo n.º 11
0
        public ActionResult CrearPedido(RegistrarPedidoModel _model)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            string _tkn = Session["StringToken"].ToString();
            var    Id   = TokenServicio.ObtenerIdEmpresa(_tkn);

            _model.IdEmpresa = (short)Id;
            var Respuesta = PedidosServicio.AltaNuevoPedido(_model, Session["StringToken"].ToString());

            if (Respuesta.Exito)
            {
                return(RedirectToAction("Index", new { msj = Respuesta.Mensaje }));
            }
            else
            {
                TempData["RespuestaDTO"] = Respuesta;
                return(RedirectToAction("Nuevo"));
            }
        }
Ejemplo n.º 12
0
        public ActionResult RevisarPedido(int?idPedido, string msj = null)
        {
            if (Session["StringToken"] == null)
            {
                return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel())));
            }
            _tkn = Session["StringToken"].ToString();
            if (!string.IsNullOrEmpty(msj))
            {
                ViewBag.Msj = msj;
            }

            var model = PedidosServicio.ObtenerIdPedido(idPedido.Value, _tkn);

            if (TempData["RespuestaDTO"] != null)
            {
                if (!((RespuestaDTO)TempData["RespuestaDTO"]).Exito)
                {
                    ViewBag.MensajeError = Validar((RespuestaDTO)TempData["RespuestaDTO"]);
                }
            }
            msj = null;
            return(View(model));
        }