public ActionResult EditarPrecioVenta(short id) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tkn = Session["StringToken"].ToString(); ViewBag.IdEmpresa = TokenServicio.ObtenerIdEmpresa(_tkn); ViewBag.Empresas = CatalogoServicio.Empresas(_tkn);//ViewBag.ListaPV PrecioVentaModel ent = CatalogoServicio.ListaPrecioVenta(id, _tkn).FirstOrDefault(); return(View(ent)); }
// GET: PrecioVenta public ActionResult Index(string msj = null) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tkn = Session["StringToken"].ToString(); ViewBag.EsAdmin = TokenServicio.ObtenerEsAdministracionCentral(_tkn); ViewBag.IdEmpresa = TokenServicio.ObtenerIdEmpresa(_tkn); if (ViewBag.EsAdmin) { ViewBag.Empresas = CatalogoServicio.Empresas(_tkn); ViewBag.ListaPV = CatalogoServicio.ListaPrecioVenta(0, _tkn); } else { ViewBag.Empresas = CatalogoServicio.Empresas(_tkn).SingleOrDefault().NombreComercial; ViewBag.ListaPV = CatalogoServicio.ListaPrecioVentaIdEmpresa(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn); } ViewBag.ListaStatus = CatalogoServicio.ListaTipoFecha(_tkn); if (TempData["RespuestaDTO"] != null) { if (!((RespuestaDTO)TempData["RespuestaDTO"]).Exito) { ViewBag.Tipo = "alert-danger"; ViewBag.MensajeError = Validar((RespuestaDTO)TempData["RespuestaDTO"]); } else { ViewBag.Tipo = "alert-success"; ViewBag.Msj = msj; } } var model = new PrecioVentaModel { IdEmpresa = (short)ViewBag.IdEmpresa }; return(View(model)); }
public ActionResult ActualizarPrecioVenta(PrecioVentaModel _Obj) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tok = Session["StringToken"].ToString(); var respuesta = CatalogoServicio.ModificarPrecioVenta(_Obj, _tok); if (respuesta.Exito) { TempData["RespuestaDTO"] = respuesta; return(RedirectToAction("Index", new { msj = respuesta.Mensaje })); } else { TempData["RespuestaDTO"] = respuesta; return(RedirectToAction("Index")); } }
public ActionResult Registrar(PrecioVentaModel _ObjModel) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tok = Session["StringToken"].ToString(); var respuesta = CatalogoServicio.RegistrarPrecio(_ObjModel, _tok); if (respuesta.Exito) { //TempData["RespuestaDTO"] = "Cambio Exitoso"; //TempData["RespuestaDTOError"] = null; return(RedirectToAction("Index", _ObjModel)); } else { TempData["RespuestaDTOError"] = respuesta;//.Mensaje; return(RedirectToAction("Index", _ObjModel)); } }
public ActionResult BorrarPrecioVenta(PrecioVentaModel _Obj, short id) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tkn = Session["StringToken"].ToString(); _Obj = CatalogoServicio.ListaPrecioVenta(id, _tkn)[0]; var respuesta = CatalogoServicio.EliminarPrecioVenta(_Obj, _tkn); if (respuesta.Exito) { TempData["RespuestaDTO"] = respuesta; return(RedirectToAction("Index", new { msj = respuesta.Mensaje })); } else { TempData["RespuestaDTO"] = respuesta; return(RedirectToAction("Index")); } }