getResourceByApplication(int applicationID, int curPage) { try { ResourceManager rsMan = new ResourceManager(); ResourceCollection resources = rsMan.FindResourcesByApplication(applicationID); PagedDataSource page = new PagedDataSource(); page.AllowPaging = true; page.PageSize = pagesize; page.CurrentPageIndex = curPage; page.DataSource = resources; Pager1.SetPageNumber(page.PageCount, curPage); dgridResource.DataSource = page; dgridResource.DataBind(); CurrentFormState = FormState.Default; } catch (Exception ex) { ucErrorBox.Message = "Get resources by Application: " + ex.Message; CurrentFormState = FormState.ErrorState; this.SaveErrorLog(ex); } }
private void LoadApplicationList(int curPage) { ApplicationManager app = new ApplicationManager(); ApplicationCollection apps = new ApplicationCollection(); apps = app.GetAllApplications(); if (apps.Count == 0) { uctErrorBox.Visible = true; uctErrorBox.Message = "Không có dữ liệu"; return; } PagedDataSource page = new PagedDataSource(); page.AllowPaging = true; page.PageSize = pagesize; page.CurrentPageIndex = curPage; page.DataSource = apps; //if (!IsPostBack) //{ Pager1.SetPageNumber(page.PageCount, curPage); //} dgridApplicationList.DataSource = page; dgridApplicationList.DataBind(); }
private void FindResource(string searchBy, string keyword, int curPage) { ResourceManager rsMan = new ResourceManager(); ResourceCollection resources = new ResourceCollection(); try { if (keyword == "") { resources = rsMan.FindResourcesByApplication(int.Parse(keyword)); } else { switch (searchBy) { case "name": resources = rsMan.FindResourcesByName(keyword); break; case "path": resources = rsMan.FindResourcesByPath(keyword); break; default: break; } ResourceCollection resourcesTemp = resources; resources = rsMan.FilterResourceByApplication(resourcesTemp, int.Parse(ddlApplications.SelectedValue)); } } catch (Exception ex) { ucErrorBox.Message = "FindResource by " + searchBy + ": " + ex.Message; CurrentFormState = FormState.ErrorState; this.SaveErrorLog(ex); } if (resources.Count > 0) { CurrentFormState = FormState.Default; PagedDataSource page = new PagedDataSource(); page.AllowPaging = true; page.PageSize = pagesize; page.CurrentPageIndex = curPage; page.DataSource = resources; Pager1.SetPageNumber(page.PageCount, curPage); dgridResource.DataSource = page; dgridResource.DataBind(); } else { CurrentFormState = FormState.NoDataState; } }