Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     NodeCode      = KingTop.Common.Utils.CheckSql(Request.QueryString["NodeCode"]);
     ctrManageList = new BLL.Content.ControlManageList(hdnModelID.Value, hdnTableName.Value);
     if (!Page.IsPostBack)
     {
         IsHaveRight("binddata");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Stopwatch stw = new Stopwatch();
            //stw.Start();


            //清空查询条件
            if (!string.IsNullOrEmpty(Request.QueryString["IsFirst"]))
            {
                SetModelCookies("search", null);
                SetModelCookies("searchlink", null);
                SetModelCookies("ModelPage", null);
                Response.Redirect(Request.Url.ToString().Replace("IsFirst=1", ""));
            }
            else if (Request.Form.Keys.Count == 0)
            {
                string urlreferrer = Request.UrlReferrer.ToString().ToLower().Replace("list", "").Replace("edit", "");
                string scriptname  = Request.ServerVariables["SCRIPT_NAME"].ToLower().Replace("list", "").Replace("edit", "");
                if (urlreferrer.IndexOf(scriptname) != -1)
                {
                    SearchWhere     = GetModelCookes("search");
                    SearchlinkWhere = GetModelCookes("searchlink");
                    ModelPageNum    = GetModelCookes("ModelPage");
                }
            }
            else if (Request.Form.Keys.Count > 0)
            {
                SetModelCookies("search", null);
                SetModelCookies("searchlink", null);
                SetModelCookies("ModelPage", null);
                pageindex = 1;
            }
            ctrManageList = new BLL.Content.ControlManageList(hdnModelID.Value, hdnTableName.Value);

            if (hdnDeliverAndSearchUrlParam != null)
            {
                ctrManageList.DeliverAndSearchUrlParam = hdnDeliverAndSearchUrlParam.Value;
            }

            if (hdnNotSearchField != null)
            {
                ctrManageList.NotSearchField = "," + hdnNotSearchField.Value.Replace(" ", "").ToLower() + ",";
            }

            ctrManageList.SiteID    = SiteID;
            ctrManageList.NodeCode  = NodeCode;
            ctrManageList.AccountID = Utils.ParseInt(GetLoginAccountId(), 0);
            ctrManageList.UserNo    = UserNo;
            ctrManageList.IP        = Request.UserHostAddress;

            if (IsPostBack)
            {
                LinkClick();
            }


            if (!string.IsNullOrEmpty(Request.QueryString["page"]))
            {
                SetModelCookies("ModelPage", Request.QueryString["page"]);
            }
            ctrManageList.BindEnabledFlowStep(rptFlowStep, rptFlowState);
            PageInit();

            string actList = "";

            SetRight(this.Page, rptListInfo, out actList);
            if (string.IsNullOrEmpty(actList))
            {
                return;
            }

            IsModelList = true;
            System.Text.StringBuilder    strb = new System.Text.StringBuilder();
            System.IO.StringWriter       sw   = new System.IO.StringWriter(strb);
            System.Web.UI.HtmlTextWriter htw  = new HtmlTextWriter(sw);
            this.Page.RenderControl(htw); //获取页面HTML代码
            //theForm.RenderControl(htw);
            string str = strb.ToString(); //str即为所需值。

            //theForm.InnerHtml = str;
            if (!string.IsNullOrEmpty(str))  //当前位置
            {
                string[] htmlArr = Utils.strSplit(str, "\r\n");
                str = str.Insert(str.IndexOf("<h4>位置:") + 7, GetPageNavByModelList(NodeCode));
            }
            //审核与取消审核,与操作码不一致
            if (("," + actList + ",").IndexOf(",Check,") != -1)
            {
                actList += ",PastFlowCheck";
            }
            if (("," + actList + ",").IndexOf(",CancelCheck,") != -1)
            {
                actList += ",CancelFlowCheck";
            }
            //构造正则表达式
            string[] arrActList = actList.Split(',');
            string   patternVar = "(?is)<input[^>]+type=\"(?:button|submit)\"[^>]+(?:id|BtnType)=\"(?:";//btnNew|Edit)\"[^>]*>";
            bool     IsStart    = true;

            for (int i = 0; i < arrActList.Length; i++)
            {
                if (string.IsNullOrEmpty(arrActList[i]))
                {
                    continue;
                }

                if (IsStart)
                {
                    IsStart     = false;
                    patternVar += "btn" + arrActList[i] + "|" + arrActList[i];
                }
                else
                {
                    patternVar += "|btn" + arrActList[i] + "|" + arrActList[i];
                }
            }
            patternVar += ")\"[^>]*>";
            //替换并输出html代码
            str = Regex.Replace(str, patternVar, "", RegexOptions.Singleline | RegexOptions.IgnoreCase);
            Response.Write(str);


            //Response.Write("程序共运行时间:" + stw.Elapsed.Seconds.ToString() + "秒," + stw.Elapsed.Milliseconds.ToString() + "毫秒");
            Response.End();
        }