protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.productCheck); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { int usrId = int.Parse(Session["usrId"] as string); #region productStockGV DataSet myDst = new DataSet(); ProductStockProcess pspView = new ProductStockProcess(myDst); pspView.RealProductStockCheckManView(); DataTable taskTable = pspView.MyDst.Tables["view_productStockCheckMan"].DefaultView.ToTable(); string strFilter = " usrId = " + usrId;// + //" and productCheck = " + "'" + "unChecked".ToString() + "'"; dt_modify(taskTable, strFilter); Session["ProductStockProcess"] = pspView; Session["dtSources"] = taskTable; productStockGV.DataSource = Session["dtSources"]; productStockGV.DataBind(); #endregion } }
protected void btnRtn_Click(object sender, EventArgs e) { int usrId = int.Parse(Session["usrId"] as string); DataSet myDst = new DataSet(); ProductStockProcess pspView = new ProductStockProcess(myDst); pspView.RealProductStockCheckManView(); DataTable taskTable = pspView.MyDst.Tables["view_productStockCheckMan"].DefaultView.ToTable(); string strFilter = " usrId = " + usrId; DataRow dr = (DataRow)taskTable.Rows[0]; Response.Buffer = true; Response.Clear(); Response.ContentType = dr["contentType"].ToString(); Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(dr["checkTextName"].ToString(), System.Text.Encoding.UTF8)); Response.BinaryWrite((Byte[])dr["productCheckText"]); Response.Flush(); Response.End(); }