コード例 #1
0
ファイル: ForSale.aspx.cs プロジェクト: DHLONGAN/VietGAP
 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("CU0007");
     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 = ForSale_Data.GetList(Convert.ToInt16( Session["EmployeeKey"]), nPageSize, nPageNumber);
                 GV_ForSale.DataSource = nTable;
                 GV_ForSale.DataBind();
                 LoadPages();
             }
         }
         catch
         {
             Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
         }
     }
 }
コード例 #2
0
ファイル: ForSale.aspx.cs プロジェクト: DHLONGAN/VietGAP
 protected void cmdView_Click1(object sender, ImageClickEventArgs e)
 {
     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 = ForSale_Data.GetList(dtfrom, dtto, Convert.ToInt16( Session["EmployeeKey"]), nPageSize, nPageNumber);
     GV_ForSale.DataSource = nTable;
     GV_ForSale.DataBind();
     LoadPages();
 }
コード例 #3
0
ファイル: ForSale.aspx.cs プロジェクト: DHLONGAN/VietGAP
 public void LoadData()
 {
     int nPageNumber = int.Parse(txtPageNumber.Text);
     int nPageSize = int.Parse(txtPageSize.Text);
     SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];
     DataTable nTable = ForSale_Data.GetList(Convert.ToInt16( Session["EmployeeKey"]), nPageSize, nPageNumber);
     GV_ForSale.DataSource = nTable;
     GV_ForSale.DataBind();
     DateTime dt = DateTime.Now;
     txtfromDatetime.Text = "01/" + DateTime.Now.ToString("MM/yyyy");
     txttoDatetime.Text = DateTime.Now.ToString("dd/MM/yyyy");
     LoadPages();
 }