private void OKButton_Click(object sender, RoutedEventArgs e)
        {

            var selectedUser = (bCheckV2.Helpers.Definitions.User)this.gridPeopleResults.SelectedItem;

            UserInfo u = new UserInfo() {
                BRID = selectedUser.BRID,
                Email = selectedUser.Email,
                UserName = selectedUser.Username,
                DisplayName = selectedUser.Username,
                UserLoginId = selectedUser.UserLoginID
            
            }; 
            UserInfoParam p = (UserInfoParam)this.DataContext;
            p.ResolvedUser = u;
            p.HasErrors = false;
            this.DialogResult = true;

            /*
             * the following section carries out further validation if the user selected in the grid
             * does not have a valid SharePoint user id.
             * Comment this out if required.
             */
            //if (u.UserID <= 0)
            //{
            //    //needs further resolution
            //    ISharePointDataProvider providerResolveId = ViewModel.Current.Provider;
            //    providerResolveId.FetchUserInfoCompleteEvent += new FetchUserInfoComplete(providerResolveId_FetchUserInfoCompleteEvent);
            //    this.IsRefreshing = true;
            //    providerResolveId.ResolveUserInfo(u);
            //}
            //else
            //{
            //    UserInfoParam p = (UserInfoParam)this.DataContext;
            //    p.ResolvedUser = u;
            //    this.DialogResult = true;
            //}
        }
Beispiel #2
0
        /// <summary>
        /// Consumes a string which is of the form 
        /// 322;#Dasgupta, Saurabh: IT (LDN);#326;#Ewing, Derek: IT (LDN);#249;#Mistry, Naresh: IT (LDN)
        /// and strips the username, ID into well defined object
        /// This is the string returned by the SharePoint web service
        /// </summary>
        /// <param name="txtusername"></param>
        /// <returns></returns>
        public static List<UserInfo> ParseNames(string txtusername)
        {
            string username = txtusername;
            List<UserInfo> namescolln = new List<UserInfo>();
            string[] searchPatterns = { "^[0-9]*;#" };
            if (username != null)
            {
                bool bSearchComplete = false;
                while (!bSearchComplete)
                {
                    Regex rxpattern = new Regex("^[0-9]*;#");
                    MatchCollection matches = rxpattern.Matches(username);
                    UserInfo info = new UserInfo();
                    if (matches.Count > 0)
                    {
                        string idstring = username.Substring(0, matches[0].Length - 2);
                        info.UserID = Int32.Parse(idstring);

                        username = username.Remove(matches[0].Index, matches[0].Length);

                        Regex rxpattern1 = new Regex(";#"); //;#[0-9]*;
                        MatchCollection matches1 = rxpattern1.Matches(username);
                        if (matches1.Count > 0)
                        {
                            info.DisplayName = username.Substring(0, matches1[0].Index);
                            username = username.Remove(0, matches1[0].Index + matches1[0].Length);
                            namescolln.Add(info);
                        }
                        else
                        {
                            if (username.Length > 0) info.DisplayName = username;
                            namescolln.Add(info);

                            bSearchComplete = true;
                        }

                    }
                    else
                    {
                        bSearchComplete = true;
                    }
                    //}
                }
            }

            return namescolln;
        }
Beispiel #3
0
 public void ResolveUserInfo(UserInfo u)
 {
     Thread t = new Thread(this.LongOperationToResolveUserInfo );
     t.Start(u);
     
 }
Beispiel #4
0
 void ISharePointDataProvider.ResolveUserInfo(UserInfo u)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
        public void LongOperationToFetchUserInfo(object param)
        {
            Thread.Sleep(2000);
            string pattern = (string)param;
            UserInfoFetchCompleteEventArgs args = new UserInfoFetchCompleteEventArgs(null, false, null);
            args.UserInfoCollection = new List<UserInfo>();


            int count = 10;
            if (pattern.Equals("exact")) count = 1; //simulate a correct match
            if (pattern.Equals("noexact")) count = 0; //simulate a no-match
            while (count > 0)
            {
                UserInfo u = new UserInfo
                            {
                                DisplayName = string.Format ( "lastname-{0},first: Markets(LDN)",count),
                                Title = "Associate director asset allocation",
                                Department = "Ops - Global COO Team [Global Operations]",
                                AccountName = "INTRANET\\account-"+count.ToString (),
                                UserID=-1
                            };
                args.UserInfoCollection.Add(u); 
                count--;
            }

            args.HasListOfUsers = true;
            Deployment.Current.Dispatcher.BeginInvoke(delegate()
            {
                FetchUserInfoCompleteEvent (this, args);
            });
        }