Exemplo n.º 1
0
        public string[] GetGebruikers(string prefixText, int count, string contextKey)
        {
            List <string> customers = new List <string>();

            if (SPContext.Current != null && SPContext.Current.Web != null && SPContext.Current.Web.CurrentUser != null)
            {
                ClubCloudServiceClient client = new ClubCloudServiceClient(SPServiceContext.Current);

                List <ClubCloud_Gebruiker> gebruikers = client.GetGebruikersBySearch(prefixText, count, contextKey, new ClubCloud_Setting {
                    Id = int.Parse(SPContext.Current.Web.CurrentUser.UserId.NameId)
                });

                if (gebruikers != null && gebruikers.Count > 0)
                {
                    foreach (ClubCloud_Gebruiker gebruiker in gebruikers)
                    {
                        customers.Add((new JavaScriptSerializer()).Serialize(new Pair(string.Format("{0} - {1}", gebruiker.Bondsnummer, gebruiker.Volledigenaam), gebruiker.Bondsnummer)));
                    }

                    return(customers.ToArray());
                }
                else
                {
                    return(default(string[]));
                }

                //return customers.ToArray(); ;
            }
            else
            {
                return(default(string[]));
            }
        }