コード例 #1
0
        GetProfileMemberActivity(int profileID, int personID, int start, int max)
        {
            Contracts.GenericListResult <Contracts.ProfileMemberActivity> list = new Contracts.GenericListResult <Contracts.ProfileMemberActivity>();
            Profile   profile = new Profile(profileID);
            DataTable dt;
            int       i;


            //
            // Check if the profile exists.
            //
            if (profile.ProfileID == -1)
            {
                throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid profile ID");
            }

            //
            // Check if the user has access to work with the profile.
            //
            if (RestApi.ProfileOperationAllowed(ArenaContext.Current.Person.PersonID, profile.ProfileID, OperationType.View) == false)
            {
                throw new Exception("Access denied.");
            }

            dt         = new ProfileMemberActivityData().GetProfileMemberActivityDetails_DT(RestApi.DefaultOrganizationID(), profile.ProfileType, profile.Owner.PersonID, personID);
            list.Start = start;
            list.Max   = max;
            list.Items = new List <Contracts.ProfileMemberActivity>();
            for (i = 0; i < dt.Rows.Count; i++)
            {
                if (RestApi.ProfileOperationAllowed(ArenaContext.Current.Person.PersonID, Convert.ToInt32(dt.Rows[i]["profile_id"]), OperationType.View) == false)
                {
                    continue;
                }

                if (list.Total >= start && (max <= 0 ? true : list.Items.Count < max))
                {
                    list.Items.Add(new Contracts.ProfileMemberActivity(dt.Rows[i]));
                }
                list.Total += 1;
            }

            return(list);
        }
        /// <summary>
        /// Returns all profile member activity data for the given organization and profile.
        /// </summary>
        /// <param name="organizationID">The organizationID to limit the search.</param>
        /// <param name="profileID">The ID of the Profile.</param>
        /// <returns>a DataTable of ProfileMemberActivity records</returns>
        public static DataTable GetProfileActivityDetails_DT(this ProfileMemberActivityData pmaData, int organizationID, int profileID)
        {
            DataTable table;
            ArrayList paramList = new ArrayList();

            paramList.Add(new SqlParameter("@OrganizationID", organizationID));
            paramList.Add(new SqlParameter("@ProfileID", profileID));

            try
            {
                table = pmaData.ExecuteDataTable("cust_cccev_profile_sp_get_profile_member_activity_Details", paramList);
            }
            catch (SqlException exception)
            {
                throw exception;
            }
            finally
            {
                paramList = null;
            }
            return(table);
        }
コード例 #3
0
        public Contracts.GenericListResult<Contracts.ProfileMemberActivity> GetProfileMemberActivity(int profileID, int personID, int start, int max)
        {
            Contracts.GenericListResult<Contracts.ProfileMemberActivity> list = new Contracts.GenericListResult<Contracts.ProfileMemberActivity>();
            Profile profile = new Profile(profileID);
            DataTable dt;
            int i;

            //
            // Check if the profile exists.
            //
            if (profile.ProfileID == -1)
                throw new Arena.Services.Exceptions.ResourceNotFoundException("Invalid profile ID");

            //
            // Check if the user has access to work with the profile.
            //
            if (RestApi.ProfileOperationAllowed(ArenaContext.Current.Person.PersonID, profile.ProfileID, OperationType.View) == false)
                throw new Exception("Access denied.");

            dt = new ProfileMemberActivityData().GetProfileMemberActivityDetails_DT(RestApi.DefaultOrganizationID(), profile.ProfileType, profile.Owner.PersonID, personID);
            list.Start = start;
            list.Max = max;
            list.Items = new List<Contracts.ProfileMemberActivity>();
            for (i = 0; i < dt.Rows.Count; i++)
            {
                if (RestApi.ProfileOperationAllowed(ArenaContext.Current.Person.PersonID, Convert.ToInt32(dt.Rows[i]["profile_id"]), OperationType.View) == false)
                    continue;

                if (list.Total >= start && (max <= 0 ? true : list.Items.Count < max))
                    list.Items.Add(new Contracts.ProfileMemberActivity(dt.Rows[i]));
                list.Total += 1;
            }

            return list;
        }