Ejemplo n.º 1
0
        /// <summary>
        /// Returns a user's profile
        /// Currently assumes a single user will match the token.
        /// </summary>
        /// <param name="authenticationOption"></param>
        /// <param name="usernameToMatch"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecords"></param>
        /// <returns></returns>
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            // TODO: Take paging into account
            // TODO: Take auth option into account
            totalRecords = 0;

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            GetAttributesRequest  request  = new GetAttributesRequest().WithDomainName(domain).WithItemName(usernameToMatch);
            GetAttributesResponse response = client.GetAttributes(request);

            if (response.GetAttributesResult.Attribute.Count > 0)
            {
                ProfileInfo      profile    = null;
                List <Attribute> attributes = response.GetAttributesResult.Attribute;
                MCItem           item       = new MCItem();
                item.Domain     = domain;
                item.ItemName   = usernameToMatch;
                item.Attributes = new Hashtable();
                foreach (Attribute attribute in attributes)
                {
                    item.Attributes.Add(attribute.Name, attribute.Value);
                }
                bool     Anon         = bool.Parse(item.Get("Anon").Replace("", "false"));
                DateTime LastActivity = DateTime.Parse(item.Get("LastActivity"));
                DateTime LastUpdated  = DateTime.Parse(item.Get("LastUpdated"));
                profile = new ProfileInfo(item.Id, Anon, LastActivity, LastUpdated, 0);
                profiles.Add(profile);
            }

            totalRecords = profiles.Count;
            return(profiles);
        }
Ejemplo n.º 2
0
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            // TODO: Take paging into account
            // TODO: Take auth option into account
            totalRecords = 0;

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            SelectRequest  request  = new SelectRequest().WithSelectExpression("select * from " + domain);
            SelectResponse response = client.Select(request);

            if (response.SelectResult.Item.Count > 0)
            {
                foreach (Item _item in response.SelectResult.Item)
                {
                    ProfileInfo      profile    = null;
                    List <Attribute> attributes = _item.Attribute;
                    MCItem           item       = new MCItem();
                    item.Domain     = domain;
                    item.ItemName   = _item.Name;
                    item.Attributes = new Hashtable();
                    foreach (Attribute attribute in attributes)
                    {
                        item.Attributes.Add(attribute.Name, attribute.Value);
                    }
                    bool     Anon         = bool.Parse(item.Get("Anon").Replace("", "false"));
                    DateTime LastActivity = DateTime.Parse(item.Get("LastActivity"));
                    DateTime LastUpdated  = DateTime.Parse(item.Get("LastUpdated"));
                    profile = new ProfileInfo(item.Id, Anon, LastActivity, LastUpdated, 0);
                    profiles.Add(profile);
                }
            }

            totalRecords = profiles.Count;
            return(profiles);
        }
Ejemplo n.º 3
0
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            // TODO: Take paging into account
            // TODO: Take auth option into account
            totalRecords = 0;

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            SelectRequest request = new SelectRequest().WithSelectExpression("select * from " + domain);
            SelectResponse response = client.Select(request);

            if (response.SelectResult.Item.Count > 0)
            {
                foreach (Item _item in response.SelectResult.Item)
                {
                    ProfileInfo profile = null;
                    List<Attribute> attributes = _item.Attribute;
                    MCItem item = new MCItem();
                    item.Domain = domain;
                    item.ItemName = _item.Name;
                    item.Attributes = new Hashtable();
                    foreach (Attribute attribute in attributes)
                    {
                        item.Attributes.Add(attribute.Name, attribute.Value);
                    }
                    bool Anon = bool.Parse(item.Get("Anon").Replace("", "false"));
                    DateTime LastActivity = DateTime.Parse(item.Get("LastActivity"));
                    DateTime LastUpdated = DateTime.Parse(item.Get("LastUpdated"));
                    profile = new ProfileInfo(item.Id, Anon, LastActivity, LastUpdated, 0);
                    profiles.Add(profile);
                }
            }

            totalRecords = profiles.Count;
            return profiles;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns a user's profile
        /// Currently assumes a single user will match the token.
        /// </summary>
        /// <param name="authenticationOption"></param>
        /// <param name="usernameToMatch"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecords"></param>
        /// <returns></returns>
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            // TODO: Take paging into account
            // TODO: Take auth option into account
            totalRecords = 0;

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            GetAttributesRequest request = new GetAttributesRequest().WithDomainName(domain).WithItemName(usernameToMatch);
            GetAttributesResponse response = client.GetAttributes(request);

            if (response.GetAttributesResult.Attribute.Count > 0)
            {
                ProfileInfo profile = null;
                List<Attribute> attributes = response.GetAttributesResult.Attribute;
                MCItem item = new MCItem();
                item.Domain = domain;
                item.ItemName = usernameToMatch;
                item.Attributes = new Hashtable();
                foreach (Attribute attribute in attributes)
                {
                    item.Attributes.Add(attribute.Name, attribute.Value);
                }
                bool Anon = bool.Parse(item.Get("Anon").Replace("", "false"));
                DateTime LastActivity = DateTime.Parse(item.Get("LastActivity"));
                DateTime LastUpdated = DateTime.Parse(item.Get("LastUpdated"));
                profile = new ProfileInfo(item.Id, Anon, LastActivity, LastUpdated, 0);
                profiles.Add(profile);
            }

            totalRecords = profiles.Count;
            return profiles;
        }