public ActionResult Author(int id) { try { SearchBookBUS bus = new SearchBookBUS(); SearchBookDTO dto = new SearchBookDTO() { Info1 = id.ToString(), PageNumber = 1, SearchType = SearchType.DETAIL_SEARCH }; int count = bus.SearchBooksByAuthorCount(dto); return View(new SearchResultModels() { Author = id, Results = bus.SearchBooksByAuthor(dto), NoP = (int) Math.Ceiling((double)count / ((double)Options.NumberOfRecord)), NumberOfResult = count, CurrentPage = dto.PageNumber }); } catch { return View(); } }
public ActionResult Author(FormCollection collection) { try { SearchBookBUS bus = new SearchBookBUS(); SearchBookDTO dto = new SearchBookDTO() { Info1 = collection["txtAuthor"], PageNumber = int.Parse(collection["txtPageNum"]), SearchType = SearchType.DETAIL_SEARCH }; int count = bus.SearchBooksByAuthorCount(dto); return View(new SearchResultModels() { Author = int.Parse(collection["txtAuthor"]), Results = bus.SearchBooksByAuthor(dto), NoP = (int) Math.Ceiling((double)count / ((double)Options.NumberOfRecord)), NumberOfResult = count, CurrentPage = dto.PageNumber }); } catch { return View(); } }
private void btnSearch_Click(object sender, EventArgs e) { if(this.Type==1) { SearchUserDTO dto=new SearchUserDTO(); dto.UserName = txtInformation.Text; SearchUserBUS bus=new SearchUserBUS(); grdSimpleInfo.DataSource = bus.SearchSimpleUser(dto); } else if (this.Type == 2) { SearchBookDTO dto=new SearchBookDTO(); dto.Info1 = txtInformation.Text; SearchBookBUS bus=new SearchBookBUS(); grdSimpleInfo.DataSource = bus.SearchBarcode(dto); } else { SearchBookDTO dto = new SearchBookDTO(); dto.Info1 = txtInformation.Text; SearchBookBUS bus = new SearchBookBUS(); grdSimpleInfo.DataSource = bus.SearchCatalogue(dto); } }
public ActionResult Category(string id) { try { SearchBookBUS bus = new SearchBookBUS(); SearchBookDTO dto = new SearchBookDTO() { Info2 = id, PageNumber = 1, SearchType = SearchType.DETAIL_SEARCH }; int count = bus.SearchBooksCount(dto); return View(new SearchResultModels() { ParentCate = id, Results = bus.SearchBooks(dto), NoP = (int) Math.Ceiling((double)count / ((double)Options.NumberOfRecord)), NumberOfResult = count, CurrentPage = dto.PageNumber }); } catch { return View(); } }
public ActionResult Index(FormCollection collection) { try { bool isByTitle = collection["chkTitle"] != null; bool isByContent = collection["chkContent"] != null; bool isByAuthor = collection["chkAuthor"] != null; SearchBookBUS bus = new SearchBookBUS(); SearchBookDTO dto = new SearchBookDTO() { Info1 = isByTitle ? collection["txtKeyword"] : "", Info2 = collection["lstCategories"], Info3 = isByContent ? collection["txtKeyword"] : "", Info4 = isByAuthor ? collection["txtKeyword"] : "", PageNumber = int.Parse(collection["txtPageNum"]), SearchType = SearchType.DETAIL_SEARCH }; int count = bus.SearchBooksCount(dto); return View(new SearchResultModels() { KeyWord = collection["txtKeyword"], SearchByAuthor = isByAuthor, SearchByContent = isByContent, SearchByTitle = isByTitle, CateToSearch = collection["lstCategories"], Results = bus.SearchBooks(dto), NoP = (int) Math.Ceiling((double)count / ((double)Options.NumberOfRecord)), NumberOfResult = count, CurrentPage = dto.PageNumber }); } catch { return View(); } }
private void cbePage_SelectedIndexChanged(object sender, EventArgs e) { SearchBookBUS bbus = new SearchBookBUS(); // get result list lst.Clear(); int tmp; dto.PageNumber = int.TryParse(cbePage.Text, out tmp) ? tmp : 1; lst.AddRange(bbus.SearchBooks(dto)); //grcCatalogue.DataSource = lst; grcCatalogue.RefreshDataSource(); //grcCatalogue.CausesValidation = true; }
public BookInfoForm() { InitializeComponent(); grcCatalogue.DataSource = lst; CategoryBUS bus = new CategoryBUS(); _lstCate.Add(new CategoryDTO() { CategoryId = "", CategoryName = "--Tất cả danh mục--" }); _lstCate.AddRange(bus.GetAllCatagory()); foreach (CategoryDTO categoryDTO in _lstCate) { for (int i = 0; i < categoryDTO.CategoryId.Split('.').Length - 1; i++) { categoryDTO.CategoryName = "|--" + categoryDTO.CategoryName; } } cbeDetailCategory.DataSource = _lstCate; cboxField1.SelectedIndex = 0; cboxField2.SelectedIndex = 0; cboxField3.SelectedIndex = 0; cboxAno1.SelectedIndex = 0; cboxAno2.SelectedIndex = 0; cboxType1.SelectedIndex = 0; cboxType2.SelectedIndex = 0; cboxType3.SelectedIndex = 0; SearchBookBUS bbus = new SearchBookBUS(); int stype = 1; dto = new SearchBookDTO(); dto.Info1 = txtTitle.Text; dto.PageNumber = 1; dto.SearchType = (SearchType)stype; //grcCatalogue.DataSource = bbus.SearchBooks(dto); lst.Clear(); lst.AddRange(bbus.SearchBooks(dto)); grcCatalogue.RefreshDataSource(); int NoR = bbus.SearchBooksCount(dto); lblResult.Text = NoR.ToString(); int pages = (int)Math.Ceiling(((double)NoR) / ((double)Options.NumberOfRecord)); cbePage.Items.Clear(); cbePage.Text = ""; for (int i = 1; i <= pages; i++) { cbePage.Items.Add(i); } if (pages != 0) { cbePage.SelectedIndex = 0; } }
private void btnSearch_Click(object sender, EventArgs e) { SearchBookBUS bbus = new SearchBookBUS(); int stype = xtraTabControl1.SelectedTabPageIndex; dto = new SearchBookDTO(); if (stype == 0) { dto.Info1 = txtTitle.Text; dto.PageNumber = 1; dto.SearchType = (SearchType)stype; } else if (stype == 1) { dto.Info1 = txtDetailTitle.Text; dto.Info2 = ((CategoryDTO)cbeDetailCategory.SelectedValue).CategoryId; dto.Info3 = txtShortDesc.Text; dto.Info4 = txtAuthorName.Text; dto.Cate = ((CategoryDTO)cbeDetailCategory.SelectedValue).CategoryId; dto.PageNumber = 1; dto.SearchType = (SearchType)stype; } else if (stype == 2) { dto.Info1 = txtInfo1.Text; dto.Info2 = txtInfo2.Text; dto.Info3 = txtInfo3.Text; dto.Field1 = cboxField1.SelectedItem.ToString(); dto.Field2 = cboxField2.SelectedItem.ToString(); dto.Field3 = cboxField3.SelectedItem.ToString(); dto.Type1 = cboxType1.SelectedIndex; dto.Type2 = cboxType2.SelectedIndex; dto.Type3 = cboxType3.SelectedIndex; dto.Ano1 = cboxAno1.SelectedItem.ToString(); dto.Ano2 = cboxAno2.SelectedItem.ToString(); dto.PageNumber = 1; dto.SearchType = (SearchType) stype; } // get number of results lst.Clear(); lst.AddRange(bbus.SearchBooks(dto)); grcCatalogue.RefreshDataSource(); // grcCatalogue.DataSource = lst; int NoR = bbus.SearchBooksCount(dto); lblResult.Text = NoR.ToString(); int pages = (int)Math.Ceiling(((double)NoR) / ((double)Options.NumberOfRecord)); cbePage.Items.Clear(); cbePage.Text = ""; for (int i = 1; i <= pages; i++) { cbePage.Items.Add(i); } if (pages != 0) { cbePage.SelectedIndex = 0; } }