Пример #1
0
        public ActionResult Consultar(int IdEmpresa = 0, int IdNivel = 0, bool Exito = false)
        {
            fa_NivelDescuento_Info model = bus_nivel.GetInfo(IdEmpresa, IdNivel);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "NivelDescuento", "Index");
            if (model.Estado == false)
            {
                info.Modificar = false;
                info.Anular    = false;
            }
            ViewBag.Nuevo     = info.Nuevo;
            ViewBag.Modificar = info.Modificar;
            ViewBag.Anular    = info.Anular;
            #endregion

            if (Exito)
            {
                ViewBag.MensajeSuccess = MensajeSuccess;
            }

            return(View(model));
        }
Пример #2
0
        public fa_NivelDescuento_Info GetInfo(int IdEmpresa, int IdNivel)
        {
            try
            {
                fa_NivelDescuento_Info info = new fa_NivelDescuento_Info();
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_NivelDescuento Entity = Context.fa_NivelDescuento.Where(q => q.IdEmpresa == IdEmpresa && q.IdNivel == IdNivel).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new fa_NivelDescuento_Info
                    {
                        IdEmpresa   = Entity.IdEmpresa,
                        IdNivel     = Entity.IdNivel,
                        Estado      = Entity.Estado,
                        Descripcion = Entity.Descripcion,
                        Observacion = Entity.Observacion,
                        Porcentaje  = Entity.Porcentaje
                    };
                }
                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public ActionResult Index()
        {
            #region Validar Session
            if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
            {
                return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
            }
            SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
            SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
            #endregion

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "NivelDescuento", "Index");
            ViewBag.Nuevo     = info.Nuevo;
            ViewBag.Modificar = info.Modificar;
            ViewBag.Anular    = info.Anular;
            #endregion

            fa_NivelDescuento_Info model = new fa_NivelDescuento_Info
            {
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession),
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa)
            };

            var lst = bus_nivel.GetList(model.IdEmpresa, true);
            Lista_NivelDescuento.set_list(lst, model.IdTransaccionSession);
            return(View(model));
        }
Пример #4
0
 public ActionResult Nuevo(fa_NivelDescuento_Info model)
 {
     if (!bus_nivel.GuardarDB(model))
     {
         return(View(model));
     }
     return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdNivel = model.IdNivel, Exito = true }));
 }
Пример #5
0
 public ActionResult Anular(fa_NivelDescuento_Info model)
 {
     if (!bus_nivel.AnularDB(model))
     {
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
Пример #6
0
        public ActionResult Nuevo()
        {
            fa_NivelDescuento_Info model = new fa_NivelDescuento_Info
            {
                IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa)
            };

            return(View(model));
        }
Пример #7
0
        public ActionResult Anular(int IdEmpresa = 0, int IdNivel = 0)
        {
            fa_NivelDescuento_Info model = bus_nivel.GetInfo(IdEmpresa, IdNivel);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Пример #8
0
 public bool AnularDB(fa_NivelDescuento_Info info)
 {
     try
     {
         return(odata.AnularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #9
0
        public ActionResult Nuevo()
        {
            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "NivelDescuento", "Index");
            if (!info.Nuevo)
            {
                return(RedirectToAction("Index"));
            }
            #endregion

            fa_NivelDescuento_Info model = new fa_NivelDescuento_Info
            {
                IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa)
            };
            return(View(model));
        }
Пример #10
0
        public ActionResult Anular(int IdEmpresa = 0, int IdNivel = 0)
        {
            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Facturacion", "NivelDescuento", "Index");
            if (!info.Anular)
            {
                return(RedirectToAction("Index"));
            }
            #endregion

            fa_NivelDescuento_Info model = bus_nivel.GetInfo(IdEmpresa, IdNivel);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Пример #11
0
        public bool AnularDB(fa_NivelDescuento_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_NivelDescuento Entity = Context.fa_NivelDescuento.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdNivel == info.IdNivel).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Estado = false;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #12
0
        public bool ModificarDB(fa_NivelDescuento_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_NivelDescuento Entity = Context.fa_NivelDescuento.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdNivel == info.IdNivel).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Descripcion = info.Descripcion;
                    Entity.Observacion = info.Observacion;
                    Entity.Porcentaje  = info.Porcentaje;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #13
0
 public bool GuardarDB(fa_NivelDescuento_Info info)
 {
     try
     {
         using (Entities_facturacion Context = new Entities_facturacion())
         {
             Context.fa_NivelDescuento.Add(new fa_NivelDescuento
             {
                 IdEmpresa   = info.IdEmpresa,
                 IdNivel     = info.IdNivel = GetId(info.IdEmpresa),
                 Estado      = true,
                 Descripcion = info.Descripcion,
                 Observacion = info.Observacion,
                 Porcentaje  = info.Porcentaje
             });
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }