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; } }
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; } }
void Search() { if (!flag) { return; } API.SearchModel model = new API.SearchModel(); model.Conditions = new Dictionary <string, object>(); model.PageSize = page.PageSize; model.CurrentPage = page.PageIndex; if (!string.IsNullOrEmpty(sc_typeName.Text)) { if (!Security.ValidateInput(sc_typeName.Text)) { Tool.PlayBackgAnimation(sc_typeName); return; } model.Conditions.Add("BTypeName", sc_typeName.Text); } RequestHelper.RequestAsync(this.busy, (int)MethodType.SearchBType, new List <object>() { model }, new EventHandler <API.ExecuteCompletedEventArgs>(GetCompleted)); }
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; } }
private void Search() { if (!flag) { return; } API.SearchModel model = new API.SearchModel(); model.CurrentPage = page.PageIndex; model.PageSize = (int)pagesize.Value; model.Conditions = new Dictionary <string, object>(); if (!string.IsNullOrEmpty(user.Text)) { model.Conditions.Add("Borower", user.Text); } ComboBoxItem cb = isBorow.SelectedItem as ComboBoxItem; if (cb.Content.ToString() == "已还") { model.Conditions.Add("IsReturn", 1); } else if (cb.Content.ToString() == "未还") { model.Conditions.Add("IsReturn", 0); } RequestHelper.RequestAsync(this.busy, MethodType.SearchBHist, new List <object>() { model }, new EventHandler <API.ExecuteCompletedEventArgs>(GetCompleted)); }
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(); }
private void SearchBook() { if (!flag) { return; } API.SearchModel model = new API.SearchModel(); model.Conditions = new Dictionary <string, object>(); model.PageSize = page.PageSize; model.CurrentPage = page.PageIndex; if (!string.IsNullOrEmpty(sc_author.Text)) { if (!Security.ValidateInput(sc_author.Text)) { Tool.PlayBackgAnimation(sc_author); return; } model.Conditions.Add("BAuthor", sc_author.Text); } if (!string.IsNullOrEmpty(sc_bookName.Text)) { if (!Security.ValidateInput(sc_bookName.Text)) { Tool.PlayBackgAnimation(sc_bookName); return; } model.Conditions.Add("BookName", sc_bookName.Text); } if (!string.IsNullOrEmpty(sc_publisher.Text)) { if (!Security.ValidateInput(sc_publisher.Text)) { Tool.PlayBackgAnimation(sc_publisher); return; } model.Conditions.Add("Publisher", sc_publisher.Text); } if (!string.IsNullOrEmpty(sc_bkey.Text)) { if (!Security.ValidateInput(sc_bkey.Text)) { Tool.PlayBackgAnimation(sc_bkey); return; } model.Conditions.Add("BKey", sc_bkey.Text); } if ((int)sc_type.SelectedValue != -1) { model.Conditions.Add("BTypeID", sc_type.SelectedValue); } RequestHelper.RequestAsync(this.busy, (int)MethodType.SearchBook, new List <object>() { model }, new EventHandler <API.ExecuteCompletedEventArgs>(GetCompleted)); }