public void Execute(bool dialog) { string url = AddParam(); if (dialog) { url += "&Dialog=true"; } if (SessionRequest.Enable) { SessionRequest sessionRequest = new SessionRequest(this.Page); url = "../InnerPages/frmAnyQuery.aspx?" + sessionRequest.SetRequestValue(url); } else { url = "../InnerPages/frmAnyQuery.aspx?" + QueryStringEncrypt.Encrypt(url); } if (dialog) { string script = string.Format("<script>window.open('{0}','query','left=200,top=200,width=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');</script>", url); Page.ClientScript.RegisterStartupScript(typeof(string), Guid.NewGuid().ToString(), script); } else { Page.Response.Redirect(url); } }
private void DoQuery(WebDataSource ds) { if (this.QueryMode == QueryModeType.Normal) { string param = "MultiLan=" + this.MultiLanguage.ToString() + "&Params="; DataColumnCollection dcc = (ds.CommandTable == null) ? ds.InnerDataSet.Tables[0].Columns : ds.CommandTable.Columns; // 添加要用于查询的字段 StringBuilder Params = new StringBuilder(); StringBuilder DataTypes = new StringBuilder(); StringBuilder Conditions = new StringBuilder(); StringBuilder IsNvarchars = new StringBuilder(); if (this.QueryFields.Count > 0) { foreach (WebQueryField f in this.QueryFields) { if (dcc.Contains(f.FieldName)) { Params.Append(dcc[f.FieldName].ColumnName); Params.Append(";"); DataTypes.Append(dcc[f.FieldName].DataType); DataTypes.Append(";"); Conditions.Append(f.Condition); Conditions.Append(";"); IsNvarchars.Append(f.IsNvarChar); IsNvarchars.Append(";"); } } } else { foreach (DataColumn dc in dcc) { Params.Append(dc.ColumnName); Params.Append(";"); DataTypes.Append(dc.DataType); DataTypes.Append(";"); } } param += Params.Remove(Params.Length - 1, 1).ToString(); param += "&DataTypes="; param += DataTypes.Remove(DataTypes.Length - 1, 1).ToString(); if (Conditions.Length > 0) { param += "&Conditions="; param += Conditions.Remove(Conditions.Length - 1, 1).ToString(); } if (IsNvarchars.Length > 0) { param += "&IsNvarchars="; param += IsNvarchars.Remove(IsNvarchars.Length - 1, 1).ToString(); } // 添加原始page的url param += "&PagePath=" + Page.Request.FilePath; // 添加query的对象(WebDataSource) param += "&DataSourceID=" + ds.ID; // 添加query的dataset对象id, 和DbAlias, CommandText对象 string dsId = "", selAlias = "", cmdText = ""; dsId = ds.WebDataSetID; selAlias = ds.SelectAlias; cmdText = ds.SelectCommand; param += "&DataSetID=" + dsId + "&DbAlias=" + selAlias + "&CommandText=" + cmdText; string itemparam = this.Page.Request.QueryString["ItemParam"] != null ? HttpUtility.UrlEncode(this.Page.Request.QueryString["ItemParam"]) : string.Empty; param += "&ItemParam=" + itemparam; string flowUrl = this.getFlowUrl(); param += flowUrl; if (QueryStyle == QueryStyleType.Dialog) { param += "&Dialog=true"; } string url = @"../InnerPages/frmNavQuery.aspx?"; if (SessionRequest.Enable) { SessionRequest sessionRequest = new SessionRequest(this.Page); url += sessionRequest.SetRequestValue(param); } else { url += param; } if (QueryStyle == QueryStyleType.NewPage) { Page.Response.Redirect(url); } else { string script = string.Format("window.open('{0}','','left=200,top=200,width=600,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no')" , url, flowUrl); ScriptHelper.RegisterStartupScript(this, script); } } else if (this.QueryMode == QueryModeType.ClientQuery) { WebClientQuery wcq = CopyQueryFileds(1, true); if (QueryStyle == QueryStyleType.NewPage) { wcq.Execute(); } else { wcq.Execute(true); } } else if (this.QueryMode == QueryModeType.AnyQuery) { WebAnyQuery waq = CopyAnyQueryFileds(1, true); if (QueryStyle == QueryStyleType.NewPage) { waq.Execute(); } else { waq.Execute(true); } } }