Example #1
0
        /// <summary>
        /// Initializes constructor and validates that whomever tries to access is the organization leader.
        /// Created By: Trent Cullinan 02/24/2016
        /// </summary>
        /// <param name="accessToken">Confirm user is valid to use method.</param>
        /// <param name="organization">Organization to be referenced.</param>
        public OrgUserManager(AccessToken accessToken, Organization organization)
        {
            if (CheckAccessToken(accessToken, organization))
            {
                try
                {
                    orgUserAccessor = new OrgUserAccessor(accessToken, organization);

                    organization.OrganizationGroups = orgUserAccessor.RetrieveOrgGroups(accessToken);
                }
                catch (SqlException)
                {
                    throw new Exception("Error with database, try again later.");
                }
                catch (ArgumentException)
                {
                    throw new Exception("User is not the leader of the organization.");
                }

                this.organization = organization;
            }
            else
            {
                throw new ArgumentException("User is not the leader of the organization.");
            }
        }
Example #2
0
        /// <summary>
        /// Initializes constructor and validates that whomever tries to access is the organization leader.
        /// Created By: Trent Cullinan 02/24/2016
        /// </summary>
        /// <param name="accessToken">Confirm user is valid to use method.</param>
        /// <param name="organization">Organization to be referenced.</param>
        public OrgRequestsManager(AccessToken accessToken, Organization organization)
        {
            if (GetAccessToken(accessToken, organization))
            {
                try
                {
                    orgUserAccessor = new OrgUserAccessor(accessToken, organization);
                }
                catch (SqlException)
                {
                    throw new Exception("Error with database, try again later.");
                }
                catch (ArgumentException)
                {
                    throw new Exception("User is not the leader of the organization.");
                }

                this.organization = organization;
            }
            else
            {
                throw new ArgumentException("User is not the leader of the organization.");
            }
        }