protected void cmdView_Click1(object sender, ImageClickEventArgs e) { txtPageNumber.Text = "1"; int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; DataTable nTable = ProcessPlantDetail_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, _key); if (nTable.Rows.Count == 0) { nTable.Rows.Add(0, 0, "", 0); } GV_List.DataSource = nTable; GV_List.DataBind(); LoadPages(); }
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("CU0002"); //if (!nUserLogin.Role.Del)W //{ // 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()); ProcessPlantDetail_Info info = new ProcessPlantDetail_Info(mKey); //if ((DateTime.Now - info.CreatedDateTime).TotalDays > 7) //{ // Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>"); //} //else { info.Delete(); DataTable nTable = ProcessPlantDetail_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, _key); if (nTable.Rows.Count == 0) { nTable.Rows.Add(0, 0, "", 0); } GV_List.DataSource = nTable; GV_List.DataBind(); LoadPages(); } } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } } }
public void LoadData() { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; DataTable nTable = ProcessPlantDetail_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, _key); if (_key != 0) { ProcessPlant_Info info = new ProcessPlant_Info(_key); Session["ProcessPlant_Type"] = info.ProcessPlant_Type; } if (nTable.Rows.Count == 0) { nTable.Rows.Add(0, 0, "", 0); } nTable.Columns.Add(); GV_List.DataSource = nTable; GV_List.DataBind(); DateTime dt = DateTime.Now; LoadPages(); }