CmsData.OrganizationMember.VolunteerLeaderInOrg C# (CSharp) Method

VolunteerLeaderInOrg() public static method

public static VolunteerLeaderInOrg ( CmsData.CMSDataContext db, int orgid ) : bool
db CmsData.CMSDataContext
orgid int
return bool
        public static bool VolunteerLeaderInOrg(CMSDataContext db, int? orgid)
        {
            if (orgid == null)
                return false;
            var o = db.LoadOrganizationById(orgid);
            if (o == null || o.RegistrationTypeId != RegistrationTypeCode.ChooseVolunteerTimes)
                return false;
            if (HttpContext.Current.User.IsInRole("Admin") ||
                HttpContext.Current.User.IsInRole("ManageVolunteers"))
                return true;
            var leaderorgs = db.GetLeaderOrgIds(Util.UserPeopleId);
            if (leaderorgs == null)
                return false;
            return leaderorgs.Contains(orgid.Value);
        }