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
            var model = new ct_grupo_x_Tipo_Gasto_Info
            {
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession)
            };

            List <ct_grupo_x_Tipo_Gasto_Info> lista = bus_GrupoPorTipoGasto.get_list(model.IdEmpresa, true);
            Lista_GrupoPorTipoGasto.set_list(lista, Convert.ToDecimal(SessionFixed.IdTransaccionSession));

            return(View(model));
        }
        public bool anularDB(ct_grupo_x_Tipo_Gasto_Info info)
        {
            try
            {
                using (Entities_contabilidad Context = new Entities_contabilidad())
                {
                    ct_grupo_x_Tipo_Gasto Entity = Context.ct_grupo_x_Tipo_Gasto.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipo_Gasto == info.IdTipo_Gasto);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.estado = false;

                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ct_grupo_x_Tipo_Gasto_Info get_info_nuevo(int IdEmpresa, int IdTipoGasto_padre)
        {
            try
            {
                ct_grupo_x_Tipo_Gasto_Info info = new ct_grupo_x_Tipo_Gasto_Info {
                    nivel = 0
                };
                int ID = IdTipoGasto_padre;

                using (Entities_contabilidad Context = new Entities_contabilidad())
                {
                    ct_grupo_x_Tipo_Gasto Entity_padre = Context.ct_grupo_x_Tipo_Gasto.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdTipo_Gasto == IdTipoGasto_padre);
                    if (Entity_padre == null)
                    {
                        return(info);
                    }

                    var lst = from q in Context.ct_grupo_x_Tipo_Gasto
                              where q.IdTipo_Gasto_Padre == IdTipoGasto_padre &&
                              q.IdEmpresa == IdEmpresa
                              select q;

                    info = new ct_grupo_x_Tipo_Gasto_Info
                    {
                        IdTipo_Gasto   = ID,
                        nom_tipo_Gasto = Entity_padre.nom_tipo_Gasto,
                        nivel          = (Entity_padre.nivel == null ? 0 : Entity_padre.nivel + 1)
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        public ActionResult CmbCuenta_TipoGastoPadre()
        {
            ct_grupo_x_Tipo_Gasto_Info model = new ct_grupo_x_Tipo_Gasto_Info();

            return(PartialView("_CmbCuenta_TipoGastoPadre", model));
        }