예제 #1
0
 public cxc_Catalogo_Info get_info(string IdCatalogo_tipo, string IdCatalogo)
 {
     try
     {
         cxc_Catalogo_Info info = new cxc_Catalogo_Info();
         using (Entities_cuentas_por_cobrar Context = new Entities_cuentas_por_cobrar())
         {
             cxc_Catalogo Entity = Context.cxc_Catalogo.FirstOrDefault(q => q.IdCatalogo_tipo == IdCatalogo_tipo && q.IdCatalogo == IdCatalogo);
             if (Entity == null)
             {
                 return(null);
             }
             info = new cxc_Catalogo_Info
             {
                 IdCatalogo_tipo = Entity.IdCatalogo_tipo,
                 IdCatalogo      = Entity.IdCatalogo,
                 Estado          = Entity.Estado,
                 Nombre          = Entity.Nombre,
                 Orden           = Entity.Orden
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
 public bool guardarDB(cxc_Catalogo_Info info)
 {
     try
     {
         using (Entities_cuentas_por_cobrar Context = new Entities_cuentas_por_cobrar())
         {
             cxc_Catalogo Entity = new cxc_Catalogo
             {
                 IdCatalogo_tipo = info.IdCatalogo_tipo,
                 IdCatalogo      = info.IdCatalogo,
                 Estado          = info.Estado = "A",
                 Orden           = info.Orden,
                 Nombre          = info.Nombre,
                 IdUsuario       = info.IdUsuario
             };
             Context.cxc_Catalogo.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #3
0
        public bool modificarDB(cxc_Catalogo_Info info)
        {
            try
            {
                using (Entities_cuentas_por_cobrar Context = new Entities_cuentas_por_cobrar())
                {
                    cxc_Catalogo Entity = Context.cxc_Catalogo.FirstOrDefault(q => q.IdCatalogo_tipo == info.IdCatalogo_tipo && q.IdCatalogo == info.IdCatalogo);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdCatalogo_tipo = info.IdCatalogo_tipo;
                    Entity.Nombre          = info.Nombre;
                    Entity.Orden           = info.Orden;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.FechaUltMod     = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #4
0
        public ActionResult Index(string IdCatalogo_tipo = "")
        {
            #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, "CuentasPorCobrar", "CatalogoTipoCXC", "Index");
            ViewBag.Nuevo = info.Nuevo;
            #endregion

            ViewBag.IdCatalogo_tipo = IdCatalogo_tipo;
            cxc_Catalogo_Info model = new cxc_Catalogo_Info
            {
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession),
                IdCatalogo_tipo      = IdCatalogo_tipo
            };

            var lst = bus_catalogo.get_list(IdCatalogo_tipo, true);
            Lista_Catalogo.set_list(lst, model.IdTransaccionSession);
            return(View(model));
        }
예제 #5
0
        public ActionResult Consultar(string IdCatalogo_tipo = "", string IdCatalogo = "", bool Exito = false)
        {
            cxc_Catalogo_Info model = bus_catalogo.get_info(IdCatalogo_tipo, IdCatalogo);

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

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "CuentasPorCobrar", "CatalogoTipoCXC", "Index");
            if (model.Estado == "I")
            {
                info.Modificar = false;
                info.Anular    = false;
            }
            model.Nuevo     = (info.Nuevo == true ? 1 : 0);
            model.Modificar = (info.Modificar == true ? 1: 0);
            model.Anular    = (info.Anular == true ? 1 : 0);
            #endregion

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

            ViewBag.IdCatalogo_tipo = IdCatalogo_tipo;
            cargar_combos();
            return(View(model));
        }
예제 #6
0
 public ActionResult Modificar(cxc_Catalogo_Info model)
 {
     if (!bus_catalogo.modificarDB(model))
     {
         ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo;
         cargar_combos();
         return(View(model));
     }
     return(RedirectToAction("Index", new { IdCatalogo_tipo = model.IdCatalogo_tipo }));
 }
예제 #7
0
        public ActionResult Nuevo(string IdCatalogo_tipo = "")
        {
            cxc_Catalogo_Info model = new cxc_Catalogo_Info
            {
                IdCatalogo_tipo = IdCatalogo_tipo
            };

            cargar_combos();
            return(View(model));
        }
 public bool anularDB(cxc_Catalogo_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #9
0
        public ActionResult Modificar(string IdCatalogo_tipo = "", string IdCatalogo = "")
        {
            cxc_Catalogo_Info model = bus_catalogo.get_info(IdCatalogo_tipo, IdCatalogo);

            if (model == null)
            {
                return(RedirectToAction("Index", new { IdCatalogo_tipo = IdCatalogo_tipo }));
            }
            ViewBag.IdCatalogo_tipo = IdCatalogo_tipo;
            cargar_combos();
            return(View(model));
        }
예제 #10
0
        public ActionResult Nuevo(string IdCatalogo_tipo = "")
        {
            cxc_Catalogo_Info model = new cxc_Catalogo_Info
            {
                IdCatalogo_tipo = IdCatalogo_tipo
            };

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "CuentasPorCobrar", "CatalogoTipoCXC", "Index");
            if (!info.Nuevo)
            {
                return(RedirectToAction("Index"));
            }
            #endregion

            cargar_combos();
            return(View(model));
        }
예제 #11
0
        public ActionResult Nuevo(cxc_Catalogo_Info model)
        {
            model.IdUsuario = Session["IdUsuario"].ToString();
            if (bus_catalogo.validar_existe_IdCatalogo(model.IdCatalogo))
            {
                ViewBag.mensaje         = "El código ya se encuentra registrado";
                ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo;
                cargar_combos();
                return(View(model));
            }

            if (!bus_catalogo.guardarDB(model))
            {
                ViewBag.IdCatalogo_tipo = model.IdCatalogo_tipo;
                cargar_combos();
                return(View(model));
            }

            return(RedirectToAction("Index", new { IdCatalogo_tipo = model.IdCatalogo_tipo }));
        }
예제 #12
0
 public bool anularDB(cxc_Catalogo_Info info)
 {
     try
     {
         using (Entities_cuentas_por_cobrar Context = new Entities_cuentas_por_cobrar())
         {
             cxc_Catalogo Entity = Context.cxc_Catalogo.FirstOrDefault(q => q.IdCatalogo_tipo == info.IdCatalogo_tipo && q.IdCatalogo == info.IdCatalogo);
             if (Entity == null)
             {
                 return(false);
             }
             Entity.Estado = info.Estado = "I";
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #13
0
        public ActionResult Anular(string IdCatalogo_tipo = "", string IdCatalogo = "")
        {
            cxc_Catalogo_Info model = bus_catalogo.get_info(IdCatalogo_tipo, IdCatalogo);

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

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "CuentasPorCobrar", "CatalogoTipoCXC", "Index");
            if (!info.Anular)
            {
                return(RedirectToAction("Index"));
            }
            #endregion

            ViewBag.IdCatalogo_tipo = IdCatalogo_tipo;
            cargar_combos();
            return(View(model));
        }