コード例 #1
0
        public void GetCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            if (e.Error != null)
            {
                MessageBox.Show(System.Windows.Application.Current.MainWindow, " 服务器错误\n" + e.Error.Message);
                return;
            }
            models.Clear();
            API.Result res = e.Result;
            if (res.ReturnValue)
            {
                API.SearchModel     smodel = res.Obj as API.SearchModel;
                List <API.RoleInfo> list   = smodel.Result as List <API.RoleInfo>;
                models.AddRange(list);
                GridList.Rebind();

                this.page.PageSize = (int)pagesize.Value;
                string[] data = new string[smodel.AllPages];
                this.page.PageIndexChanged -= page_PageIndexChanged;
                this.page.Source            = data;
                this.page.PageIndexChanged += page_PageIndexChanged;
                this.page.PageIndex         = pageindex;
            }
        }
コード例 #2
0
        private void GetCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            models.Clear();
            API.Result res = e.Result;
            if (res.ReturnValue)
            {
                API.SearchModel smodel = res.Obj as API.SearchModel;
                List <API.Book> list   = smodel.Result as List <API.Book>;
                if (list != null)
                {
                    var books = (from a in list
                                 orderby a.PubDate descending
                                 select a).ToList();
                    models.AddRange(books);
                    GridList.Rebind();
                }

                this.page.PageSize = (int)pagesize.Value;
                string[] data = new string[smodel.AllPages];
                //PagedCollectionView pcv = new PagedCollectionView(data);

                this.page.PageIndexChanged -= page_PageIndexChanged;
                this.page.Source            = data;
                this.page.PageIndexChanged += page_PageIndexChanged;
                this.page.PageIndex         = pageindex;
            }
        }
コード例 #3
0
        public void GetCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            models.Clear();
            API.Result res = e.Result;
            if (res.ReturnValue)
            {
                API.SearchModel      smodel = res.Obj as API.SearchModel;
                List <API.BorowInfo> list   = smodel.Result as List <API.BorowInfo>;
                if (list != null)
                {
                    foreach (var item in list)
                    {
                        if (string.IsNullOrEmpty(item.Borower))
                        {
                            item.Borower = item.UserName;
                        }
                    }
                    models.AddRange(list);
                    GridList.Rebind();
                }

                this.page.PageSize = (int)pagesize.Value;
                string[] data = new string[smodel.AllPages];
                //PagedCollectionView pcv = new PagedCollectionView(data);

                this.page.PageIndexChanged -= page_PageIndexChanged;
                this.page.Source            = data;
                this.page.PageIndexChanged += page_PageIndexChanged;
                this.page.PageIndex         = pageindex;
            }
        }
コード例 #4
0
        private void GetRemindCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            RadTreeView1.Items.Clear();
            if (e.Error != null)
            {
                MessageBox.Show(System.Windows.Application.Current.MainWindow, " 服务器错误\n" + e.Error.Message);
                return;
            }
            if (e.Result.ReturnValue)
            {
                List <API.MenuInfo> arr = e.Result.Obj as List <API.MenuInfo>;
                if (arr == null)
                {
                    return;
                }

                foreach (var item in arr)
                {
                    if (item.Parent == 0)
                    {
                        RadTreeViewItem rm = new RadTreeViewItem();
                        rm.Header = item.MenuName;
                        rm.Tag    = item.MenuID;
                        if (item.Parent == 0)
                        {
                            rm = Find(item, rm);
                        }
                        RadTreeView1.Items.Add(rm);
                    }
                }
            }
        }
コード例 #5
0
 public void GetBKeyCompleted(object sender, API.ExecuteCompletedEventArgs e)
 {
     this.busy.IsBusy = false;
     if (e.Result.ReturnValue)
     {
         GridKey.ItemsSource = e.Result.Obj as List <API.BookKey>;
         GridKey.Rebind();
     }
 }
コード例 #6
0
 public void SaveCompleted(object sender, API.ExecuteCompletedEventArgs e)
 {
     this.busy.IsBusy = false;
     MessageBox.Show(e.Result.Message);
     if (e.Result.ReturnValue)
     {
         Clear();
     }
 }
コード例 #7
0
 public void DelCompleted(object sender, API.ExecuteCompletedEventArgs e)
 {
     this.busy.IsBusy = false;
     MessageBox.Show(e.Result.Message);
     if (e.Result.ReturnValue)
     {
         this.type.Text = string.Empty;
         updtype.Text   = string.Empty;
         Search();
     }
 }
コード例 #8
0
ファイル: BookDetail.xaml.cs プロジェクト: linkypi/BMS
        public void BorowCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;

            MessageBox.Show(e.Result.Message);
            if (e.Result.ReturnValue)
            {
                this.Return.IsEnabled = true;
                this.borow.IsEnabled  = false;
                state.Text            = "已借";
                state.Foreground      = new SolidColorBrush(Colors.Red);
            }
        }
コード例 #9
0
 public void DelCompleted(object sender, API.ExecuteCompletedEventArgs e)
 {
     this.busy.IsBusy = false;
     if (e.Error != null)
     {
         MessageBox.Show(System.Windows.Application.Current.MainWindow, " 服务器错误\n" + e.Error.Message);
         return;
     }
     MessageBox.Show(e.Result.Message);
     if (e.Result.ReturnValue)
     {
         SearchRole();
     }
 }
コード例 #10
0
 public void Completed(object sender, API.ExecuteCompletedEventArgs e)
 {
     this.busy.IsBusy = false;
     MessageBox.Show(e.Result.Message);
     if (e.Result.ReturnValue)
     {
         // SearchBook();
         int id = (int)GridKey.Tag;
         RequestHelper.RequestAsync(this.busy, (int)MethodType.GetBKeyByBID, new List <object>()
         {
             id
         }, new EventHandler <API.ExecuteCompletedEventArgs>(GetBKeyCompleted));
     }
 }
