Beispiel #1
0
		private static MemoryStream Get(ClientData client, decimal balance, CalculationData[] calculations,
			ClientBalanceHistoryItem[] history)
		{
			var stream = new MemoryStream();

			using(var pck = new ExcelPackage())
			{
				var excel = pck.Workbook.Worksheets.Add(Entities.Application);
				excel.Cells.Style.Font.Name = ExcelConstants.DefaultFontName;
				excel.Cells.Style.Font.Size = ExcelConstants.DefaultFontSize;
				excel.Cells.Style.Numberformat.Format = "0.00";

				var columnCount = DrawHeader(excel, balance);

				var iRow = DrawRows(client, calculations, history, columnCount, 3, excel);

				AdjustExcel(columnCount, excel, iRow);

				pck.SaveAs(stream);
			}

			stream.Position = 0;

			return stream;
		}
Beispiel #2
0
		private static int DrawRows(ClientData client, CalculationData[] calculations,
			ClientBalanceHistoryItem[] history, int columnCount, int iRow, ExcelWorksheet excel)
		{
			var drawables = DrawableMapper.Get(history, excel, client, columnCount)
				.Union(DrawableMapper.Get(calculations, excel, client, columnCount))
				.OrderByDescending(x => x.Position)
				.ToArray();

			foreach(var drawable in drawables)
			{
				iRow = drawable.Draw(iRow);
			}

			return iRow;
		}
		public ClientBalanceHistoryItemDrawable(ClientBalanceHistoryItem item)
		{
			_item = item;
		}
		public ClientBalanceHistoryItemDrawable(ClientBalanceHistoryItem item, int columnCount, ExcelWorksheet excel)
		{
			_item = item;
			_columnCount = columnCount;
			_excel = excel;
		}
Beispiel #5
0
		public static IDrawable[] Get(ClientBalanceHistoryItem[] history, ExcelWorksheet excel, ClientData client,
			int columnCount)
		{
			return history.Select(x => (IDrawable)new ClientBalanceHistoryItemDrawable(
				x, columnCount, excel)).ToArray();
		}