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("CA0008"); 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()); Fertilizers_Cooperative_Info info = new Fertilizers_Cooperative_Info(mKey); info.Delete(); DataTable nTable = Fertilizers_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); if (nTable.Rows.Count == 0) { nTable.Rows.Add("", 0, 0, 0, new Guid(), DateTime.Now, new Guid(), DateTime.Now); } GV_Fertilizers_Cooperative.DataSource = nTable; GV_Fertilizers_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 = Fertilizers_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); GV_Fertilizers_Cooperative.DataSource = nTable; if (nTable.Rows.Count == 0) { nTable.Rows.Add("", 0, 0, 0, null, null, null, null); // "", "", 0); } GV_Fertilizers_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 = Fertilizers_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString())); if (nTable.Rows.Count == 0) { nTable.Rows.Add("", 0, 0, 0, new Guid(), DateTime.Now, new Guid(), DateTime.Now); } GV_Fertilizers_Cooperative.DataSource = nTable; GV_Fertilizers_Cooperative.DataBind(); LoadPages(); }