protected void GrDelete(object sender, CommandEventArgs e) { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; nUserLogin.CheckRole("CA0009"); if (!nUserLogin.Role.Del) { Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>"); } else { try { int mKey = int.Parse(e.CommandArgument.ToString()); Pesticide_Cooperative_Info info = new Pesticide_Cooperative_Info(mKey); info.Delete(); DataTable nTable = Pesticide_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); GV_Pesticide_Cooperative.DataSource = nTable; GV_Pesticide_Cooperative.DataBind(); LoadPages(); } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } } }
private void LoadData() { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); DataTable nTable = Pesticide_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); GV_Pesticide_Cooperative.DataSource = nTable; GV_Pesticide_Cooperative.DataBind(); LoadPages(); }
protected void cmdView_Click1(object sender, ImageClickEventArgs e) { txtPageNumber.Text = "1"; int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); DataTable nTable = Pesticide_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); GV_Pesticide_Cooperative.DataSource = nTable; GV_Pesticide_Cooperative.DataBind(); LoadPages(); }
protected void LoadPages() { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); int nTotalRecord = Pesticide_Cooperative_Data.Count(txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); if (nTotalRecord > nPageSize) { PageNumbers.Visible = true; DataTable nTable = TNLibrary.WEB.LoadDataToToolboxWeb.LoadPageSize(nPageSize, nTotalRecord, nPageNumber); PageNumbers.SelectedIndex = (nPageNumber - 1) - (int.Parse(nTable.Rows[0][0].ToString()) - 1); PageNumbers.DataSource = nTable; PageNumbers.DataBind(); } else { PageNumbers.Visible = false; } }