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"]; DateTime dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime dtto = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); DataTable nTable = HandlingPackaging_Data.GetList(dtfrom, dtto, Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber); GV_HandlingPackaging.DataSource = nTable; GV_HandlingPackaging.DataBind(); LoadPages(); }
public void LoadData() { int nPageNumber = int.Parse(txtPageNumber.Text); int nPageSize = int.Parse(txtPageSize.Text); SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"]; DataTable nTable = HandlingPackaging_Data.GetList(Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber); GV_HandlingPackaging.DataSource = nTable; GV_HandlingPackaging.DataBind(); DateTime dt = DateTime.Now; txtfromDatetime.Text = "01/" + DateTime.Now.ToString("MM/yyyy"); txttoDatetime.Text = DateTime.Now.ToString("dd/MM/yyyy"); 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("CU0008"); 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()); Harvest_Info info = new Harvest_Info(mKey); if ((DateTime.Now - info.DateOn).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 = HandlingPackaging_Data.GetList(Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber); GV_HandlingPackaging.DataSource = nTable; GV_HandlingPackaging.DataBind(); LoadPages(); } } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } } }