public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc == null) { return(value); } string datasourcexml; try { datasourcexml = getDataSourceXml(context.Instance); } catch (Exception ex) { MessageBox.Show(ex.Message, String4Report.GetString("Report")); return(value); } string colsxml = getColsXml(context.Instance); string configXml = value.ToString(); //string errs = ""; //clsColorSet cs = new clsColorSet(); //if (!cs.ColorSet(ClientReportContext.Login.U8LoginClass, datasourcexml, colsxml, ref configXml, false, ref errs)) //{ // if (errs != "") // { // MessageBox.Show(errs); // return ""; // } // else // return value; //} //return configXml; //【pengzhzh】修改编辑类型为下拉列表 if (context != null && provider != null) { clsColorSet cs = new clsColorSet(); try { cs.ShowFormatCondition(edSvc, ClientReportContext.Login.U8LoginClass, datasourcexml, colsxml, ref configXml, false); return(configXml); } catch (Exception ex) { MessageBox.Show(ex.Message, String4Report.GetString("Report")); } } return(value); }
/// <summary> /// 获取过滤项信息的xml串 /// </summary> /// <param name="filterMeta">过滤项元数据</param> /// <returns>返回过滤项信息的xml串</returns> public string GetFilterConditionXml() { string sql = string.Format( @"select DataSourceID,FunctionName,DataSourceIdExtended from uap_report where ID=N'{0}'" , this._reportId); DataSet ds = SqlHelper.ExecuteDataSet(this._login.UfMetaCnnString, sql); string dataSourceID = SqlHelper.GetStringFrom(ds.Tables[0].Rows[0]["DataSourceID"]); string functionName = SqlHelper.GetStringFrom(ds.Tables[0].Rows[0]["FunctionName"]); string dataSourceIdExtended = SqlHelper.GetStringFrom(ds.Tables[0].Rows[0]["DataSourceIdExtended"]); this._xmlDoc = new XmlDataDocument(); XmlElement root = this._xmlDoc.CreateElement(FilterXmlService._xmlKeyDataSources); this._xmlDoc.AppendChild(root); this.AddClass(root, dataSourceID, String4Report.GetString("原数据源条件"), functionName, true); this.AddClass(root, dataSourceIdExtended, String4Report.GetString("扩展后的数据源条件"), functionName, false); return(this._xmlDoc.InnerXml); }
private DataSet RetrieveData4Portal() { SqlCommand cmd = new SqlCommand("UAP_Report_ReportMeta4PublishRetrieve4Portal"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(SqlHelper.GetParameter("@ViewID", SqlDbType.NVarChar, 100, this.ViewId)); cmd.Parameters.Add(SqlHelper.GetParameter("@LocaleID", SqlDbType.NVarChar, 10, this.LogInfo.LocaleID)); cmd.Parameters.Add(SqlHelper.GetParameter("@UserID", SqlDbType.NVarChar, 100, this.LogInfo.UserID)); cmd.Parameters.Add(SqlHelper.GetParameter("@cAccId", SqlDbType.NVarChar, 3, this.LogInfo.cAccId)); cmd.Parameters.Add(SqlHelper.GetParameter("@cYear", SqlDbType.NVarChar, 4, this.LogInfo.cYear)); DataSet ds = SqlHelper.ExecuteDataSet(this.LogInfo.UfMetaCnnString, cmd); if (ds.Tables[0].Rows.Count <= 0) { throw new Exception(String4Report.GetString("UAP报表系统中不存在任何监控报表或操作员没有监控报表的发布权限")); } this.FillViewInfos(ds.Tables[0], true); this.CurrentViewInfo = this.ViewInfos[0]; return(ds); }
/// <summary> /// 处理打印情况 /// </summary> /// <param name="action"></param> private void HandlePrint(IAction action) { string reportId = this.ReportViewControl.ClientReportContext.GetReportId(); AbstractFormInput.ActionHashtable actions = UserToolbarStateManager.ReportActionsState[reportId]; string id = action.Id.Substring(7); IAction bSetAction = UserToolbarStateManager.FindActionByKey(reportId, id); string defaultText = "(" + String4Report.GetString("U8.UAP.Report.默认") + ")"; NetAction columnStyle = actions["PrintParent"] as NetAction; foreach (NetAction ac in columnStyle.Actions) { if (ac.Text.Contains(defaultText)) { ac.Text = ac.Text.Replace(defaultText, string.Empty); } } if (bSetAction != null) { bSetAction.Text = bSetAction.Text + defaultText; } IAction setPrintDefault = UserToolbarStateManager.FindActionByKey(reportId, "SetPrintDefault"); if (setPrintDefault != null) { foreach (NetAction ac in ((NetAction)setPrintDefault).Actions) { if (ac.Id != action.Id) { ac.IsChecked = false; } else { ac.IsChecked = true; } } } SetPrintUserUIState(action); }
public void FillDefaultView(DataTable dt) { try { ViewInfo4Publish defaultView = this._viewInfos[0]; if (dt.Rows.Count > 0) { string viewId = SqlHelper.GetStringFrom(dt.Rows[0]["ViewID"]); defaultView = this.GetViewInfo(viewId); } if (defaultView != null) { defaultView.IsDefault = true; this.CurrentViewInfo = defaultView; } else { this.CurrentViewInfo = this._viewInfos[0]; } } catch { throw new Exception(String4Report.GetString("当前操作的目标对象已被删除或操作员没有权限!")); } }
private void btnok_Click(object sender, EventArgs e) { try { detailcompare.EndEdit(); } catch (Exception ex) { //tabControl1.SelectedIndex =0; MessageBox.Show(ex.Message, String4Report.GetString("Report")); return; } try { totalcompare.EndEdit(); } catch (Exception ex) { //tabControl1.SelectedIndex = 2; MessageBox.Show(ex.Message, String4Report.GetString("Report")); return; } try { summarycompare.EndEdit(); } catch (Exception ex) { //tabControl1.SelectedIndex = 1; MessageBox.Show(ex.Message, String4Report.GetString("Report")); return; } this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 并发时需要控制不能另存相同的名称 /// </summary> private void ExcuteStoreProc( string ufMetaCnnString, SqlCommand cmd, ref bool isNameExisted) { SqlConnection cnn = new SqlConnection(ufMetaCnnString); cnn.Open(); SqlTransaction sqlTransaction = cnn.BeginTransaction(); try { SqlHelper.ExecuteNonQuery(sqlTransaction, cmd); if (Convert.ToBoolean(cmd.Parameters["@IsExistedName"].Value)) { sqlTransaction.Rollback(); isNameExisted = true; } else { sqlTransaction.Commit(); } } catch (Exception e) { sqlTransaction.Rollback(); throw new Exception( String4Report.GetString("执行另存操作时出错,原因可能是其他操作员也在执行的另存操作导致互斥,请稍后重试.") + "\r\n错误描述:\r\n" + e.Message); } finally { if (cnn.State == ConnectionState.Open) { cnn.Close(); } } }
private void UpdateNormal(double[] ds, Color[] cs) { GaugeLayer theLayer = null; if (MyChart.Layer.Contains("GaugeLayer")) { theLayer = _mychart.Layer["GaugeLayer"] as GaugeLayer; } else { theLayer = new GaugeLayer(); theLayer.Appearance = new GaugeAppearance(); theLayer.Appearance.Radius = 300; //theLayer.Appearance.Center = new Point(190, 190); //theLayer.Appearance.DialPE.Stroke = Color.Black; //theLayer.Appearance.DialPE.StrokeWidth = 5; theLayer.ChartComponent = MyChart; _mychart.Layer.Add("GaugeLayer", theLayer); _mychart.UserLayerIndex = new string[] { "GaugeLayer" }; // Set axes _mychart.ChartType = ChartType.PieChart; _mychart.Legend.Visible = false; _mychart.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:0>"; _mychart.Axis.Y.MajorGridLines.Thickness = 5; _mychart.Axis.Y.MinorGridLines.Thickness = 2; _mychart.Axis.Y.MajorGridLines.DrawStyle = LineDrawStyle.Solid; _mychart.Axis.Y.MinorGridLines.DrawStyle = LineDrawStyle.Solid; // Set data source (this is meaningless to the gauge layer) _mychart.Data.DataSource = Infragistics.UltraChart.Data.DemoTable.Table(); _mychart.Data.DataBind(); //this.ultraChart1.BackgroundImage = System.Drawing.Image.FromFile(Config.ImagePath + @"\chart_gray_bg.jpg"); } #region sections & needle theLayer.Appearance.Sections.Clear(); theLayer.Appearance.Needles.Clear(); GaugeSection section = null; _invalidcode = 0; double maxtick = _maxtick; if (!double.IsNaN(ds[0])) { if (ds[0] < 0) { _invalidcode = 1; } maxtick = Math.Max(maxtick, ds[0]); } if (!double.IsNaN(ds[1])) { if (ds[1] < 0) { _invalidcode = 1; } maxtick = Math.Max(maxtick, ds[1]); } if (!double.IsNaN(ds[2])) { if (ds[2] < 0) { _invalidcode = 2; } maxtick = Math.Max(maxtick, ds[2]); } if (!double.Equals(maxtick, 100.0)) { long mt = Convert.ToInt64(Math.Ceiling(maxtick)); if (mt % 100 == 0) { if (mt < 100) { maxtick = 100; } else { maxtick = Convert.ToDouble((mt / 100) * 100); } } else { maxtick = Convert.ToDouble((mt / 100 + 1) * 100); } } if (!double.IsNaN(ds[0])) { if (!double.IsNaN(ds[1])) { section = new GaugeSection(ds[0] - _mintick); section.StartWidth = _sectionstart; section.EndWidth = _sectionend; section.PE.ElementType = PaintElementType.SolidFill; //.Gradient; section.PE.FillGradientStyle = GradientStyle.Horizontal; section.PE.Fill = cs[0]; //Color.Green; //section.PE.FillStopColor = Color.Yellow; theLayer.Appearance.Sections.Add(section); section = new GaugeSection(ds[1] - ds[0]); section.StartWidth = _sectionstart; section.EndWidth = _sectionend; section.PE.ElementType = PaintElementType.SolidFill; //.Gradient; section.PE.FillGradientStyle = GradientStyle.Horizontal; section.PE.Fill = cs[1]; //Color.Green; //section.PE.FillStopColor = Color.Yellow; theLayer.Appearance.Sections.Add(section); section = new GaugeSection(maxtick - ds[1]); section.StartWidth = _sectionstart; section.EndWidth = _sectionend; section.PE.ElementType = PaintElementType.SolidFill; //.Gradient; section.PE.FillGradientStyle = GradientStyle.Horizontal; section.PE.Fill = cs[2]; //Color.Green; //section.PE.FillStopColor = Color.Yellow; theLayer.Appearance.Sections.Add(section); } else { section = new GaugeSection(ds[0] - _mintick); section.StartWidth = _sectionstart; section.EndWidth = _sectionend; section.PE.ElementType = PaintElementType.SolidFill; //.Gradient; section.PE.FillGradientStyle = GradientStyle.Horizontal; section.PE.Fill = cs[0]; //Color.Green; //section.PE.FillStopColor = Color.Yellow; theLayer.Appearance.Sections.Add(section); section = new GaugeSection(maxtick - ds[0]); section.StartWidth = _sectionstart; section.EndWidth = _sectionend; section.PE.ElementType = PaintElementType.SolidFill; //.Gradient; section.PE.FillGradientStyle = GradientStyle.Horizontal; section.PE.Fill = cs[2]; //Color.Green; //section.PE.FillStopColor = Color.Yellow; theLayer.Appearance.Sections.Add(section); } } else { section = new GaugeSection(maxtick - _mintick); section.StartWidth = 1; section.EndWidth = 2; section.PE.ElementType = PaintElementType.SolidFill;//.Gradient; section.PE.FillGradientStyle = GradientStyle.Horizontal; section.PE.Fill = _gaugecolor; theLayer.Appearance.Sections.Add(section); } if (!double.IsNaN(ds[2])) { Needle nv = new Needle(ds[2], new PaintElement(_needlecolor)); nv.PE.StrokeWidth = 12; nv.Length = _needlelength; theLayer.Appearance.Needles.Add(nv); } #endregion theLayer.Appearance.StartAngle = _bsemicircle ? 0 : -45; theLayer.Appearance.EndAngle = _bsemicircle ? 180 : 225; theLayer.Appearance.TextLoc = _textloc; theLayer.Appearance.TickStart = _tickstart; theLayer.Appearance.TickEnd = _tickend; _mychart.Axis.Y.Visible = true; _mychart.Axis.Y.Labels.Visible = true; _mychart.Axis.Y.MajorGridLines.Visible = true; _mychart.Axis.Y.MinorGridLines.Visible = true; _mychart.Axis.Y.MajorGridLines.Color = _tickcolor; _mychart.Axis.Y.MinorGridLines.Color = _tickcolor; _mychart.Axis.Y.Labels.FontColor = _fontcolor; _mychart.Axis.Y.LineColor = _linecolor; if (_gaugetype == GaugeType.Blue3D) { theLayer.Appearance.DialPE = new PaintElement(String4Report.GetImage("Template0.gif")); } else { theLayer.Appearance.DialPE = new PaintElement(_gaugecolor); } //theLayer.Appearance.DialPE = new PaintElement(Color.WhiteSmoke, Color.CornflowerBlue, GradientStyle.Elliptical); //if (_caption != null) //{ // _mychart.TitleBottom.Text = _caption; // _mychart.TitleBottom.FontSizeBestFit = true; // _mychart.TitleBottom.HorizontalAlign = StringAlignment.Center; //} _mychart.InvalidateLayers(); }
private void tlbrefresh_Click(object sender, EventArgs e) { if (MessageBox.Show(U8ResService.GetResStringEx("U8.UAP.Report.RefreshConfirm"), String4Report.GetString("Report"), MessageBoxButtons.YesNo) == DialogResult.Yes) { if (_context.FilterArgs != null) { _context.FilterArgs.Args.Add("RefreshInvoked", 1); } Refresh(); } }
public string SaveCrossSchemasWithLock(U8LoginInfor login, string viewID, string crossSchemas, string actionType) { //1开一个新的连接,并开事务 SqlConnection cnn = new SqlConnection(login.UfMetaCnnString); cnn.Open(); SqlTransaction tran = cnn.BeginTransaction(); string result = string.Empty; try { //21 首先获取当前数据库的groupSchemas,并构造要保存的groupSchemas XmlDocument doc = this.GetCrossSchemasWithXLock(viewID, tran); //tran GroupSchemas haveSaveCrossSchemas = GroupSchemas.GetSchemas(doc, ""); GroupSchemas toSaveCrossSchemas = GroupSchemas.GetSchemasNoSetDefaultSchema(crossSchemas, ""); //3然后每一个groupSchema做对比 if (toSaveCrossSchemas.Count <= 0) { return(toSaveCrossSchemas.ToXml().InnerXml); } GroupSchema cs = toSaveCrossSchemas[0];//要更新的 foreach (GroupSchema group in toSaveCrossSchemas) { if (group.ID != NOGROUPID) { cs = group; } } GroupSchema oldGs = GetGroupSchemaById(haveSaveCrossSchemas, cs.ID);//数据库中已经有的 switch (actionType.ToLower().Trim()) { case "delete": if (oldGs == null) { throw new ResourceReportException(String4Report.GetString("U8.UAP.Services.ReportData.ReportDataFacade.Delete.Ex", login.LocaleID)); //"没有权限" //throw new Exception(String4Report.GetString("操作失败,别人已经删除")); } haveSaveCrossSchemas.Remove(oldGs); break; case "add": if (HaveSameName(haveSaveCrossSchemas, cs)) { throw new ResourceReportException(String4Report.GetString("U8.UAP.Services.ReportData.ReportDataFacade.Add.Ex", login.LocaleID)); //throw new Exception(String4Report.GetString("存在重名的分组/交叉,请再次打开报表后更改")); } cs.GuidVersion = Guid.NewGuid().ToString(); haveSaveCrossSchemas.Add(cs); SetOtherSchemaBDefault(haveSaveCrossSchemas, cs); break; case "modify": if (oldGs == null) { throw new ResourceReportException(String4Report.GetString("U8.UAP.Services.ReportData.ReportDataFacade.Delete.Ex", login.LocaleID)); //"没有权限" //throw new Exception(String4Report.GetString("操作失败,别人已经删除")); } //表明同一个用户在操作,不校验并发 if (string.IsNullOrEmpty(oldGs.LastUserGuid) || oldGs.LastUserGuid == cs.LastUserGuid) { if (HaveSameName(haveSaveCrossSchemas, cs)) { throw new ResourceReportException(String4Report.GetString("U8.UAP.Services.ReportData.ReportDataFacade.Modify.Ex2", login.LocaleID)); //throw new Exception(String4Report.GetString("存在重名的分组/交叉,请再次打开报表后更改")); } haveSaveCrossSchemas.Remove(oldGs); cs.GuidVersion = Guid.NewGuid().ToString(); haveSaveCrossSchemas.Add(cs); SetOtherSchemaBDefault(haveSaveCrossSchemas, cs); } //表明同一个用户在操作,不校验并发 else { if (oldGs.GuidVersion == cs.GuidVersion) { if (HaveSameName(haveSaveCrossSchemas, cs)) { throw new ResourceReportException(String4Report.GetString("U8.UAP.Services.ReportData.ReportDataFacade.Modify.Ex2", login.LocaleID)); //throw new Exception(String4Report.GetString("存在重名的分组/交叉,请再次打开报表后更改")); } haveSaveCrossSchemas.Remove(oldGs); cs.GuidVersion = Guid.NewGuid().ToString(); haveSaveCrossSchemas.Add(cs); SetOtherSchemaBDefault(haveSaveCrossSchemas, cs); } else { throw new ResourceReportException(String4Report.GetString("U8.UAP.Services.ReportData.ReportDataFacade.Modify.Ex3", login.LocaleID)); //throw new Exception(String4Report.GetString("操作失败,别人已经修改")); } } break; default: break; } result = haveSaveCrossSchemas.ToXml().InnerXml; string sql = "UPDATE UAP_ReportView SET PreservedField = @CrossSchemas WHERE ID=@ViewID"; SqlCommand command = new SqlCommand(sql, cnn); command.Parameters.Add(new SqlParameter("CrossSchemas", result)); command.Parameters.Add(new SqlParameter("ViewID", viewID)); SqlHelper.ExecuteNonQuery(tran, command); tran.Commit(); } catch (Exception e) { tran.Rollback(); throw e; } finally { if (cnn.State == ConnectionState.Open) { cnn.Close(); } } return(result); }
internal void Retrieve() { CheckDbCnnString(); SqlCommand cmd = new SqlCommand("UAP_Report_RuntimeExihibitonGetReportRelateInfor"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(SqlHelper.GetParameter("@ID", SqlDbType.NVarChar, 100, _InputID)); cmd.Parameters.Add(SqlHelper.GetParameter("@cAccId", SqlDbType.Char, 3, _cAccId)); cmd.Parameters.Add(SqlHelper.GetParameter("@cYear", SqlDbType.Char, 4, _cYear)); cmd.Parameters.Add(SqlHelper.GetParameter("@cUser", SqlDbType.NVarChar, 20, _UserID)); cmd.Parameters.Add(SqlHelper.GetParameter("@LocaleID", SqlDbType.NVarChar, 10, _LocaleID)); cmd.Parameters.Add(SqlHelper.GetParameter("@DefaultViewID", SqlDbType.NVarChar, 100)); cmd.Parameters.Add(SqlHelper.GetParameter("@ReportID", SqlDbType.NVarChar, 100)); DataSet ds = SqlHelper.ExecuteDataSet(_DbConnString, cmd); if (ds.Tables.Count > 1) { string defaultviewid = cmd.Parameters["@DefaultViewID"].Value.ToString(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { SimpleView view = new SimpleView(); view.ID = ds.Tables[0].Rows[i]["ViewGuid"].ToString(); view.Name = ds.Tables[0].Rows[i]["Name"].ToString(); view.ViewType = Convert.ToInt32(ds.Tables[0].Rows[i]["ViewType"]); view.ViewClass = SqlHelper.GetStringFrom(ds.Tables[0].Rows[i]["ViewClass"]); view.ReportMergeCell = SqlHelper.GetBooleanFrom(ds.Tables[0].Rows[i]["ReportMergeCell"], false); view.RowsCount = SqlHelper.GetIntFrom(ds.Tables[0].Rows[i]["RowsCount"], 40); view.bShowDetail = SqlHelper.GetBooleanFrom(ds.Tables[0].Rows[i]["bShowDetail"], false); if (view.ID.ToLower() == defaultviewid.ToLower()) { view.IsDefault = true; } _Views.Add(view); } DataRow dr = ds.Tables[1].Rows[0]; _ReportID = cmd.Parameters["@ReportID"].Value.ToString(); _ClassName = SqlHelper.GetStringFrom(dr["ClassName"]); _FilterId = SqlHelper.GetStringFrom(dr["FilterId"]); _FilterClass = SqlHelper.GetStringFrom(dr["FilterClass"]); _rootReportId = SqlHelper.GetStringFrom(dr["RootReportId"]); _bVB = SqlHelper.GetBooleanFrom(dr["bVB"], true); if (defaultviewid == string.Empty) { if (_Views.Count <= 0) { throw new ResourceReportException(String4Report.GetString("操作员没有查询权限或视图权限!", _LocaleID)); } _DefaultViewID = _Views[0].ID; } else { _DefaultViewID = defaultviewid; } } }