예제 #1
0
 private void btn获取待审核用户_Click(object sender, RoutedEventArgs e)
 {
     ThreadPool.QueueUserWorkItem(delegate
     {
         GetCertiWaitingApprovedUserNamesWorker.SendGetCertiWaitingApprovedUserNamesRequest(
             successCallback : delegate(GetCertiWaitingApprovedUserNamesResponse response)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 dataGridUserList.DataContext = response.UserNameList.Select(item => new { UserId = item });
                 dataGridUserList.SetBinding(System.Windows.Controls.ListView.ItemsSourceProperty, new System.Windows.Data.Binding());
             }));
         },
             failureCallback : delegate(string failureReason)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 MessageBox.Show("获取用户列表。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk);
             }));
         },
             errorCallback : delegate(Exception ex)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 Util.ShowExceptionMessage(ex, "获取用户列表出错。");
             }));
         }
             );
     });
 }
예제 #2
0
 private void GetWaitingApproveUser()
 {
     ThreadPool.QueueUserWorkItem(delegate
     {
         GetCertiWaitingApprovedUserNamesWorker.SendGetCertiWaitingApprovedUserNamesRequest(
             successCallback : delegate(GetCertiWaitingApprovedUserNamesResponse response)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 if (response.UserNameList != null)
                 {
                     _waitingApproveUserNameList = response.UserNameList;
                     if (_oldWaitingApproveUserNameList == null)
                     {
                         _oldWaitingApproveUserNameList = response.UserNameList;
                     }
                     if (_oldWaitingApproveUserNameList.Count < response.UserNameList.Count)
                     {
                         Console.WriteLine("new user");
                         string newUserID = response.UserNameList[response.UserNameList.Count - 1];
                         if (_AllUserInfoList != null)
                         {
                             GetUserInfoResponse newUser = _AllUserInfoList.FirstOrDefault(item => item.PhoneNumber == newUserID);
                             if (newUser != null)
                             {
                                 string emailSubject = "用户审核通知";
                                 string emailBody    = "您收到用户 " + newUser.ChineseName + "(手机号 " + newUser.PhoneNumber + " ) 提交资格证书审核,请查阅 【朗开医疗】";;
                                 SendNotificateEmail(emailSubject, emailBody);
                                 SendPhoneMessage(emailBody);
                             }
                         }
                         _oldWaitingApproveUserNameList = response.UserNameList;
                     }
                 }
                 getAllUserInfo();
             }));
         },
             failureCallback : delegate(string failureReason)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 getAllUserInfo();
                 //MessageBox.Show("获取用户列表。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk);
             }));
         },
             errorCallback : delegate(Exception ex)
         {
             Dispatcher.Invoke(new Action(delegate
             {
                 getAllUserInfo();
                 Util.ShowExceptionMessage(ex, "获取用户列表出错。");
             }));
         }
             );
     });
 }
예제 #3
0
        private void GetWaitingApproveUser()
        {
            ThreadPool.QueueUserWorkItem(delegate
            {
                GetCertiWaitingApprovedUserNamesWorker.SendGetCertiWaitingApprovedUserNamesRequest(
                    successCallback : delegate(GetCertiWaitingApprovedUserNamesResponse response)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        _waitingApproveUserNameList = response.UserNameList;

                        //for (int i = 0; i < response.UserNameList.Count; i++)
                        //{
                        //    GetUserInfo(response.UserNameList[i]);
                        //}

                        GetAllUserInfo();
                    }));
                },
                    failureCallback : delegate(string failureReason)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        //MessageBox.Show("获取用户列表。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                        GetAllUserInfo();
                    }));
                },
                    errorCallback : delegate(Exception ex)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        Util.ShowExceptionMessage(ex, "获取用户列表出错。");
                        GetAllUserInfo();
                    }));
                }
                    );
            });
        }