protected override object[] LoadDataSource(int inclusive, int exclusive) { string strValue = this.drpRptId.SelectedValue; if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } object objEntry = rptFacade.GetRptViewEntry(strValue); if (objEntry != null) { RptViewEntry entry = (RptViewEntry)objEntry; if (entry.EntryType == ReportEntryType.Report && entry.ReportID != "") { RptViewUserDefault objDef = (RptViewUserDefault)rptFacade.GetRptViewUserDefault(this.GetUserCode()); this.chkReportAsDefault.Checked = false; if (objDef != null && objDef.DefaultReportID == entry.ReportID) { this.chkReportAsDefault.Checked = true; } object[] objs = rptFacade.GetNeedInputByReportId(entry.ReportID, this.GetUserCode()); this.pagerToolBar.RowCount = objs.Length; return(objs); } } this.chkReportAsDefault.Checked = false; this.pagerToolBar.RowCount = 0; return(null); }
protected override object[] LoadDataSource(int inclusive, int exclusive) { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } return(this._facade.QueryRptViewEntryByParent(this.txtEntryCodeQuery.Text, inclusive, exclusive)); }
protected override void UpdateDomainObject(object domainObject) { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } this._facade.UpdateRptViewReportStyle((RptViewReportStyle)domainObject); }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } this._facade.DeleteRptViewEntryWithReport((RptViewEntry[])domainObjects.ToArray(typeof(RptViewEntry))); }
protected override void UpdateDomainObject(object domainObject) { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } this._facade.UpdateRptViewEntry((RptViewEntry)domainObject); }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } this._facade.DeleteRptViewReportStyle((RptViewReportStyle[])domainObjects.ToArray(typeof(RptViewReportStyle))); }
protected override int GetRowCount() { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } return(this._facade.QueryRptViewEntryByParentCount(this.txtEntryCodeQuery.Text)); }
protected override void AddDomainObject(object domainObject) { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } ((RptViewReportStyle)domainObject).StyleID = _facade.GetNextStyleID(); this._facade.AddRptViewReportStyle((RptViewReportStyle)domainObject); }
protected override int GetRowCount() { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } return(this._facade.QueryRptViewReportStyleByNameCount( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtStyleNameQuery.Text)))); }
protected void Page_Load(object sender, System.EventArgs e) { if (this.IsPostBack == false) { // 初始化页面语言 this.InitPageLanguage(this.languageComponent1, false); this.cmdQuery.Visible = false; spanMsg.Visible = false; this.ReportViewer1.Visible = false; if (this.ReportID == "") { //throw new Exception("$Error_RequestUrlParameter_Lost"); spanMsg.Visible = true; spanMsg.InnerText = this.languageComponent1.GetString("$Error_RequestUrlParameter_Lost"); return; } if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(this.ReportID); if (designMain == null) { //throw new Exception("$Error_RequestUrlParameter_Lost"); spanMsg.Visible = true; spanMsg.InnerText = this.languageComponent1.GetString("$Error_RequestUrlParameter_Lost"); return; } lblRptViewTitle.Text = designMain.ReportName; if (this.GetRequestParam("preview") != "1") { if (designMain.Status != ReportDesignStatus.Publish) { //throw new Exception("$ReportView_Status_Error"); spanMsg.Visible = true; spanMsg.InnerText = this.languageComponent1.GetString("$ReportView_Status_Error"); return; } } if (this.GetRequestParam("preview") != "1" && CheckAccessReportRight() == false) { //throw new Exception("$ReportView_No_Right_ViewReport [" + designMain.ReportName + "]"); spanMsg.Visible = true; spanMsg.InnerText = this.languageComponent1.GetString("$ReportView_No_Right_ViewReport") + " [" + designMain.ReportName + "]"; return; } this.txtDataCount.Text = "0"; this.cmdQuery.Visible = true; this.ReportViewer1.Visible = true; this.lblRptViewTitle.Text = designMain.ReportName; if (existNeedInputField == false) { //this.cmdQuery_ServerClick(null, null); } } }
private void CreateInputField() { if (this.ReportID == "") { return; } if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } designMain = (RptViewDesignMain)rptFacade.GetRptViewDesignMain(this.ReportID); if (designMain == null) { return; } if (this.GetRequestParam("preview") != "1") { if (designMain.Status != ReportDesignStatus.Publish) { return; } } if (this.IsPostBack == false && this.GetRequestParam("preview") != "1") { if (CheckAccessReportRight() == false) { return; } } RptViewUserSubscription[] userSubscr = rptFacade.GetNeedInputByReportId(this.ReportID, this.GetUserCode()); RptViewFilterUI[] filterUI = rptFacade.GetRptViewFilterUIByReportId(this.ReportID); // 添加控件 this.tbInput.Rows.Clear(); for (int i = 0; i < userSubscr.Length;) { HtmlTableRow row = new HtmlTableRow(); for (int n = 0; n < 3; n++) { if (i <= userSubscr.Length - 1) { if (userSubscr[i].InputValue == "") { existNeedInputField = true; } HtmlTableCell[] cells = GenerateCell(userSubscr[i], filterUI); row.Cells.Add(cells[0]); row.Cells.Add(cells[1]); i++; } } this.tbInput.Rows.Add(row); } }
protected override object[] LoadDataSource(int inclusive, int exclusive) { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } return(this._facade.QueryRptViewReportStyleByName( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtStyleNameQuery.Text)), inclusive, exclusive)); }
protected override void AddDomainObject(object domainObject) { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } RptViewEntry entry = (RptViewEntry)domainObject; entry.EntryType = ReportEntryType.Folder; entry.ParentEntryCode = this.txtEntryCodeQuery.Text; this._facade.AddRptViewEntry(entry); }
void cmdSave_ServerClick(object sender, EventArgs e) { _facade = new ReportViewFacade(this.DataProvider); this.DataProvider.BeginTransaction(); try { if (this.hidHeaderRow.Value != "") { RptViewDataFormat format = _facade.BuildDataFormatByStyle(this.hidHeaderRow.Value); format.MaintainUser = this.GetUserCode(); _facade.UpdateRptViewReportStyleDetail(decimal.Parse(this.GetRequestParam("styleid")), ReportStyleType.Header, format); } if (this.hidGroup_0.Value != "") { RptViewDataFormat format = _facade.BuildDataFormatByStyle(this.hidGroup_0.Value); format.MaintainUser = this.GetUserCode(); _facade.UpdateRptViewReportStyleDetail(decimal.Parse(this.GetRequestParam("styleid")), ReportStyleType.SubTotal, format); } if (this.hidItemHeader.Value != "") { RptViewDataFormat format = _facade.BuildDataFormatByStyle(this.hidItemHeader.Value); format.MaintainUser = this.GetUserCode(); _facade.UpdateRptViewReportStyleDetail(decimal.Parse(this.GetRequestParam("styleid")), ReportStyleType.Item, format); } if (this.hidGroupData_0_0.Value != "") { RptViewDataFormat format = _facade.BuildDataFormatByStyle(this.hidGroupData_0_0.Value); format.MaintainUser = this.GetUserCode(); _facade.UpdateRptViewReportStyleDetail(decimal.Parse(this.GetRequestParam("styleid")), ReportStyleType.SubTotalGroupField, format); } if (this.hidGroupData_0_1.Value != "") { RptViewDataFormat format = _facade.BuildDataFormatByStyle(this.hidGroupData_0_1.Value); format.MaintainUser = this.GetUserCode(); _facade.UpdateRptViewReportStyleDetail(decimal.Parse(this.GetRequestParam("styleid")), ReportStyleType.SubTotalNonCalField, format); } if (this.hidGroupData_0_2.Value != "") { RptViewDataFormat format = _facade.BuildDataFormatByStyle(this.hidGroupData_0_2.Value); format.MaintainUser = this.GetUserCode(); _facade.UpdateRptViewReportStyleDetail(decimal.Parse(this.GetRequestParam("styleid")), ReportStyleType.SubTotalCalField, format); } this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } finally { } }
protected override object GetEditObject(GridRecord row) { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } object obj = _facade.GetRptViewEntry(row.Items.FindItemByKey("RptEntryCode").Text.ToString()); if (obj != null) { return((RptViewEntry)obj); } return(null); }
protected override object GetEditObject(GridRecord row) { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } object obj = _facade.GetRptViewReportStyle(decimal.Parse(row.Items.FindItemByKey("StyleID").Text.ToString())); if (obj != null) { return((RptViewReportStyle)obj); } return(null); }
protected override object GetEditObject(GridRecord row) { if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } object obj = rptFacade.GetRptViewUserSubscription(this.GetUserCode(), row.Items.FindItemByKey("ReportID").Text, decimal.Parse(row.Items.FindItemByKey("Sequence").Value.ToString())); if (obj != null) { return(obj as RptViewUserSubscription); } return(null); }
/// <summary> /// 检查权限 /// </summary> /// <returns></returns> private bool CheckAccessReportRight() { SessionHelper sessionHelper = SessionHelper.Current(this.Session); if (sessionHelper.UserCode.ToUpper() == "ADMIN" || sessionHelper.IsBelongToAdminGroup == true) { return(true); } if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } return(rptFacade.CheckUserReportSecurity(this.ReportID, sessionHelper.UserCode)); }
protected override DataRow GetGridRow(object obj) { RptViewEntry entry = (RptViewEntry)obj; string strEntryTypeDesc = ""; RptViewDesignMain rptMain = null; if (entry.EntryType == ReportEntryType.Folder) { strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Folder); } else { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } rptMain = (RptViewDesignMain)this._facade.GetRptViewDesignMain(entry.ReportID); if (rptMain != null) { entry.EntryName = rptMain.ReportName; entry.Description = rptMain.Description; if (rptMain.ReportBuilder == ReportBuilder.OnLine) { strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_online"); } else { strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_offline"); } } } DataRow row = DtSource.NewRow(); row["RptEntrySequence"] = entry.Sequence; row["RptEntryCode"] = entry.EntryCode; row["RptEntryName"] = entry.EntryName; row["RptIsVisible"] = entry.Visible; row["RptEntryType"] = entry.EntryType; row["RptEntryTypeDesc"] = strEntryTypeDesc; row["ReportID"] = entry.ReportID; row["RptAccessRight"] = ""; row["RptView"] = ""; row["RptDownloadFile"] = ""; row["RptDesign"] = ""; row["RptPublish"] = ""; return(row); }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { // 初始化页面语言 this.InitPageLanguage(this.languageComponent1, false); if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } object[] objTmps = rptFacade.GetAllRptViewEntry(); if (objTmps != null) { RptViewEntry[] entityList = new RptViewEntry[objTmps.Length]; objTmps.CopyTo(entityList, 0); InitReportFolderList(entityList); } } }
protected override string[] FormatExportRecord(object obj) { RptViewEntry entry = (RptViewEntry)obj; string strEntryTypeDesc = ""; RptViewDesignMain rptMain = null; if (entry.EntryType == ReportEntryType.Folder) { strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Folder); } else { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } rptMain = (RptViewDesignMain)this._facade.GetRptViewDesignMain(entry.ReportID); if (rptMain != null) { entry.EntryName = rptMain.ReportName; entry.Description = rptMain.Description; if (rptMain.ReportBuilder == ReportBuilder.OnLine) { strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_online"); } else { strEntryTypeDesc = this.languageComponent1.GetString(ReportEntryType.Report + "_offline"); } } } string[] objRow = new string[] { entry.Sequence.ToString(), entry.EntryCode, entry.EntryName, entry.Visible, strEntryTypeDesc }; return(objRow); }
protected override object GetEditObject() { if (_facade == null) { _facade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); } RptViewReportStyle style = (RptViewReportStyle)_facade.GetRptViewReportStyle(decimal.Parse(this.txtStyleID.Text)); if (style == null) { style = this._facade.CreateNewRptViewReportStyle(); } style.Name = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtStyleNameEdit.Text, 40)); style.Description = this.txtStyleDescEdit.Text; style.MaintainUser = this.GetUserCode(); style.MaintainDate = FormatHelper.TODateInt(DateTime.Today); style.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); return(style); }
protected override object GetEditObject() { if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } RptViewEntry entry = this._facade.CreateNewRptViewEntry(); if (this.txtRptEntryCode.ReadOnly == true) { entry = (RptViewEntry)this._facade.GetRptViewEntry(this.txtRptEntryCode.Text); } entry.Sequence = decimal.Parse(this.txtRptEntrySequence.Text); entry.EntryCode = this.txtRptEntryCode.Text.Trim().ToUpper(); entry.EntryName = this.txtRptEntryName.Text.Trim().ToUpper(); entry.Description = this.txtRptEntryDesc.Text; entry.Visible = FormatHelper.BooleanToString(this.chkRptIsVisible.Checked); entry.MaintainUser = this.GetUserCode(); return(entry); }
/// <summary> /// 构建Menu树 /// </summary> private void BuildMenuTree() { this.treeMenu.Nodes.Clear(); if (this._facade == null) { this._facade = new ReportViewFacade(this.DataProvider); } object[] objs = this._facade.GetAllRptViewEntry(); if (objs == null || objs.Length == 0) { return; } RptViewEntry[] entryList = new RptViewEntry[objs.Length]; objs.CopyTo(entryList, 0); Node node = new Node(); node.Text = this.languageComponent1.GetString("ReportFolderRootNode"); this.treeMenu.Nodes.Add(node); BuildTreeSubNode(entryList, node, ""); this.treeMenu.ExpandAll(); }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { // 初始化页面语言 this.InitPageLanguage(this.languageComponent1, false); } dataSource = Request.QueryString["datasource"]; dataType = Request.QueryString["datatype"]; if (dataType.ToUpper() != "STATIC") { BenQGuru.eMES.ReportView.ReportViewFacade rFacade = new BenQGuru.eMES.ReportView.ReportViewFacade(this.DataProvider); object[] objs = rFacade.QueryDataSourceById(dataSource); if (objs != null && objs.Length > 0) { dataSource = ((BenQGuru.eMES.Domain.ReportView.RptViewDataSource)objs[0]).SQL; } } dataCode = Request.QueryString["datacode"]; dataDesc = Request.QueryString["datadesc"]; }
protected void ReportViewer1_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e) { Microsoft.Reporting.WebForms.LocalReport lr = e.Report as Microsoft.Reporting.WebForms.LocalReport; if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } RptViewDesignMain rptDesign = rptFacade.GetRptViewDesignMainByReportName(e.ReportPath.ToUpper()); RptViewUserSubscription[] viewerInput = new RptViewUserSubscription[lr.OriginalParametersToDrillthrough.Count]; RptViewDataSource dataSource = (RptViewDataSource)rptFacade.GetRptViewDataSource(designMain.DataSourceID); for (int i = 0; i < lr.OriginalParametersToDrillthrough.Count; i++) { viewerInput[i] = new RptViewUserSubscription(); viewerInput[i].InputName = lr.OriginalParametersToDrillthrough[i].Name; if (dataSource.SourceType == DataSourceType.SQL) { viewerInput[i].InputType = ReportViewerInputType.SqlFilter; viewerInput[i].SqlFilterSequence = i + 1; } else { viewerInput[i].InputType = ReportViewerInputType.DllParameter; } viewerInput[i].InputValue = lr.OriginalParametersToDrillthrough[i].Values[0]; } DataSet dsSource = rptFacade.ExecuteDataSetFromSource(rptDesign.ReportID, viewerInput, Server.MapPath("").ToString().Substring(0, Server.MapPath("").ToString().LastIndexOf("\\"))); lr.DataSources.Clear(); lr.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("MESRPT", dsSource.Tables[0])); }
private HtmlTableCell[] GenerateCell(RptViewUserSubscription userSubs, RptViewFilterUI[] filterUIList) { HtmlGenericControl title = new HtmlGenericControl(); title.InnerText = userSubs.EAttribute1; HtmlTableCell cellTitle = new HtmlTableCell(); cellTitle.NoWrap = true; cellTitle.Attributes.Add("class", "fieldNameLeft"); cellTitle.Controls.Add(title); RptViewFilterUI filterUI = null; if (filterUIList != null) { for (int i = 0; i < filterUIList.Length; i++) { if (filterUIList[i].InputType == userSubs.InputType && filterUIList[i].InputName == userSubs.InputName && filterUIList[i].SqlFilterSequence == userSubs.SqlFilterSequence) { filterUI = filterUIList[i]; break; } } } if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } RptViewFilterUI[] objUIs = rptFacade.GetRptViewFilterUIByReportIdAndSeq(this.ReportID, userSubs.InputName, userSubs.SqlFilterSequence); bool checkExist = false; if (objUIs != null && objUIs.Length > 0) { foreach (RptViewFilterUI objUI in objUIs) { if (objUI.CheckExist == "Y") { checkExist = true; break; } } } Control controlInput = null; if (filterUI == null || filterUI.UIType == ReportFilterUIType.InputText) { TextBox txt = new TextBox(); txt.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString(); txt.Attributes.Add("IsReportViewerInput", "1"); txt.Attributes.Add("InputName", userSubs.InputName); txt.Attributes.Add("InputType", userSubs.InputType); txt.Attributes.Add("InputDesc", userSubs.EAttribute1); txt.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString()); txt.Text = userSubs.InputValue; //Modified 2008/11/07 if (checkExist) { txt.CssClass = "require"; } else { txt.CssClass = "textbox"; } controlInput = txt; } else if (filterUI.UIType == ReportFilterUIType.CheckBox) { CheckBox chk = new CheckBox(); chk.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString(); chk.Attributes.Add("IsReportViewerInput", "1"); chk.Attributes.Add("InputName", userSubs.InputName); chk.Attributes.Add("InputType", userSubs.InputType); chk.Attributes.Add("InputDesc", userSubs.EAttribute1); chk.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString()); chk.Checked = FormatHelper.StringToBoolean(userSubs.InputValue); if (checkExist) { chk.CssClass = "require"; } else { chk.CssClass = "textbox"; } controlInput = chk; } else if (filterUI.UIType == ReportFilterUIType.Date) { TextBox dateCtl = new TextBox(); //BenQGuru.eMES.Web.UserControl.eMESDate dateCtl = (BenQGuru.eMES.Web.UserControl.eMESDate)Page.LoadControl("../UserControl/DateTime/DateTime/eMESDate.ascx"); dateCtl.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString(); dateCtl.Attributes.Add("IsReportViewerInput", "1"); dateCtl.Attributes.Add("InputName", userSubs.InputName); dateCtl.Attributes.Add("InputType", userSubs.InputType); dateCtl.Attributes.Add("InputDesc", userSubs.EAttribute1); dateCtl.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString()); dateCtl.Text = userSubs.InputValue; if (checkExist) { dateCtl.CssClass = "require datepicker"; } else { dateCtl.CssClass = "textbox datepicker"; } controlInput = dateCtl; } else if (filterUI.UIType == ReportFilterUIType.SelectQuery) { BenQGuru.eMES.Web.SelectQuery.SelectableTextBox txt = new BenQGuru.eMES.Web.SelectQuery.SelectableTextBox(); txt.Type = filterUI.SelectQueryType; txt.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString(); txt.Attributes.Add("IsReportViewerInput", "1"); txt.Attributes.Add("InputName", userSubs.InputName); txt.Attributes.Add("InputType", userSubs.InputType); txt.Attributes.Add("InputDesc", userSubs.EAttribute1); txt.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString()); txt.Text = userSubs.InputValue; txt.CanKeyIn = true; if (checkExist) { txt.CssClass = "require"; } else { txt.CssClass = "textbox"; } controlInput = txt; } else if (filterUI.UIType == ReportFilterUIType.DropDownList) { DropDownList drp = new DropDownList(); drp.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString(); drp.Attributes.Add("IsReportViewerInput", "1"); drp.Attributes.Add("InputName", userSubs.InputName); drp.Attributes.Add("InputType", userSubs.InputType); drp.Attributes.Add("InputDesc", userSubs.EAttribute1); drp.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString()); if (checkExist) { drp.CssClass = "require"; } else { drp.CssClass = "textbox"; } if (filterUI.ListDataSourceType == "static") { string[] strTmpList = filterUI.ListStaticValue.Split(';'); for (int i = 0; i < strTmpList.Length; i++) { if (strTmpList[i] != "" && strTmpList[i].IndexOf(",") >= 0) { string[] strTmpVal = strTmpList[i].Split(','); drp.Items.Add(new ListItem(strTmpVal[0], strTmpVal[1])); } } //Add 2008/11/05 如果是必选则不需要加空格选项,否则加空格选项代表是全选 //if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } //RptViewFilterUI[] objUIs = rptFacade.GetRptViewFilterUIByReportIdAndSeq(this.ReportID, userSubs.InputName); //if (objUIs != null && objUIs.Length > 0) //{ // foreach (RptViewFilterUI objUI in objUIs) // { // if (objUI.CheckExist == "N") // { // drp.Items.Insert(0,new ListItem("","")); // } // } //} if (!checkExist) { drp.Items.Insert(0, new ListItem("", "")); } } else { RptViewDataSource dataSource = (RptViewDataSource)rptFacade.GetRptViewDataSource(filterUI.ListDynamicDataSource); if (dataSource != null) { if (filterUI.ListDynamicTextColumn == "" && filterUI.ListDynamicValueColumn != "") { filterUI.ListDynamicTextColumn = filterUI.ListDynamicValueColumn; } if (filterUI.ListDynamicValueColumn == "" && filterUI.ListDynamicTextColumn != "") { filterUI.ListDynamicValueColumn = filterUI.ListDynamicTextColumn; } DataSet ds = rptFacade.ExecuteDataSetFromSource(dataSource, Server.MapPath("").ToString().Substring(0, Server.MapPath("").ToString().LastIndexOf("\\"))); string columnName = filterUI.ListDynamicTextColumn; string columnValue = filterUI.ListDynamicValueColumn; ds.Tables[0].DefaultView.Sort = columnName; for (int i = 0; i < ds.Tables[0].DefaultView.Count; i++) { string strOptItemText = ""; bool checkRe = false; if (ds.Tables[0].DefaultView[i][columnName] != System.DBNull.Value) { strOptItemText = ds.Tables[0].DefaultView[i][columnName].ToString(); } string strOptItemValue = ""; if (ds.Tables[0].DefaultView[i][columnValue] != System.DBNull.Value) { strOptItemValue = ds.Tables[0].DefaultView[i][columnValue].ToString(); } if (drp.Items.Count > 0) { for (int k = 0; k < drp.Items.Count; k++) { if (strOptItemValue == drp.Items[k].Value && strOptItemText == drp.Items[k].Text) { checkRe = true; break; } } } if (!checkRe) { drp.Items.Add(new ListItem(strOptItemText, strOptItemValue)); } } //Add 2008/11/05 如果是必选则不需要加空格选项,否则加空格选项代表是全选 if (!checkExist) { drp.Items.Insert(0, new ListItem("", "")); } } } if (drp.Items.FindByValue(userSubs.InputValue) != null) { drp.SelectedValue = userSubs.InputValue; } controlInput = drp; } //Add 2008/11/04 增加了复选框的查询 else if (filterUI.UIType == ReportFilterUIType.SelectComplex) { BenQGuru.eMES.Web.SelectQuery.SelectableTextBox txt = new BenQGuru.eMES.Web.SelectQuery.SelectableTextBox(); string[] strQueryType = filterUI.SelectQueryType.ToString().Split('#'); txt.Type = strQueryType[0]; HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); TextBox textBox1 = new TextBox(); TextBox textBox2 = new TextBox(); TextBox textBox3 = new TextBox(); TextBox textBox4 = new TextBox(); textBox1.ID = "txtDataSource" + userSubs.SqlFilterSequence.ToString("0000"); textBox2.ID = "txtDataType" + userSubs.SqlFilterSequence.ToString("0000"); textBox3.ID = "txtDataCode" + userSubs.SqlFilterSequence.ToString("0000"); textBox4.ID = "txtDataDesc" + userSubs.SqlFilterSequence.ToString("0000"); textBox2.Text = filterUI.ListDataSourceType; if (filterUI.ListDataSourceType.ToString().ToUpper() != "STATIC") { textBox3.Text = strQueryType[1]; textBox4.Text = strQueryType[2]; textBox1.Text = filterUI.ListDynamicDataSource.ToString(); } else { textBox1.Text = filterUI.ListStaticValue; } cell.Controls.Add(textBox1); cell.Controls.Add(textBox2); cell.Controls.Add(textBox3); cell.Controls.Add(textBox4); row.Cells.Add(cell); row.Attributes.Add("style", "display:none;"); this.tableTextBox.Rows.Add(row); txt.ID = "txtViewerInput_" + userSubs.InputType + "_" + userSubs.InputName + "_" + userSubs.SqlFilterSequence.ToString("0000"); txt.Attributes.Add("IsReportViewerInput", "1"); txt.Attributes.Add("InputName", userSubs.InputName); txt.Attributes.Add("InputType", userSubs.InputType); txt.Attributes.Add("InputDesc", userSubs.EAttribute1); txt.Attributes.Add("SqlFilterSequence", userSubs.SqlFilterSequence.ToString()); txt.Text = userSubs.InputValue; txt.CanKeyIn = true; if (checkExist) { txt.CssClass = "require"; } else { txt.CssClass = "textbox"; } controlInput = txt; } HtmlTableCell cellValue = new HtmlTableCell(); cellValue.NoWrap = true; cellValue.Attributes.Add("class", "fieldValue"); cellValue.Style.Add("padding-right", "10px"); cellValue.Controls.Add(controlInput); return(new HtmlTableCell[] { cellTitle, cellValue }); }
// 查看报表 private void cmdQuery_ServerClick(object sender, EventArgs e) { ArrayList listInput = new ArrayList(); string strMess = string.Empty; // 遍历每个输入项 for (int i = 0; i < this.tbInput.Rows.Count; i++) { for (int n = 0; n < this.tbInput.Rows[i].Cells.Count; n++) { for (int x = 0; x < this.tbInput.Rows[i].Cells[n].Controls.Count; x++) { Control ctl = this.tbInput.Rows[i].Cells[n].Controls[x]; string strType = "", strName = "", strValue = ""; decimal dSqlSeq = 0; bool bIsInputControl = false; if (ctl is WebControl || ctl is System.Web.UI.UserControl) { if (ctl is WebControl && ((WebControl)ctl).Attributes["IsReportViewerInput"] == "1") { bIsInputControl = true; WebControl wcontrol = (WebControl)ctl; strType = wcontrol.Attributes["InputType"]; strName = wcontrol.Attributes["InputName"]; dSqlSeq = decimal.Parse(wcontrol.Attributes["SqlFilterSequence"]); } else if (ctl is System.Web.UI.UserControl && ((System.Web.UI.UserControl)ctl).Attributes["IsReportViewerInput"] == "1") { bIsInputControl = true; System.Web.UI.UserControl wcontrol = (System.Web.UI.UserControl)ctl; strType = wcontrol.Attributes["InputType"]; strName = wcontrol.Attributes["InputName"]; dSqlSeq = decimal.Parse(wcontrol.Attributes["SqlFilterSequence"]); } } if (bIsInputControl == true) { if (ctl is TextBox) { strValue = ((TextBox)ctl).Text.Trim().ToUpper(); } else if (ctl is CheckBox) { strValue = FormatHelper.BooleanToString(((CheckBox)ctl).Checked); } else if (ctl is DropDownList) { strValue = ((DropDownList)ctl).SelectedValue; } else if (ctl is UserControl.eMESDate) { strValue = FormatHelper.TODateInt(((UserControl.eMESDate)ctl).Text).ToString(); } else if (ctl is BenQGuru.eMES.Web.SelectQuery.SelectableTextBox) { strValue = ((BenQGuru.eMES.Web.SelectQuery.SelectableTextBox)ctl).Text; } RptViewUserSubscription subs = new RptViewUserSubscription(); subs.InputType = strType; subs.InputName = strName; //Add 2008/11/04 if (string.IsNullOrEmpty(strValue) || (ctl is UserControl.eMESDate && strValue == "0")) { if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } RptViewFilterUI[] objUIs = rptFacade.GetRptViewFilterUIByReportIdAndSeq(this.ReportID, strName, dSqlSeq); if (objUIs != null && objUIs.Length > 0) { foreach (RptViewFilterUI objUI in objUIs) { if (objUI.CheckExist == "Y") { //添加异常 //throw new Exception( strName + "$ReportDesign_NOT_AllowNull"); //string alertInfo = // string.Format("<script language=javascript>alert('{0}');</script>",strName + " " +this.languageComponent1.GetString("$ReportDesign_NOT_AllowNull")); //if (!this.ClientScript.IsClientScriptBlockRegistered("Message")) //{ // this.ClientScript.RegisterClientScriptBlock(typeof(string), "Message", alertInfo); //} //return; if (string.IsNullOrEmpty(strMess)) { if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } RptViewGridFilter objFilter = rptFacade.GetRptViewGridFiltersByReportIdAndName(this.ReportID, strName, dSqlSeq); if (objFilter != null) { strMess = objFilter.Description; } else { strMess = strName; } } else { if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } RptViewGridFilter objFilter = rptFacade.GetRptViewGridFiltersByReportIdAndName(this.ReportID, strName, dSqlSeq); if (objFilter != null) { strMess = strMess + "," + objFilter.Description; } else { strMess = strMess + "," + strName; } } } } } } //Add End subs.InputValue = strValue; subs.SqlFilterSequence = dSqlSeq; listInput.Add(subs); } /* * if (ctl is TextBox) * { * if (((TextBox)ctl).Attributes["IsReportViewerInput"] == "1") * { * TextBox txt = (TextBox)ctl; * string strType = txt.Attributes["InputType"]; * string strName = txt.Attributes["InputName"]; * string strValue = txt.Text.Trim().ToUpper(); * decimal dSqlSeq = decimal.Parse(txt.Attributes["SqlFilterSequence"]); * RptViewUserSubscription subs = new RptViewUserSubscription(); * subs.InputType = strType; * subs.InputName = strName; * subs.InputValue = strValue; * subs.SqlFilterSequence = dSqlSeq; * listInput.Add(subs); * } * } */ } } } //查询所有的输入项,一次性报错 if (strMess != null && strMess.Length > 0) { string alertInfo = string.Format("<script language=javascript>alert('{0}');</script>", strMess + " " + this.languageComponent1.GetString("$ReportDesign_NOT_AllowNull")); //if (!this.ClientScript.IsClientScriptBlockRegistered("Message")) //{ // this.ClientScript.RegisterClientScriptBlock(typeof(string), "Message", alertInfo); ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", alertInfo, false); //} return; } // 执行查询 RptViewUserSubscription[] viewerInput = new RptViewUserSubscription[listInput.Count]; listInput.CopyTo(viewerInput); if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } DataSet dsSource = rptFacade.ExecuteDataSetFromSource(this.ReportID, viewerInput, Server.MapPath("").ToString().Substring(0, Server.MapPath("").ToString().LastIndexOf("\\"))); this.txtDataCount.Text = dsSource.Tables[0].Rows.Count.ToString(); // 绑定报表 DisplayReportHelper rptHelper = new DisplayReportHelper(); rptHelper.BindReportViewer(rptFacade, designMain, this.ReportViewer1, dsSource, viewerInput); this.ReportViewer1.DataBind(); string[] values = new string[viewerInput.Length]; for (int i = 0; i < viewerInput.Length; i++) { values[i] = ((RptViewUserSubscription)viewerInput[i]).InputValue; } //导出报表数据 BenQGuru.eMES.DataExp.BaseEngine.ExpData(designMain.ReportName, dsSource.Tables[0], values); }
private void cmdSave_ServerClick(object sender, EventArgs e) { DBDateTime dDate = FormatHelper.GetNowDBDateTime(this.DataProvider); string strReportId = ""; RptViewUserSubscription[] subs = new RptViewUserSubscription[this.gridWebGrid.Rows.Count]; for (int i = 0; i < this.gridWebGrid.Rows.Count; i++) { GridRecord row = this.gridWebGrid.Rows[i]; RptViewUserSubscription s = new RptViewUserSubscription(); s.UserCode = this.GetUserCode(); s.ReportID = row.Items.FindItemByKey("ReportID").Text; s.Sequence = i + 1; s.InputType = row.Items.FindItemByKey("InputType").Text; s.InputName = row.Items.FindItemByKey("InputName").Text; s.InputValue = row.Items.FindItemByKey("InputValue").Text; s.SqlFilterSequence = decimal.Parse(row.Items.FindItemByKey("SqlFilterSequence").Text); s.MaintainUser = this.GetUserCode(); s.MaintainDate = dDate.DBDate; s.MaintainTime = dDate.DBTime; subs[i] = s; strReportId = s.ReportID; this.gridWebGrid.Rows[i].Items.FindItemByKey("MaintainUser").Text = s.MaintainUser; this.gridWebGrid.Rows[i].Items.FindItemByKey("MaintainDate").Text = FormatHelper.ToDateString(s.MaintainDate); this.gridWebGrid.Rows[i].Items.FindItemByKey("MaintainTime").Text = FormatHelper.ToTimeString(s.MaintainTime); } if (rptFacade == null) { rptFacade = new ReportViewFacade(this.DataProvider); } if (strReportId == "") { string strValue = this.drpRptId.SelectedValue; object objEntry = rptFacade.GetRptViewEntry(strValue); strReportId = ((RptViewEntry)objEntry).ReportID; } ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.OpenConnection(); this.DataProvider.BeginTransaction(); try { rptFacade.UpdateRptViewUserSubscriptionByReportId(strReportId, this.GetUserCode(), subs, this.chkReportAsDefault.Checked); this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.CloseConnection(); } string alertInfo = string.Format("<script language=javascript>alert('{0}');</script>", this.languageComponent1.GetString("$CS_Save_Success")); if (!this.ClientScript.IsClientScriptBlockRegistered("SaveSuccess")) { this.ClientScript.RegisterClientScriptBlock(typeof(string), "SaveSuccess", alertInfo); } }
private void InitStyleValue() { string styleId = this.GetRequestParam("styleid"); _facade = new ReportViewFacade(this.DataProvider); RptViewReportStyleDetail[] styleDtls = _facade.GetRptViewReportStyleDetailByStyleID(decimal.Parse(styleId)); if (styleDtls == null || styleDtls.Length == 0) { return; } for (int i = 0; i < styleDtls.Length; i++) { if (styleDtls[i].StyleType == ReportStyleType.Header) { RptViewDataFormat format = (RptViewDataFormat)_facade.GetRptViewDataFormat(styleDtls[i].FormatID); if (format != null) { this.hidHeaderRow.Value = _facade.BuildStyleValueFromDataFormat(format); this.hidHeader_0.Value = this.hidHeaderRow.Value; this.hidHeader_1.Value = this.hidHeaderRow.Value; this.hidHeader_2.Value = this.hidHeaderRow.Value; } } else if (styleDtls[i].StyleType == ReportStyleType.SubTotal) { RptViewDataFormat format = (RptViewDataFormat)_facade.GetRptViewDataFormat(styleDtls[i].FormatID); if (format != null) { this.hidGroup_0.Value = _facade.BuildStyleValueFromDataFormat(format); this.hidGroupData_0_0.Value = this.hidGroup_0.Value; this.hidGroupData_0_1.Value = this.hidGroup_0.Value; this.hidGroupData_0_2.Value = this.hidGroup_0.Value; } } else if (styleDtls[i].StyleType == ReportStyleType.Item) { RptViewDataFormat format = (RptViewDataFormat)_facade.GetRptViewDataFormat(styleDtls[i].FormatID); if (format != null) { this.hidItemHeader.Value = _facade.BuildStyleValueFromDataFormat(format); this.hidItemData_0.Value = this.hidItemHeader.Value; this.hidItemData_1.Value = this.hidItemHeader.Value; this.hidItemData_2.Value = this.hidItemHeader.Value; } } } for (int i = 0; i < styleDtls.Length; i++) { if (styleDtls[i].StyleType == ReportStyleType.SubTotalGroupField) { RptViewDataFormat format = (RptViewDataFormat)_facade.GetRptViewDataFormat(styleDtls[i].FormatID); if (format != null) { this.hidGroupData_0_0.Value = _facade.BuildStyleValueFromDataFormat(format); } } else if (styleDtls[i].StyleType == ReportStyleType.SubTotalNonCalField) { RptViewDataFormat format = (RptViewDataFormat)_facade.GetRptViewDataFormat(styleDtls[i].FormatID); if (format != null) { this.hidGroupData_0_1.Value = _facade.BuildStyleValueFromDataFormat(format); } } else if (styleDtls[i].StyleType == ReportStyleType.SubTotalCalField) { RptViewDataFormat format = (RptViewDataFormat)_facade.GetRptViewDataFormat(styleDtls[i].FormatID); if (format != null) { this.hidGroupData_0_2.Value = _facade.BuildStyleValueFromDataFormat(format); } } } }