Пример #1
0
        public ActionResult Index(int id, bool?showall, bool?sortbyname, bool?CurrentMembers, bool?showlarge)
        {
            var m = new MeetingModel(id, CurrentDatabase)
            {
                currmembers = CurrentMembers ?? false,
                showall     = showall == true,
                sortbyname  = sortbyname == true,
                showlarge   = showlarge ?? false
            };

            if (m.meeting == null)
            {
                return(RedirectShowError("no meeting"));
            }

            if (Util2.OrgLeadersOnly)
            {
                var oids = CurrentDatabase.GetLeaderOrgIds(Util.UserPeopleId);
                if (!oids.Contains(m.org.OrganizationId))
                {
                    return(NotAllowed("You must be a leader of this organization", m.org.OrganizationName));
                }
            }
            if (m.org.LimitToRole.HasValue())
            {
                if (!User.IsInRole(m.org.LimitToRole))
                {
                    return(NotAllowed("no privilege to view ", m.org.OrganizationName));
                }
            }

            DbUtil.LogActivity($"Viewing Meeting for {m.meeting.Organization.OrganizationName}");
            return(View(m));
        }
Пример #2
0
        public ActionResult Index(int id, int?peopleid = null)
        {
            if (id == 0)
            {
                var recent = Util2.MostRecentOrgs;
                id = recent.Any() ? recent[0].Id : 1;
                return(Redirect($"/Org/{id}"));
            }
            var m = OrganizationModel.Create(CurrentDatabase, CurrentUser);

            m.OrgId = id;
            if (peopleid.HasValue)
            {
                m.NameFilter = peopleid.ToString();
            }

            if (m.Org == null)
            {
                return(Content("organization not found"));
            }

            if (Util2.OrgLeadersOnly)
            {
                var oids = CurrentDatabase.GetLeaderOrgIds(Util.UserPeopleId);
                if (!oids.Contains(m.Org.OrganizationId))
                {
                    return(NotAllowed("You must be a leader of this organization", m.Org.OrganizationName));
                }
                var sgleader = CurrentDatabase.SmallGroupLeader(id, Util.UserPeopleId);
                if (sgleader.HasValue())
                {
                    m.SgFilter = sgleader;
                }
            }
            if (m.Org.LimitToRole.HasValue())
            {
                if (!User.IsInRole(m.Org.LimitToRole))
                {
                    return(NotAllowed("no privilege to view ", m.Org.OrganizationName));
                }
            }

            DbUtil.LogOrgActivity($"Viewing Org({m.Org.OrganizationName})", id, m.Org.OrganizationName);

            m.OrgMain.Divisions = GetOrgDivisions(id);

            ViewBag.OrganizationContext = true;
            ViewBag.orgname             = m.Org.FullName;
            ViewBag.model      = m;
            ViewBag.selectmode = 0;
            InitExportToolbar(m);
            Session["ActiveOrganization"] = m.Org.OrganizationName;
            return(View(m));
        }
Пример #3
0
        public EpplusResult OrgsMemberList()
        {
            var q = FetchOrgs();

            if (Util2.OrgLeadersOnly)
            {
                var oids = CurrentDatabase.GetLeaderOrgIds(Util.UserPeopleId);
                q = q.Where(oo => oids.Contains(oo.OrganizationId));
            }
            return(CurrentDatabase.CurrOrgMembers(string.Join(",", q.OrderBy(mm => mm.OrganizationName).Select(mm => mm.OrganizationId)))
                   .ToDataTable().ToExcel("OrgsMembers.xlsx"));
        }
Пример #4
0
        public IQueryable <InvolvementCurrent> DefineModelList(bool useOrgFilter)
        {
            var limitvisibility = Util2.OrgLeadersOnly || !HttpContextFactory.Current.User.IsInRole("Access");
            var oids            = new int[0];

            if (Util2.OrgLeadersOnly)
            {
                oids = CurrentDatabase.GetLeaderOrgIds(Util.UserPeopleId);
            }

            var roles = CurrentDatabase.CurrentRoles();

            return(from om in CurrentDatabase.InvolvementCurrent(PeopleId, Util.UserId)
                   where (om.Pending ?? false) == false
                   where oids.Contains(om.OrganizationId) || !(limitvisibility && om.SecurityTypeId == 3)
                   where om.LimitToRole == null || roles.Contains(om.LimitToRole)
                   where (!useOrgFilter || !OrgTypesFilter.Any() || OrgTypesFilter.Contains(om.OrgType))
                   select om);
        }