MVCxGridViewGeneratorHelper.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  1. using Autofac;
  2. using DevExpress.Data;
  3. using DevExpress.XtraEditors.Controls;
  4. using DevExpress.XtraPrinting;
  5. using DevExpress.XtraReports.UI;
  6. using GreenTree.Nachtragsmanagement.Core;
  7. using GreenTree.Nachtragsmanagement.Core.Authentication;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.Drawing;
  12. using System.IO;
  13. using System.Linq;
  14. using System.Net.Mime;
  15. using System.Web;
  16. namespace GreenTree.Nachtragsmanagement.Web.Extensions
  17. {
  18. public class MVCxGridViewGeneratorHelper
  19. {
  20. public delegate void CustomizeColumnsCollectionEventHandler(object source, ColumnsCreationEventArgs e);
  21. public delegate void CustomizeColumnEventHandler(object source, ControlCustomizationEventArgs e);
  22. public delegate void CustomizeColumnTotalSummaryEventHandler(object source, ColumnSummaryCreationEventArgs e);
  23. public delegate void CustomizeColumnGroupSummaryEventHandler(object source, ColumnSummaryCreationEventArgs e);
  24. public class MVCReportGeneratonHelper
  25. {
  26. const int initialGroupOffset = 0;
  27. const int subGroupOffset = 10;
  28. const int bandHeight = 20;
  29. const bool shouldRepeatGroupHeadersOnEveryPage = false;
  30. XtraReport report;
  31. Hashtable detailsInfo = new Hashtable();
  32. Hashtable detailsWidth = new Hashtable();
  33. public event CustomizeColumnsCollectionEventHandler CustomizeColumnsCollection;
  34. public event CustomizeColumnEventHandler CustomizeColumn;
  35. public event CustomizeColumnTotalSummaryEventHandler CustomizeTotalColumnSummary;
  36. public event CustomizeColumnGroupSummaryEventHandler CustomizeGroupColumnSummary;
  37. public XtraReport GenerateMVCReport(MVCxGridViewState gridViewState, object model, string title)
  38. {
  39. report = new XtraReport
  40. {
  41. Font = new Font("Calibri", 10f, FontStyle.Regular),
  42. Landscape = true,
  43. PaperKind = System.Drawing.Printing.PaperKind.A4
  44. };
  45. InitStyles();
  46. InitReportTitle(title);
  47. InitDataSource(model);
  48. InitDetailsAndPageHeader(gridViewState);
  49. InitDetailReports(gridViewState);
  50. InitSortings(gridViewState);
  51. InitGroupHeaders(gridViewState);
  52. InitFilters(gridViewState);
  53. InitTotalSummaries(gridViewState);
  54. InitPageFooter();
  55. return report;
  56. }
  57. private void InitStyles()
  58. {
  59. report.StyleSheet.Add(new XRControlStyle
  60. {
  61. Name = "Title",
  62. Borders = DevExpress.XtraPrinting.BorderSide.None,
  63. Font = new Font(report.Font.FontFamily, 24f, FontStyle.Regular),
  64. ForeColor = Color.FromArgb(35, 133, 160)
  65. });
  66. report.StyleSheet.Add(new XRControlStyle
  67. {
  68. Name = "OddRow",
  69. Borders = (DevExpress.XtraPrinting.BorderSide.Bottom |
  70. DevExpress.XtraPrinting.BorderSide.Left |
  71. DevExpress.XtraPrinting.BorderSide.Right),
  72. Padding = new PaddingInfo(30, 600)
  73. });
  74. report.StyleSheet.Add(new XRControlStyle
  75. {
  76. Name = "EvenRow",
  77. BackColor = Color.LightGray,
  78. Borders = (DevExpress.XtraPrinting.BorderSide.Bottom |
  79. DevExpress.XtraPrinting.BorderSide.Left |
  80. DevExpress.XtraPrinting.BorderSide.Right),
  81. Padding = new PaddingInfo(30, 600)
  82. });
  83. report.StyleSheet.Add(new XRControlStyle
  84. {
  85. Name = "HeaderRow",
  86. BackColor = Color.FromArgb(156, 183, 191),
  87. Borders = DevExpress.XtraPrinting.BorderSide.All,
  88. Padding = new PaddingInfo(30, 600),
  89. Font = new Font(report.Font, FontStyle.Bold)
  90. });
  91. report.StyleSheet.Add(new XRControlStyle
  92. {
  93. Name = "GroupHeader",
  94. BackColor = Color.Beige,
  95. Borders = DevExpress.XtraPrinting.BorderSide.All,
  96. Padding = new PaddingInfo(30, 600),
  97. Font = new Font(report.Font, FontStyle.Bold)
  98. });
  99. report.StyleSheet.Add(new XRControlStyle
  100. {
  101. Name = "SummaryRow",
  102. BackColor = Color.FromArgb(35, 133, 160),
  103. Borders = DevExpress.XtraPrinting.BorderSide.All,
  104. BorderColor = Color.FromArgb(35, 133, 160),
  105. Padding = new PaddingInfo(30, 600),
  106. ForeColor = Color.White,
  107. Font = new Font(report.Font, FontStyle.Bold)
  108. });
  109. report.StyleSheet.Add(new XRControlStyle
  110. {
  111. Name = "DetailRow",
  112. BackColor = Color.FromArgb(209, 228, 255),
  113. Borders = DevExpress.XtraPrinting.BorderSide.All
  114. });
  115. report.StyleSheet.Add(new XRControlStyle
  116. {
  117. Name = "DetailRowLabel",
  118. Padding = new PaddingInfo(30, 600),
  119. Borders = DevExpress.XtraPrinting.BorderSide.Bottom |
  120. DevExpress.XtraPrinting.BorderSide.Left |
  121. DevExpress.XtraPrinting.BorderSide.Right
  122. });
  123. report.StyleSheet.Add(new XRControlStyle
  124. {
  125. Name = "FooterRow",
  126. Font = new Font(report.Font, FontStyle.Italic)
  127. });
  128. }
  129. private void InitReportTitle(string title)
  130. {
  131. report.Bands.Add(new ReportHeaderBand
  132. {
  133. HeightF = 32f
  134. });
  135. report.Bands[BandKind.ReportHeader].Controls.Add(new XRLabel
  136. {
  137. Text = title,
  138. StyleName = "Title",
  139. WidthF = (report.PageWidth - (report.Margins.Left + report.Margins.Right))
  140. });
  141. }
  142. private void InitDataSource(object model)
  143. {
  144. report.DataSource = model;
  145. }
  146. private void InitDetailsAndPageHeader(MVCxGridViewState gridViewState)
  147. {
  148. var groupedColumns = gridViewState.GroupedColumns;
  149. var pagewidth = (report.PageWidth - (report.Margins.Left + report.Margins.Right)) - groupedColumns.Count * subGroupOffset;
  150. var columns = GetColumnsInfo(gridViewState, pagewidth);
  151. if (CustomizeColumnsCollection != null)
  152. CustomizeColumnsCollection(report, new ColumnsCreationEventArgs(pagewidth)
  153. {
  154. ColumnsInfo = columns
  155. });
  156. report.Bands.Add(new DetailBand()
  157. {
  158. HeightF = bandHeight,
  159. KeepTogetherWithDetailReports = true
  160. });
  161. report.Bands.Add(new PageHeaderBand()
  162. {
  163. HeightF = bandHeight
  164. });
  165. var headerTable = new XRTable()
  166. {
  167. StyleName = "HeaderRow"
  168. };
  169. var row = new XRTableRow();
  170. var detailTable = new XRTable
  171. {
  172. OddStyleName = "OddRow",
  173. EvenStyleName = "EvenRow"
  174. };
  175. var row2 = new XRTableRow();
  176. for (var i = 0; i < columns.Count; i++)
  177. {
  178. if (columns[i].IsVisible)
  179. {
  180. var cell = new XRTableCell
  181. {
  182. Width = columns[i].ColumnWidth,
  183. Text = columns[i].GridViewColumn.Caption,
  184. Borders = DevExpress.XtraPrinting.BorderSide.All,
  185. TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft
  186. };
  187. row.Cells.Add(cell);
  188. var cell2 = new XRTableCell
  189. {
  190. Width = columns[i].ColumnWidth
  191. };
  192. var cc = new ControlCustomizationEventArgs
  193. {
  194. FieldName = columns[i].FieldName,
  195. IsModified = false,
  196. Owner = cell2,
  197. Header = cell
  198. };
  199. if (CustomizeColumn != null)
  200. CustomizeColumn(report, cc);
  201. if (cc.IsModified == false)
  202. {
  203. cell2.DataBindings.Add("Text", null, columns[i].FieldName,
  204. "{0:" + columns[i].GridViewColumn.DisplayFormat + "}");
  205. }
  206. detailsInfo.Add(columns[i].GridViewColumn, cell2);
  207. row2.Cells.Add(cell2);
  208. detailsWidth.Add(columns[i].GridViewColumn, cell2.WidthF);
  209. }
  210. }
  211. headerTable.Rows.Add(row);
  212. headerTable.Width = pagewidth;
  213. headerTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0);
  214. headerTable.Borders = DevExpress.XtraPrinting.BorderSide.Bottom;
  215. detailTable.Rows.Add(row2);
  216. detailTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0);
  217. detailTable.Width = pagewidth;
  218. report.Bands[BandKind.PageHeader].Controls.Add(headerTable);
  219. report.Bands[BandKind.Detail].Controls.Add(detailTable);
  220. }
  221. private void InitDetailReports(MVCxGridViewState gridViewState)
  222. {
  223. var groupedColumns = gridViewState.GroupedColumns;
  224. var pagewidth = (report.PageWidth - (report.Margins.Left + report.Margins.Right)) - groupedColumns.Count * subGroupOffset;
  225. var columns = GetColumnsInfo(gridViewState, pagewidth);
  226. if (CustomizeColumnsCollection != null)
  227. CustomizeColumnsCollection(report, new ColumnsCreationEventArgs(pagewidth)
  228. {
  229. ColumnsInfo = columns
  230. });
  231. var detailColumns = columns
  232. .Where(c => c.IsDetail)
  233. .ToList();
  234. if (!detailColumns.Any()) return;
  235. var detailReportBand = new DetailReportBand()
  236. {
  237. HeightF = bandHeight
  238. };
  239. report.Bands.Add(detailReportBand);
  240. var detailReportTable = new XRTable
  241. {
  242. OddStyleName = "DetailRow",
  243. EvenStyleName = "DetailRow",
  244. WidthF = pagewidth
  245. };
  246. var detailReportRow = new XRTableRow();
  247. foreach (var detailColumn in detailColumns)
  248. {
  249. var cellDetail = new XRTableCell
  250. {
  251. WidthF = pagewidth / detailColumns.Count
  252. };
  253. var label = new XRLabel
  254. {
  255. StyleName = "DetailRowLabel",
  256. WidthF = pagewidth / detailColumns.Count,
  257. WordWrap = true
  258. };
  259. label.DataBindings.Add("Text", null, detailColumn.FieldName,
  260. "{0:" + detailColumn.GridViewColumn.DisplayFormat + "}");
  261. cellDetail.Controls.Add(label);
  262. detailReportRow.Cells.Add(cellDetail);
  263. }
  264. detailReportTable.Rows.Add(detailReportRow);
  265. detailReportTable.LocationF = new PointF(groupedColumns.Count * subGroupOffset, 0);
  266. DetailBand detailBand = new DetailBand();
  267. detailBand.Height = detailReportTable.Height;
  268. detailReportBand.Bands.Add(detailBand);
  269. detailBand.Controls.Add(detailReportTable);
  270. }
  271. private void InitSortings(MVCxGridViewState gridViewState)
  272. {
  273. var columns = gridViewState.Columns;
  274. var groupedColumns = gridViewState.GroupedColumns;
  275. for (var i = 0; i < columns.Count; i++)
  276. {
  277. if (!groupedColumns.Contains(columns[i]))
  278. {
  279. if (columns[i].SortOrder != ColumnSortOrder.None)
  280. ((DetailBand)report.Bands[BandKind.Detail]).SortFields.Add(new GroupField(columns[i].FieldName, columns[i].SortOrder == ColumnSortOrder.Ascending ? XRColumnSortOrder.Ascending : XRColumnSortOrder.Descending));
  281. }
  282. }
  283. }
  284. private void InitGroupHeaders(MVCxGridViewState gridViewState)
  285. {
  286. var groupedColumns = gridViewState.GroupedColumns;
  287. for (var i = groupedColumns.Count - 1; i >= 0; i--)
  288. {
  289. var groupedColumn = groupedColumns[i];
  290. var gb = new GroupHeaderBand
  291. {
  292. Height = bandHeight
  293. };
  294. var groupHeaderTable = new XRTable
  295. {
  296. StyleName = "GroupHeader",
  297. LocationF = new PointF(initialGroupOffset + i * 10, 0),
  298. SizeF = new SizeF((report.PageWidth - (report.Margins.Left + report.Margins.Right)) - (initialGroupOffset + i * subGroupOffset), bandHeight)
  299. };
  300. var groupHeaderRow = new XRTableRow();
  301. var l = new XRTableCell
  302. {
  303. Text = groupedColumn.Caption + ": [" + groupedColumn.FieldName + "]",
  304. Borders = DevExpress.XtraPrinting.BorderSide.Left |
  305. DevExpress.XtraPrinting.BorderSide.Top |
  306. DevExpress.XtraPrinting.BorderSide.Bottom
  307. };
  308. groupHeaderRow.Cells.Add(l);
  309. foreach (MVCxSummaryItemState item in gridViewState.TotalSummary)
  310. {
  311. var sum = new XRTableCell
  312. {
  313. Borders = DevExpress.XtraPrinting.BorderSide.Top |
  314. DevExpress.XtraPrinting.BorderSide.Bottom
  315. };
  316. sum.Summary = new XRSummary
  317. {
  318. Running = SummaryRunning.Group
  319. };
  320. sum.Summary.Func = GetSummaryFunc(item.SummaryType);
  321. sum.DataBindings.Add("Text", null, item.FieldName);
  322. groupHeaderRow.Cells.Add(sum);
  323. if (CustomizeGroupColumnSummary != null)
  324. CustomizeGroupColumnSummary(report, new ColumnSummaryCreationEventArgs(item.FieldName, sum.Summary));
  325. }
  326. groupHeaderTable.Rows.Add(groupHeaderRow);
  327. gb.Controls.Add(groupHeaderTable);
  328. gb.RepeatEveryPage = shouldRepeatGroupHeadersOnEveryPage;
  329. var gf = new GroupField(
  330. groupedColumn.FieldName, groupedColumn.SortOrder == ColumnSortOrder.Ascending
  331. ? XRColumnSortOrder.Ascending
  332. : XRColumnSortOrder.Descending);
  333. gb.GroupFields.Add(gf);
  334. report.Bands.Add(gb);
  335. }
  336. }
  337. private void InitFilters(MVCxGridViewState gridViewState)
  338. {
  339. report.FilterString = gridViewState.FilterExpression;
  340. }
  341. private void InitTotalSummaries(MVCxGridViewState gridViewState)
  342. {
  343. if (gridViewState.TotalSummary.Count == 0) return;
  344. report.Bands.Add(new ReportFooterBand
  345. {
  346. HeightF = bandHeight,
  347. StyleName = "SummaryRow"
  348. });
  349. foreach (MVCxSummaryItemState item in gridViewState.TotalSummary)
  350. {
  351. var col = gridViewState.Columns[item.ShowInColumn == string.Empty
  352. ? item.FieldName
  353. : item.ShowInColumn];
  354. if (col == null) continue;
  355. if (!detailsInfo.Contains(col)) continue;
  356. var label = new XRLabel
  357. {
  358. LocationF = new PointF(
  359. ((XRTableCell)detailsInfo[col]).LocationF.X + subGroupOffset * gridViewState.GroupedColumns.Count,
  360. ((XRTableCell)detailsInfo[col]).LocationF.Y),
  361. SizeF = ((XRTableCell)detailsInfo[col]).SizeF
  362. };
  363. label.DataBindings.Add("Text", null, col.FieldName);
  364. label.Summary = new XRSummary
  365. {
  366. Running = SummaryRunning.Report
  367. };
  368. label.Summary.FormatString = item.DisplayFormat;
  369. label.Summary.Func = GetSummaryFunc(item.SummaryType);
  370. report.Bands[BandKind.ReportFooter].Controls.Add(label);
  371. if (CustomizeTotalColumnSummary != null)
  372. CustomizeTotalColumnSummary(report, new ColumnSummaryCreationEventArgs(col.FieldName, label.Summary));
  373. }
  374. }
  375. private void InitPageFooter()
  376. {
  377. var userHelper = Singleton<IContainer>.Instance.Resolve<IUserHelper>();
  378. var user = userHelper.FromCookies();
  379. report.Bands.Add(new PageFooterBand
  380. {
  381. HeightF = 23f
  382. });
  383. var footerTable = new XRTable
  384. {
  385. WidthF = (report.PageWidth - (report.Margins.Left + report.Margins.Right)),
  386. HeightF = 23f,
  387. Borders = DevExpress.XtraPrinting.BorderSide.Top,
  388. StyleName = "FooterRow"
  389. };
  390. var footerRow = new XRTableRow
  391. {
  392. Cells =
  393. {
  394. new XRTableCell
  395. {
  396. TextAlignment = TextAlignment.MiddleLeft,
  397. Text = DateTime.Now.ToString("dd.MM.yyyy - HH:mm \"Uhr\" |"),
  398. WidthF = 145f,
  399. HeightF = 23f
  400. },
  401. new XRTableCell
  402. {
  403. Controls =
  404. {
  405. new XRPageInfo
  406. {
  407. TextAlignment = TextAlignment.MiddleLeft,
  408. Format = "Seite {0} von {1}",
  409. PageInfo = PageInfo.NumberOfTotal,
  410. StartPageNumber = 1,
  411. Padding = 5,
  412. HeightF = 23f
  413. }
  414. },
  415. WidthF = 100f,
  416. HeightF = 23f
  417. },
  418. new XRTableCell
  419. {
  420. TextAlignment = TextAlignment.MiddleRight,
  421. Text = String.Format("{0}, {1}", user.Lastname, user.Forename),
  422. WidthF = (report.PageWidth - (report.Margins.Left + report.Margins.Right)) - 230
  423. }
  424. }
  425. };
  426. footerTable.Rows.Add(footerRow);
  427. report.Bands[BandKind.PageFooter].Controls.Add(footerTable);
  428. }
  429. private List<MVCxColumnInfo> GetColumnsInfo(MVCxGridViewState gridViewState, int pagewidth)
  430. {
  431. var columns = new List<MVCxColumnInfo>();
  432. var visibleColumns = gridViewState.Columns;
  433. foreach (var dataColumn in visibleColumns)
  434. {
  435. MVCxColumnInfo column = new MVCxColumnInfo(dataColumn)
  436. {
  437. ColumnCaption = string.IsNullOrEmpty(dataColumn.Caption) ? dataColumn.FieldName : dataColumn.Caption,
  438. ColumnWidth = ((int)pagewidth / visibleColumns.Count),
  439. FieldName = dataColumn.FieldName,
  440. IsVisible = true
  441. };
  442. columns.Add(column);
  443. }
  444. return columns;
  445. }
  446. private SummaryFunc GetSummaryFunc(SummaryItemType summaryItemType)
  447. {
  448. switch (summaryItemType)
  449. {
  450. case SummaryItemType.Sum:
  451. return SummaryFunc.Sum;
  452. case SummaryItemType.Average:
  453. return SummaryFunc.Avg;
  454. case SummaryItemType.Max:
  455. return SummaryFunc.Max;
  456. case SummaryItemType.Min:
  457. return SummaryFunc.Min;
  458. case SummaryItemType.Count:
  459. return SummaryFunc.Count;
  460. default:
  461. return SummaryFunc.Custom;
  462. }
  463. }
  464. public void WritePdfToResponse(HttpResponseBase Response, string fileName, string type)
  465. {
  466. report.CreateDocument(false);
  467. using (MemoryStream ms = new MemoryStream())
  468. {
  469. report.ExportToPdf(ms);
  470. ms.Seek(0, SeekOrigin.Begin);
  471. WriteResponse(Response, ms.ToArray(), "application/pdf", type, fileName);
  472. }
  473. }
  474. public void WriteXlsToResponse(HttpResponseBase Response, string fileName, string type)
  475. {
  476. report.CreateDocument(false);
  477. using (MemoryStream ms = new MemoryStream())
  478. {
  479. report.ExportToXls(ms);
  480. ms.Seek(0, SeekOrigin.Begin);
  481. WriteResponse(Response, ms.ToArray(), "application/vnd.ms-excel", type, fileName);
  482. }
  483. }
  484. public void WriteXlsxToResponse(HttpResponseBase Response, string fileName, string type)
  485. {
  486. report.CreateDocument(false);
  487. using (MemoryStream ms = new MemoryStream())
  488. {
  489. report.ExportToXlsx(ms);
  490. ms.Seek(0, SeekOrigin.Begin);
  491. WriteResponse(Response, ms.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", type, fileName);
  492. }
  493. }
  494. public static void WriteResponse(HttpResponseBase response, byte[] filearray, string contentType, string type, string fileName)
  495. {
  496. response.ClearContent();
  497. response.Buffer = true;
  498. response.Cache.SetCacheability(HttpCacheability.Private);
  499. response.ContentType = contentType;
  500. ContentDisposition contentDisposition = new ContentDisposition();
  501. contentDisposition.FileName = fileName;
  502. contentDisposition.DispositionType = type;
  503. response.AddHeader("Content-Disposition", contentDisposition.ToString());
  504. response.BinaryWrite(filearray);
  505. HttpContext.Current.ApplicationInstance.CompleteRequest();
  506. try
  507. {
  508. response.End();
  509. }
  510. catch (System.Threading.ThreadAbortException)
  511. {
  512. }
  513. }
  514. }
  515. public class ControlCustomizationEventArgs : EventArgs
  516. {
  517. XRControl owner;
  518. public XRControl Owner
  519. {
  520. get
  521. {
  522. return owner;
  523. }
  524. set
  525. {
  526. owner = value;
  527. }
  528. }
  529. XRControl header;
  530. public XRControl Header
  531. {
  532. get
  533. {
  534. return header;
  535. }
  536. set
  537. {
  538. header = value;
  539. }
  540. }
  541. bool isModified;
  542. public bool IsModified
  543. {
  544. get
  545. {
  546. return isModified;
  547. }
  548. set
  549. {
  550. isModified = value;
  551. }
  552. }
  553. string fieldName;
  554. public string FieldName
  555. {
  556. get
  557. {
  558. return fieldName;
  559. }
  560. set
  561. {
  562. fieldName = value;
  563. }
  564. }
  565. }
  566. public class ColumnSummaryCreationEventArgs : EventArgs
  567. {
  568. public ColumnSummaryCreationEventArgs(string fieldName, XRSummary summary)
  569. {
  570. this.fieldName = fieldName;
  571. this.summary = summary;
  572. }
  573. XRSummary summary;
  574. public XRSummary Summary
  575. {
  576. get
  577. {
  578. return summary;
  579. }
  580. set
  581. {
  582. summary = value;
  583. }
  584. }
  585. string fieldName;
  586. public string FieldName
  587. {
  588. get
  589. {
  590. return fieldName;
  591. }
  592. set
  593. {
  594. fieldName = value;
  595. }
  596. }
  597. }
  598. public class ColumnsCreationEventArgs : EventArgs
  599. {
  600. int pageWidth;
  601. public int PageWidth
  602. {
  603. get
  604. {
  605. return pageWidth;
  606. }
  607. }
  608. public ColumnsCreationEventArgs(int pageWidth)
  609. {
  610. this.pageWidth = pageWidth;
  611. }
  612. List<MVCxColumnInfo> columnsInfo;
  613. public List<MVCxColumnInfo> ColumnsInfo
  614. {
  615. get
  616. {
  617. return columnsInfo;
  618. }
  619. set
  620. {
  621. columnsInfo = value;
  622. }
  623. }
  624. }
  625. public class MVCxColumnInfo
  626. {
  627. public MVCxColumnInfo(GridViewDataColumnState gridViewColumn)
  628. {
  629. this.gridViewColumn = gridViewColumn;
  630. }
  631. GridViewDataColumnState gridViewColumn;
  632. public GridViewDataColumnState GridViewColumn
  633. {
  634. get
  635. {
  636. return gridViewColumn;
  637. }
  638. }
  639. string columnCaption;
  640. public string ColumnCaption
  641. {
  642. get
  643. {
  644. return columnCaption;
  645. }
  646. set
  647. {
  648. columnCaption = value;
  649. }
  650. }
  651. string fieldName;
  652. public string FieldName
  653. {
  654. get
  655. {
  656. return fieldName;
  657. }
  658. set
  659. {
  660. fieldName = value;
  661. }
  662. }
  663. int columnWidth;
  664. public int ColumnWidth
  665. {
  666. get
  667. {
  668. return columnWidth;
  669. }
  670. set
  671. {
  672. columnWidth = value;
  673. }
  674. }
  675. bool isVisible;
  676. public bool IsVisible
  677. {
  678. get
  679. {
  680. return isVisible;
  681. }
  682. set
  683. {
  684. isVisible = value;
  685. }
  686. }
  687. bool isDetail;
  688. public bool IsDetail
  689. {
  690. get
  691. {
  692. return isDetail;
  693. }
  694. set
  695. {
  696. isDetail = value;
  697. }
  698. }
  699. }
  700. }
  701. }