コード例 #11
0
        public void GetDetailCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            if (e.Result.Obj != null)
            {
                string outline = e.Result.Obj.ToString();

                if (string.IsNullOrEmpty(outline))
                {
                    return;
                }
                int index = 1;

                List <int> indexList = new List <int>();
                int        ind;
                do
                {
                    ind = outline.IndexOf(index.ToString());
                    if (ind >= 0)
                    {
                        indexList.Add(ind);
                    }
                    index++;
                }while (ind >= 0);

                if (indexList.Count != 0)
                {
                    indexList.Add(outline.Length - 1);
                }
                string temps = "";

                for (int i = 0; i < indexList.Count; i++)
                {
                    char[] tem = new char[100];
                    outline.CopyTo(indexList[i], tem, 0, indexList[i + 1] - indexList[i]);

                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(tem);
                    temps += sb.Replace("\0", "").ToString() + "\n\r";
                    if (i == indexList.Count - 2)
                    {
                        break;
                    }
                }

                this.outline.Text = temps;
            }
        }
コード例 #12
0
        private void SaveCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            if (e.Error != null)
            {
                MessageBox.Show(System.Windows.Application.Current.MainWindow, " 服务器错误\n" + e.Error.Message);
                return;
            }

            MessageBox.Show(e.Result.Message);
            if (e.Result.ReturnValue)
            {
                note.Text     = string.Empty;
                roleName.Text = string.Empty;
            }
        }
コード例 #13
0
        public void SaveCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;

            MessageBox.Show(e.Result.Message);
            if (e.Result.ReturnValue)
            {
                if (GridList.SelectedItem == null)
                {
                    return;
                }
                API.Book b = GridList.SelectedItem as API.Book;
                GridKey.Tag = b.BID;
                RequestHelper.RequestAsync(this.busy, (int)MethodType.GetBKeyByBID, new List <object>()
                {
                    b.BID
                }, new EventHandler <API.ExecuteCompletedEventArgs>(GetBKeyCompleted));
            }
        }
コード例 #14
0
        public void GetRoleMenusCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            //if (e.Error != null)
            //{
            //    MessageBox.Show(System.Windows.Application.Current.MainWindow, " 服务器错误\n" + e.Error.Message);
            //    return;
            //}
            RadTreeView1.Items.Clear();
            if (e.Result.ReturnValue)
            {
                List <API.RoleMenuInfo> list = e.Result.Obj as List <API.RoleMenuInfo>;

                List <int> menus = new List <int>();
                foreach (var item in list)
                {
                    menus.Add(item.MenuID);
                }

                InitRemindMenu(menus);
            }
        }
コード例 #15
0
        public void GetCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            models.Clear();
            if (e.Result.ReturnValue)
            {
                API.SearchModel model = e.Result.Obj as API.SearchModel;
                if (model != null)
                {
                    models.AddRange(model.Result as List <API.TypeInfo>);
                    this.page.PageSize = (int)pagesize.Value;
                    string[] data = new string[model.AllPages];
                    //PagedCollectionView pcv = new PagedCollectionView(data);

                    this.page.PageIndexChanged -= page_PageIndexChanged;
                    this.page.Source            = data;
                    this.page.PageIndexChanged += page_PageIndexChanged;
                    this.page.PageIndex         = pageindex;
                }
            }
            GridList.Rebind();
        }
コード例 #16
0
        private void LoginCompleted(object sender, API.ExecuteCompletedEventArgs e)
        {
            this.busy.IsBusy = false;
            if (e.Result.ReturnValue)
            {
                API.UserInfo user = e.Result.Obj as API.UserInfo;

                IntPtr p = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this.pwd.SecurePassword);
                // 使用.NET内部算法把IntPtr指向处的字符集合转换成字符串
                string password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(p);
                if (user.Pwd == Security.GetMD5_32(password))
                {
                    Store.CurrentUser = user;
                    Store.IsLogin     = true;
                    Store.CurrentRole = e.Result.Arr[0] as API.RoleInfo;

                    API.Result result = RequestHelper.Request(this.busy, (int)MethodType.GetTypeInfoList, new List <object>()
                    {
                    });
                    if (result.ReturnValue)
                    {
                        List <BMS.API.TypeInfo> list = result.Obj as List <BMS.API.TypeInfo>;
                        Store.TypeInfos.AddRange(list);
                    }

                    API.Result result2 = RequestHelper.Request(this.busy, (int)MethodType.GetMenuInfoList, new List <object>()
                    {
                    });
                    if (result2.ReturnValue)
                    {
                        List <BMS.API.MenuInfo> list = result2.Obj as List <BMS.API.MenuInfo>;
                        Store.MenuInfos.AddRange(list);
                    }

                    //获取所有用户
                    API.Result result3 = RequestHelper.Request(this.busy, (int)MethodType.GetAllUsers, new List <object>()
                    {
                    });
                    if (result3.ReturnValue)
                    {
                        List <BMS.API.UserInfo> list = result3.Obj as List <BMS.API.UserInfo>;
                        Store.UserInfos.AddRange(list);
                    }

                    //NavigationWindow window = new NavigationWindow();
                    //window.Source = new Uri("Main.xaml", UriKind.Relative);
                    //window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    //window.Show();
                    Main m = new Main();
                    m.Show();
                    this.Close();
                }
                else
                {
                    errorMsg.Text = "密码错误!";
                    Tool.PlayForegAnimation(errorMsg);
                }
            }
            else
            {
                errorMsg.Text = e.Result.Message;
                Tool.PlayForegAnimation(errorMsg);
            }
        }