/// <summary> /// Converts a report style to a new font definition. /// </summary> /// <param name="reportStyle">The report style.</param> /// <param name="fontFamily">Name of the font.</param> /// <returns>The font.</returns> public static Font ConvertStyleToFont(ReportStyle reportStyle, string fontFamily) { var font = new Font(); font.SetFamily(fontFamily); if (reportStyle.Underline) { font.SetStyle(Font.UNDERLINE); } else if (reportStyle.Bold || reportStyle.Italic) { if (reportStyle.Bold && reportStyle.Italic) { font.SetStyle(Font.BOLDITALIC); } else if (reportStyle.Bold) { font.SetStyle(Font.BOLD); } else { font.SetStyle(Font.ITALIC); } } font.Size = reportStyle.FontSize; font.SetColor(reportStyle.ForeColor.R, reportStyle.ForeColor.G, reportStyle.ForeColor.B); return(font); }
/// <summary> /// 设置数据表样式 /// </summary> /// <param name="report"></param> /// <returns></returns> private static DataTable SetReportStyle(BaseReport report, ReportStyle reportStyle) { if (OnReportProcessing != null) { ReportProcessingEventArgs e = new ReportProcessingEventArgs( ); e.Status = "数据排列中。。。"; OnReportProcessing(e); } DataTable tbResult = new DataTable( ); if (reportStyle == ReportStyle.科目为标题列) { tbResult = RebuildDataWithItemInColumn(report); } else { tbResult = RebuildDataWithItemInRow(report); } if (OnReportProcessing != null) { ReportProcessingEventArgs e = new ReportProcessingEventArgs( ); e.Status = "完成"; OnReportProcessing(e); } return(tbResult); }
public static Font ConvertStyleToFont(ReportStyle reportStyle, string fontFamily) { var style = Font.NORMAL; if (reportStyle.Underline) { style = Font.UNDERLINE; } else if (reportStyle.Bold || reportStyle.Italic) { if (reportStyle.Bold && reportStyle.Italic) { style = Font.BOLDITALIC; } else if (reportStyle.Bold) { style = Font.BOLD; } else { style = Font.ITALIC; } } // todo: to use this method you need to register your fonts at the beginning of the report // FontFactory.Register(@"c:\windows\fonts\myfont.ttf"); return(FontFactory.GetFont( fontFamily, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, reportStyle.FontSize, style, new BaseColor(reportStyle.ForeColor.R, reportStyle.ForeColor.G, reportStyle.ForeColor.B))); }
public void ShowReport(string name, ReportStyle reportStyle, object extra, params object[] objectArray) { if (ProgressBar != null) { ProgressBar.ProcessRun(1); } SetReportQuery = (s) => { MainReport = new Report(); MainReport.Name = name; MainReport.ObjectArray = objectArray ?? new object[] { }; MainReport.Style = reportStyle; if (MainReport.ObjectArray.Length > 0) { MainReport.Type = MainReport.ObjectArray[0].GetType(); } else { MainReport.Type = typeof(Exclusive.Collection.Instance.MiMFa_Instance); } MainReport.Extra = extra; return(MainReport); }; RefreshReport(true); }
public void ShowEditor(Type type = null, ReportStyle rs = null, bool subjectReadonly = false) { Func <Editor> ed = () => { Editor Editor = new Editor(); Editor.ReportDesigner.Initialize(type, rs, subjectReadonly); return(Editor); }; if (TabViewer != null) { Service.MiMFa_ControlService.ThreadExecuteInControl( Exclusive.Collection.MiMFa_ThreadingMethod.Default , TabViewer , (args) => TabViewer.ShowPage( (Func <Editor>)args[0] , null , false , Exclusive.Collection.MiMFa_ThreadingMethod.Null) , new object[] { ed }); } //TabViewer.ShowPage( // ed // , null // , false // , Exclusive.Collection.MiMFa_ThreadingMethod.Null); else { ed().Show(); } }
// Стиль отчета private void OwnedReportStyle_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) { if (style == null) style = new ReportStyle(); IObjectSpace objectSpace = Application.CreateObjectSpace(); e.View = Application.CreateDetailView(objectSpace, style); e.DialogController.CancelAction.Active["StyleCancel"] = false; }
private void tsb_Import_Click(object sender, EventArgs e) { OFD.Filter = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension; if (OFD.InitialDirectory == null) { OFD.InitialDirectory = ReportStyle.GetPath(); } if (OFD.ShowDialog() == DialogResult.OK) { ReportStyle report = new ReportStyle(); MiMFa_IOService.OpenDeserializeFile(OFD.FileName, ref report); if (string.IsNullOrEmpty(tstb_Subject.Text) || tstb_Subject.Text == "Default") { ReportStyle = report; } else { ReportStyle.MRLCode = report.MRLCode; ReportStyle.Script = report.Script; ReportStyle.Css = report.Css; ReportStyle.Extra = report.Extra; } ReportStyle.Address = OFD.FileName; } Initialize(null, ReportStyle, false); }
/// <summary> /// Defines the styles used in the document. /// </summary> /// <param name="document">The document.</param> /// <param name="reportStyle">The report Style.</param> public static void DefineStyles(Document document, ReportStyle reportStyle) { SetStyle(document.Styles["Normal"], reportStyle.BodyTextStyle); // Heading1 to Heading9 are predefined styles with an outline level. An outline level // other than OutlineLevel.BodyText automatically creates the outline (or bookmarks) // in PDF. for (int i = 0; i < reportStyle.HeaderStyles.Length; i++) { SetStyle(document.Styles["Heading" + (i + 1)], reportStyle.HeaderStyles[i]); } // style = document.Styles[StyleNames.Header]; // style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right); // style = document.Styles[StyleNames.Footer]; // style.ParagraphFormat.AddTabStop("8cm", TabAlignment.Center); var style = document.Styles.AddStyle("TableHeader", "Normal"); SetStyle(style, reportStyle.TableHeaderStyle); style = document.Styles.AddStyle("TableCaption", "Normal"); SetStyle(style, reportStyle.TableCaptionStyle); style = document.Styles.AddStyle("TableText", "Normal"); SetStyle(style, reportStyle.TableTextStyle); style = document.Styles.AddStyle("FigureText", "Normal"); SetStyle(style, reportStyle.FigureTextStyle); }
private void tsb_Export_Click(object sender, EventArgs e) { Restart(false); SFD.Filter = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension; SFD.FileName = ReportStyle.Name; if (SFD.InitialDirectory == null) { SFD.InitialDirectory = ReportStyle.GetPath(); } if (!string.IsNullOrEmpty(SFD.FileName)) { SFD.FileName = ReportStyle.Address; } if (SFD.ShowDialog() == DialogResult.OK) { ReportStyle rs = new ReportStyle() { RSID = ReportStyle.RSID, Name = ReportStyle.Name, Address = ReportStyle.Address, MRLCode = ReportStyle.MRLCode, Css = ReportStyle.Css, Script = ReportStyle.Script, Extra = ReportStyle.Extra }; MiMFa_IOService.SaveSerializeFile(SFD.FileName, rs); } }
XRControlStyleSheet GetStyleSheet() { ListViewItem item = null; if (lvStyles.SelectedItems.Count <= 0 && lvStyles.FocusedItem == null) { if (lvStyles.Items.Count <= 0) { return(null); } item = lvStyles.Items[0]; } else { if (lvStyles.SelectedItems.Count > 0) { item = lvStyles.SelectedItems[0]; } else { item = lvStyles.FocusedItem; } } ReportStyle style = (ReportStyle)item.Tag; return(style.StyleSheet); }
/// <summary> /// Copies the report style to an XL Style. /// </summary> /// <param name="reportStyle">The report style.</param> /// <param name="xlStyle">The xl style.</param> public static void CopyToXlStyle(this ReportStyle reportStyle, IXLStyle xlStyle) { if (reportStyle.BackColor != Color.White) { xlStyle.Fill.BackgroundColor = XLColor.FromColor(reportStyle.BackColor); } if (reportStyle.ForeColor != Color.Black) { xlStyle.Font.SetFontColor(XLColor.FromColor(reportStyle.ForeColor)); } xlStyle.Font.SetBold(reportStyle.Bold); xlStyle.Font.SetFontSize(reportStyle.FontSize); xlStyle.Font.SetItalic(reportStyle.Italic); xlStyle.Font.SetUnderline(reportStyle.Underline ? XLFontUnderlineValues.Single : XLFontUnderlineValues.None); xlStyle.Alignment.Horizontal = reportStyle.HorizontalAlignment == HorizontalAlignment.Center ? XLAlignmentHorizontalValues.Center : reportStyle.HorizontalAlignment == HorizontalAlignment.Left ? XLAlignmentHorizontalValues.Left : XLAlignmentHorizontalValues.Right; xlStyle.Alignment.Vertical = reportStyle.VerticalAlignment == VerticalAlignment.Bottom ? XLAlignmentVerticalValues.Bottom : reportStyle.VerticalAlignment == VerticalAlignment.Middle ? XLAlignmentVerticalValues.Center : XLAlignmentVerticalValues.Top; xlStyle.Alignment.TextRotation = reportStyle.TextRotation; xlStyle.Alignment.WrapText = reportStyle.WrapText; }
public void ShowReport(string name, ReportStyle reportStyle, object extra, Type type, params object[] objectArray) { if (ProgressBar != null) { ProgressBar.ProcessRun(1); } MainReport.Type = type; ShowReport(name, reportStyle, extra, objectArray); }
/// <summary> /// Renders the footer. /// </summary> /// <param name="globalTable">The global table.</param> /// <param name="textFields">The text fields.</param> /// <param name="renderHints">The render hints.</param> protected virtual void RenderFooter(PdfPTable globalTable, ReportTextFieldCollection textFields, RenderHintsCollection renderHints) { if (!string.IsNullOrEmpty(textFields.Footer)) { ReportStyle reportStyle = renderHints[FooterStyle] as ReportStyle ?? GetDefaultFooterStyle(); globalTable.AddCell(CreateTextCell(reportStyle, renderHints[FontFamily] as string, textFields.Footer)); } }
// Форма мастера отчетов private void ReportWizard_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) { PredefinedReportWizard predefined = View.CurrentObject as PredefinedReportWizard; wizard = predefined != null ? predefined.Main : new ReportWizard(); style = null; objectSpace = Application.CreateObjectSpace(); e.View = Application.CreateDetailView(objectSpace, wizard); e.DialogController.AcceptAction.Execute += AcceptAction_Execute; e.DialogController.Actions.Add(OwnedReportStyle); }
public void ChangeStyle(string fileName) { ReportStyle rs = new ReportStyle(); MiMFa_IOService.OpenDeserializeFile(fileName, ref rs); Report r = new Report(MainReport); r.Style = rs; ShowReport(r, true); }
/// <summary> /// Creates the text cell. /// </summary> /// <param name="reportStyle">The report style.</param> /// <param name="fontName">Name of the font.</param> /// <param name="text">The text.</param> /// <returns> /// The newly created cell. /// </returns> private static PdfPCell CreateTextCell(ReportStyle reportStyle, string fontName, string text) { var par = new Paragraph(text, ConvertStyleToFont(reportStyle, fontName)); var cell = new PdfPCell(par) { Border = 0 }; CopyStyleToCell(reportStyle, cell); return(cell); }
public void ShowReport(string name, ReportStyle reportStyle, object extra, Type type, params object[] objectArray) { Show(() => { Viewer viewer = Initialize(); TRANSLATE.TryDone(Service.MiMFa_ControlService.GetAllObjects(viewer)); viewer.ReportViewer.ShowReport(name, reportStyle, extra, type, objectArray ?? new object[] { }); viewer.Text = viewer.ReportViewer.MainReport.Name + " (" + viewer.ReportViewer.MainReport.ID + ")"; return(viewer); }); }
// TODO: Add Alignment enums internal void ApplyStyle(ReportStyle reportStyle) { reportStyle.Bold = Bold; reportStyle.Underline = Underline; reportStyle.Italic = Italic; reportStyle.BackColor = BackColor; reportStyle.ForeColor = ForeColor; reportStyle.FontSize = FontSize; }
/// <summary> /// 格式化日期显示的格式 /// </summary> /// <param name="date">日期</param> /// <param name="style">显示格式</param> /// <returns></returns> public static string FormatDate(string date, ReportStyle style) { DateTime Dates = Convert.ToDateTime(date); switch (ConvertBaseCountType(style)) { case 0: return Dates.ToString("HH 点"); case 1: return Dates.ToString("MM-dd"); default: return Dates.ToString("yyyy-MM 月"); } }
// TODO: Add Alignment enums internal void ApplyStyle(ReportStyle reportStyle) { reportStyle.Bold = Bold; reportStyle.Underline = Underline; reportStyle.Italic = Italic; reportStyle.BackColor = BackColor; reportStyle.ForeColor = ForeColor; reportStyle.FontSize = FontSize; reportStyle.TextRotation = TextRotation; reportStyle.WrapText = WrapText; }
public void ReportStyleCreate(Type thisType = null, ReportStyle reportStyle = null, bool refrence = false) { if (thisType != null) { ThisType = thisType; } if (reportStyle != null && refrence) { ReportStyle = reportStyle; } else if (reportStyle != null && !refrence) { ReportStyle = new ReportStyle(reportStyle); } }
/// <summary> /// 根据前台查询的类型转化为后台对应的实际统计单元 /// </summary> /// <param name="style">前台的统计风格</param> /// <returns></returns> public static int ConvertBaseCountType(ReportStyle style) { switch (style) { case ReportStyle.DayStyle: return 0; case ReportStyle.WeekStyle: return 1; case ReportStyle.MonthStyle: return 1; case ReportStyle.YearStyle: return 4; default: return 1; } }
private ExecResult GetRptStyle(ReportStyle report) { //var rptName = report.RptName; var rptId = report.RptID; var treeId = report.TreeId; var orgId = report.OrgId; var bll = new BLL.BLLReport(); var rpt = bll.GetRptStyle(rptId, treeId, orgId); var result = new ExecResult() { ResultData = JsonConvert.SerializeObject(rpt), }; return(result); }
private ExecResult GetRptStyle(ReportStyle report) { //var rptName = report.RptName; var rptId = report.RptID; var treeId = report.TreeId; var orgId = report.OrgId; var bll = new BLL.BLLReport(); var rpt = bll.GetRptStyle(rptId, treeId, orgId); var result = new ExecResult() { ResultData = JsonConvert.SerializeObject(rpt), }; return result; }
/// <summary> /// 格式化日期显示的格式 /// </summary> /// <param name="date">日期</param> /// <param name="style">显示格式</param> /// <returns></returns> public static string FormatDate(string date, ReportStyle style) { DateTime Dates = Convert.ToDateTime(date); switch (ConvertBaseCountType(style)) { case 0: return(Dates.ToString("HH 点")); case 1: return(Dates.ToString("MM-dd")); default: return(Dates.ToString("yyyy-MM 月")); } }
private SQLiteParameter[] GetReportStyleParameter(ReportStyle reportStyle = null) { ReportStyle rs; if (reportStyle == null) { rs = new ReportStyle(); } else { rs = reportStyle; } return(new SQLiteParameter[] { new SQLiteParameter("@RSID", rs.RSID), new SQLiteParameter("@Style", MiMFa_IOService.Serialize(rs)) }); }
public Report Store <T>(string reportSubject, string report, ReportStyle reportStyle, T extra, Type type, MiMFa_Accessibility accessablity = MiMFa_Accessibility.User, string creatorName = "Unknown") { Report NewReport = new Report(); NewReport.ID = ReportCounter++; NewReport.Name = reportSubject; NewReport.Type = type; NewReport.AccessDate = Default.Date; NewReport.AccessTime = Default.Time; NewReport.Accessablity = accessablity; NewReport.HTML = report; NewReport.Extra = extra; NewReport.CreatorName = creatorName; NewReport.Style = reportStyle; return(Store(NewReport)); }
private ExecResult SaveStyle(ReportStyle rpt) { var bll = new BLL.BLLReport(); var s = bll.SaveRptStyle(rpt); var objResult = new ExecResult() { Status = true, }; if (s != string.Empty) { objResult.ErrMessage = s; objResult.Status = false; } return(objResult); }
protected virtual void RenderFooter(ReportTextFieldCollection textFields, RenderHintsCollection hints) { Html.AppendLine("</table>"); var footerStyle = new ReportStyle { Italic = true }; Html.AppendFormat("<p style='{1}'>{0}</p>", textFields.Footer, footerStyle.ToCss()); Html.AppendLine("</div>"); if (WrapHeadAndBody) { Html.AppendLine("</body>"); Html.AppendLine("</html>"); } }
/// <summary> /// 根据报表NAME获取样式 /// 查找不到返回空 /// </summary> /// <param name="rptName">报表Name</param> /// <returns></returns> public ReportStyle GetRptStyleByName(string rptName) { var dal = new DAL.DALReportStyle(); var dt = dal.GetRptStyleByName(rptName); var rpt = new ReportStyle { RptName = rptName, }; if (dt.Rows.Count > 0) { rpt.RptName = dt.Rows[0]["REPORTNAME"].ToString(); rpt.RptStyle = dt.Rows[0]["REPORTSTYLE"].ToString().Replace(""", "\""); } return(rpt); }
public Report GetDefaultReportArchive(string condition = "", string reportStylePath = null, string reportName = "Reports Archive", int limit = -1, int offset = -1) { Report report = new Report(); ReportStyle reportstyle = new ReportStyle(); if (string.IsNullOrEmpty(reportStylePath)) { reportStylePath = Address.ReportStyleArchivePath; } MiMFa_IOService.OpenDeserializeFile(reportStylePath, ref reportstyle); Report[] lr = GetReportList(condition, limit, offset); //MiMFaReportLanguage MRL = new MiMFaReportLanguage(); report.Name = reportName; report.Style = reportstyle; report.Type = typeof(Report); report.ObjectArray = lr; //report.HTML = MRL.CompileToHTML(report); return(report); }
/// <summary> /// 根据报表名,treeid,orgid查找报表样式 /// </summary> /// <param name="rptName"></param> /// <param name="treeId"></param> /// <param name="orgId"></param> /// <returns></returns> public ReportStyle GetRptStyle(string rptId, string treeId, string orgId) { var dal = new DAL.DALReportStyle(); var dt = dal.GetRptStyle(rptId, treeId, orgId); var rpt = new ReportStyle { RptID = rptId, }; if (dt.Rows.Count > 0) { rpt.RptName = dt.Rows[0]["REPORTNAME"].ToString(); rpt.RptStyle = dt.Rows[0]["REPORTSTYLE"].ToString().Replace(""", "\""); rpt.OrgId = orgId; rpt.TreeId = treeId; rpt.styleType = dt.Rows[0]["reporttype"].ToString(); } return rpt; }
/// <summary> /// 根据报表名,treeid,orgid查找报表样式 /// </summary> /// <param name="rptName"></param> /// <param name="treeId"></param> /// <param name="orgId"></param> /// <returns></returns> public ReportStyle GetRptStyle(string rptId, string treeId, string orgId) { var dal = new DAL.DALReportStyle(); var dt = dal.GetRptStyle(rptId, treeId, orgId); var rpt = new ReportStyle { RptID = rptId, }; if (dt.Rows.Count > 0) { rpt.RptName = dt.Rows[0]["REPORTNAME"].ToString(); rpt.RptStyle = dt.Rows[0]["REPORTSTYLE"].ToString().Replace(""", "\""); rpt.OrgId = orgId; rpt.TreeId = treeId; rpt.styleType = dt.Rows[0]["reporttype"].ToString(); } return(rpt); }
/// <summary> /// 根据前台查询的类型转化为后台对应的实际统计单元 /// </summary> /// <param name="style">前台的统计风格</param> /// <returns></returns> public static int ConvertBaseCountType(ReportStyle style) { switch (style) { case ReportStyle.DayStyle: return(0); case ReportStyle.WeekStyle: return(1); case ReportStyle.MonthStyle: return(1); case ReportStyle.YearStyle: return(4); default: return(1); } }
/// <summary> /// Copies the report style to the cell style. /// </summary> /// <param name="reportStyle">The report style.</param> /// <param name="cell">The cell.</param> public static void CopyStyleToCell(ReportStyle reportStyle, PdfPCell cell) { cell.BackgroundColor = new BaseColor(reportStyle.BackColor); //cell.Width = reportStyle.Width > 0 ? reportStyle.Width : cell.Width; switch (reportStyle.HorizontalAlignment) { case HorizontalAlignment.Center: cell.HorizontalAlignment = Element.ALIGN_CENTER; break; case HorizontalAlignment.Left: cell.HorizontalAlignment = Element.ALIGN_LEFT; break; case HorizontalAlignment.Right: cell.HorizontalAlignment = Element.ALIGN_RIGHT; break; } switch (reportStyle.VerticalAlignment) { case VerticalAlignment.Bottom: cell.VerticalAlignment = Element.ALIGN_BOTTOM; break; case VerticalAlignment.Middle: cell.VerticalAlignment = Element.ALIGN_MIDDLE; break; case VerticalAlignment.Top: cell.VerticalAlignment = Element.ALIGN_TOP; break; } if (reportStyle.TextRotation % 90 == 0) { cell.Rotation = reportStyle.TextRotation; } }
static void Main(string[] args) { var pm = new PlotModel { Title = "Test" }; pm.Axes.Add(new LinearAxis { Title = "Bottom", Position = AxisPosition.Bottom, AxisTitleDistance = 10 }); pm.Axes.Add(new LinearAxis { Title = "Left", Position = AxisPosition.Left }); pm.Series.Add(new FunctionSeries(Math.Sin, 0, 10, 0.01)); var e = new PdfExporter(); e.Width = 800; e.Height = 500; e.Background = OxyColors.LightBlue; var path = "test.docx"; var r = new Report(); r.AddPlot(pm, "Plot test", 800, 500); var rs = new ReportStyle(); Action export = () => { using (var w = new WordDocumentReportWriter(path)) { w.WriteReport(r, rs); w.Save(); } }; var thread = new Thread(new ThreadStart(export)); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); // Process.Start(path); }
/// <summary> /// 保存报表样式 /// </summary> /// <param name="rptStyle">报表对象</param> /// <returns></returns> public string SaveRptStyle(ReportStyle rptStyle) { int count = 0; string errMsg = ""; if (rptStyle.RptName.Trim() == string.Empty) { return "报表名不能为空"; } //if (string.IsNullOrEmpty(rptStyle.OrgId) || string.IsNullOrEmpty(rptStyle.TreeId)) //{ // return "组织机构树和组织机构单元不能为空"; //} var dal = new DAL.DALReportStyle(); //count = dal.GetCountByTreeID(rptStyle.TreeId, rptStyle.RptName, out errMsg); //if (count > 0) // return "报表名称已存在,请修改名称!"; return dal.SaveRptStyle(rptStyle); }
/// <summary> /// 根据报表ID获取样式 /// </summary> /// <param name="rptID"></param> /// <returns></returns> public ReportStyle GetRptStyleByID(string rptID) { var dal = new DAL.DALReportStyle(); var dt = dal.GetRptStyleByID(rptID); var rpt = new ReportStyle { RptID = rptID, }; if (dt.Rows.Count > 0) { rpt.RptName = dt.Rows[0]["REPORTNAME"].ToString(); rpt.RptStyle = dt.Rows[0]["RPTSTYLE"].ToString().Replace(""", "\""); } return rpt; }
private ExecResult SaveStyle(ReportStyle rpt) { var bll = new BLL.BLLReport(); var s = bll.SaveRptStyle(rpt); var objResult = new ExecResult() { Status = true, }; if (s != string.Empty) { objResult.ErrMessage = s; objResult.Status = false; } return objResult; }
public string SaveRptStyle(ReportStyle rpt) { //要加入时间类型判断 var rptId = rpt.RptID; var rptName = rpt.RptName; var rptStyle = rpt.RptStyle; var orgId = rpt.OrgId; var treeId = rpt.TreeId; var styleType = rpt.styleType; string errMsg = string.Empty; switch (dbTypeValue) { case "SQL": { var sqlInsert = "INSERT INTO T_INFO_SISREPORT(REPORTTYPE,REPORTID,REPORTNAME,REPORTSTYLE,ORGID,TREEID) VALUES(@p1,@p2,@p3,@p4,@p5,@p6)"; var sqlDelete = "DELETE FROM T_INFO_SISREPORT WHERE REPORTID=@p1 AND ORGID=@p2 AND TREEID=@p3"; using (var conn = new SqlConnection(DBsql.GetConnectionstr())) { conn.Open(); SqlTransaction transaction = conn.BeginTransaction(); var pDel = new[] { new SqlParameter("@p1",rptId), new SqlParameter("@p2",orgId), new SqlParameter("@p3",treeId) }; var pIns = new[] { new SqlParameter("@p1",styleType), new SqlParameter("@p2",rptId), new SqlParameter("@p3",rptName), new SqlParameter("@p4",rptStyle), new SqlParameter("@p5",orgId), new SqlParameter("@p6",treeId) }; try { DBsql.ExecuteNonQuery(transaction, CommandType.Text, sqlDelete, pDel); DBsql.ExecuteNonQuery(transaction, CommandType.Text, sqlInsert, pIns); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); errMsg = ex.Message; } } } break; case "ORACLE": { //修改Oracle后按照SqlServer对照一次,否则出错 var sqlInsert = "INSERT INTO T_INFO_SISREPORT(REPORTID,REPORTNAME,REPORTSTYLE,ORGID,TREEID,REPORTTYPE) VALUES(:p1,:p2,:p3,:p4,:p5,:p6)"; var sqlDelete = "DELETE FROM T_INFO_SISREPORT WHERE REPORTNAME=:p1 AND ORGID=:p2 AND TREEID=:p3"; var pDel = new[] { new OracleParameter(":p1",rptName), new OracleParameter(":p2",orgId), new OracleParameter(":p3",treeId) }; var pIns = new[] { new OracleParameter(":p1",rptId), new OracleParameter(":p2",rptName), new OracleParameter(":p3",rptStyle), new OracleParameter(":p4",orgId), new OracleParameter(":p5",treeId), new OracleParameter(":p6",styleType) }; using (var conn = new OracleConnection(OracleHelper.retStr())) { conn.Open(); var transaction = conn.BeginTransaction(); try { SAC.DBOperations.OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, sqlDelete, pDel); SAC.DBOperations.OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, sqlInsert, pIns); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); errMsg = ex.Message; } } } break; default://db2 { var sqlInsert = "INSERT INTO T_INFO_SISREPORT(REPORTID,REPORTNAME,REPORTSTYLE,ORGID,TREEID) VALUES(?,?,?,?,?)"; var sqlDelete = "DELETE FROM T_INFO_SISREPORT WHERE REPORTNAME=? AND ORGID=? AND TREEID=?"; var pDel = new[] { new OleDbParameter("?",rptName), new OleDbParameter("?",orgId), new OleDbParameter("?",treeId) }; var pIns = new[] { new OleDbParameter("?",rptId), new OleDbParameter("?",rptName), new OleDbParameter("?",rptStyle), new OleDbParameter("?",orgId), new OleDbParameter("?",treeId) }; using (var conn = DBdb2.GetConn()) { conn.Open(); var transaction = conn.BeginTransaction(); try { DBdb2.ExecuteNonQuery(transaction, CommandType.Text, sqlDelete, pDel); DBdb2.ExecuteNonQuery(transaction, CommandType.Text, sqlInsert, pIns); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); errMsg = ex.Message; } } } break; } return errMsg; }
/// <summary> /// Gets the full caption for the figure. /// </summary> /// <param name="style">The style.</param> /// <returns>The caption string.</returns> public string GetFullCaption(ReportStyle style) { return string.Format(style.FigureTextFormatString, this.FigureNumber, this.FigureText); }