diff --git a/AdvertsingProfitControl/AboutBox1.Designer.cs b/AdvertsingProfitControl/AboutBox1.Designer.cs new file mode 100644 index 0000000..b941180 --- /dev/null +++ b/AdvertsingProfitControl/AboutBox1.Designer.cs @@ -0,0 +1,143 @@ +namespace AdvertsingProfitControl +{ + partial class AboutBox1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.okButton = new System.Windows.Forms.Button(); + this.databaseVersionLabel = new System.Windows.Forms.Label(); + this.labelProductVerion = new System.Windows.Forms.Label(); + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.reportGeneratingVersionLabel = new System.Windows.Forms.Label(); + this.tableLayoutPanel.SuspendLayout(); + this.SuspendLayout(); + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(620, 442); + this.okButton.Margin = new System.Windows.Forms.Padding(6); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(138, 40); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + // + // databaseVersionLabel + // + this.databaseVersionLabel.BackColor = System.Drawing.Color.Transparent; + this.databaseVersionLabel.Dock = System.Windows.Forms.DockStyle.Fill; + this.databaseVersionLabel.Location = new System.Drawing.Point(11, 48); + this.databaseVersionLabel.Margin = new System.Windows.Forms.Padding(11, 0, 6, 0); + this.databaseVersionLabel.MaximumSize = new System.Drawing.Size(0, 31); + this.databaseVersionLabel.Name = "databaseVersionLabel"; + this.databaseVersionLabel.Size = new System.Drawing.Size(747, 31); + this.databaseVersionLabel.TabIndex = 0; + this.databaseVersionLabel.Text = "Database Version:"; + this.databaseVersionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelProductVerion + // + this.labelProductVerion.BackColor = System.Drawing.Color.Transparent; + this.labelProductVerion.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelProductVerion.Location = new System.Drawing.Point(11, 0); + this.labelProductVerion.Margin = new System.Windows.Forms.Padding(11, 0, 6, 0); + this.labelProductVerion.MaximumSize = new System.Drawing.Size(0, 31); + this.labelProductVerion.Name = "labelProductVerion"; + this.labelProductVerion.Size = new System.Drawing.Size(747, 31); + this.labelProductVerion.TabIndex = 19; + this.labelProductVerion.Text = "Advertising Prodift Control Version:"; + this.labelProductVerion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // tableLayoutPanel + // + this.tableLayoutPanel.BackColor = System.Drawing.Color.Transparent; + this.tableLayoutPanel.ColumnCount = 1; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel.Controls.Add(this.labelProductVerion, 0, 0); + this.tableLayoutPanel.Controls.Add(this.databaseVersionLabel, 0, 1); + this.tableLayoutPanel.Controls.Add(this.okButton, 0, 6); + this.tableLayoutPanel.Controls.Add(this.reportGeneratingVersionLabel, 0, 5); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(17, 17); + this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(6); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 7; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel.Size = new System.Drawing.Size(764, 488); + this.tableLayoutPanel.TabIndex = 0; + // + // reportGeneratingVersionLabel + // + this.reportGeneratingVersionLabel.AutoSize = true; + this.reportGeneratingVersionLabel.Location = new System.Drawing.Point(3, 387); + this.reportGeneratingVersionLabel.Name = "reportGeneratingVersionLabel"; + this.reportGeneratingVersionLabel.Size = new System.Drawing.Size(314, 25); + this.reportGeneratingVersionLabel.TabIndex = 25; + this.reportGeneratingVersionLabel.Text = "Report Generating Engine Version:"; + // + // AboutBox1 + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackgroundImage = global::AdvertsingProfitControl.Properties.Resources.Large_Allens_Icon_Template___Copy; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.ClientSize = new System.Drawing.Size(798, 522); + this.Controls.Add(this.tableLayoutPanel); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AboutBox1"; + this.Padding = new System.Windows.Forms.Padding(17, 17, 17, 17); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "About Products"; + this.tableLayoutPanel.ResumeLayout(false); + this.tableLayoutPanel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Label databaseVersionLabel; + private System.Windows.Forms.Label labelProductVerion; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + private System.Windows.Forms.Label reportGeneratingVersionLabel; + } +} diff --git a/AdvertsingProfitControl/AboutBox1.cs b/AdvertsingProfitControl/AboutBox1.cs new file mode 100644 index 0000000..e97655d --- /dev/null +++ b/AdvertsingProfitControl/AboutBox1.cs @@ -0,0 +1,19 @@ +using System.Linq; +using System.Reflection; +using System.Windows.Forms; + +namespace AdvertsingProfitControl +{ + internal partial class AboutBox1 : Form + { + public AboutBox1() + { + InitializeComponent(); + labelProductVerion.Text = $@"Advertising Profit Control Version: {Assembly.GetEntryAssembly().GetName().Version}"; + var db = new AdvertisingProfitControlModel(); + var version = db.Versions.SingleOrDefault(x => x.Id == 1); + databaseVersionLabel.Text = version == null ? @"Database Version: N/A" : $@"Database Version: {version.VersionNumber}"; + reportGeneratingVersionLabel.Text = @"Report Generating Engine Version: 0.5.0.0 Alpha"; + } + } +} diff --git a/AdvertsingProfitControl/AboutBox1.resx b/AdvertsingProfitControl/AboutBox1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/AdvertsingProfitControl/AboutBox1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AdvertsingProfitControl/AdvertsingProfitControl.csproj b/AdvertsingProfitControl/AdvertsingProfitControl.csproj index a32ac5d..3ca548b 100644 --- a/AdvertsingProfitControl/AdvertsingProfitControl.csproj +++ b/AdvertsingProfitControl/AdvertsingProfitControl.csproj @@ -114,6 +114,12 @@ + + Form + + + AboutBox1.cs + @@ -174,6 +180,12 @@ + + True + True + Resources.resx + + @@ -204,6 +216,9 @@ + + AboutBox1.cs + DebugDatabaseConverter.cs @@ -239,14 +254,9 @@ ResXFileCodeGenerator - Resources.Designer.cs Designer + Resources.Designer.cs - - True - Resources.resx - True - @@ -292,6 +302,7 @@ Always + Always @@ -300,6 +311,7 @@ Always + + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,13 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Large Allens Icon Template - Copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/AdvertsingProfitControl/ReportGenerator.cs b/AdvertsingProfitControl/ReportGenerator.cs new file mode 100644 index 0000000..ecba903 --- /dev/null +++ b/AdvertsingProfitControl/ReportGenerator.cs @@ -0,0 +1,50 @@ +using System; +using System.Drawing.Printing; +using System.IO; +using System.Linq; +using System.Web.UI; +using Pechkin; + +namespace AdvertsingProfitControl +{ + internal class ReportGenerator + { + public readonly string Version = "1.0.0.0"; + + public void GeneratePdfReport(DateTime date) + { + var stringWriter = new StringWriter(); + var writer = new HtmlTextWriter(stringWriter); + var front = new FrontPageGenerator(); + var back = new BackPageGenerator(); + front.BuildReportFrontPage(date, ref writer); + back.BuildReportBackPage(date, ref writer); + + using (var streamWriter = new StreamWriter("C:\\Users\\Crypto\\Desktop\\Full.html")) + { + streamWriter.WriteLine(stringWriter.ToString()); + } + } + + public void RenderHtmlCodeToImage(string path, string targetPath) + { + var htmlCode = File.ReadAllLines(path); + var code = htmlCode.Aggregate("", (current, line) => current + "\r\n" + line); + try + { + var pechkin = new SimplePechkin(new GlobalConfig().SetMargins(50,0,0,0).SetPaperSize(PaperKind.A4).SetPaperOrientation(true).SetCopyCount(1)); + var pdf = pechkin.Convert(new ObjectConfig().SetZoomFactor(1.25), code); + //var config = new GlobalConfig().SetPaperSize(PaperKind.A4).SetPaperOrientation(true); + //var pdfBuf = new SimplePechkin(config).Convert(code); + using (var fs = new FileStream(targetPath, FileMode.Create, FileAccess.Write)) + { + fs.Write(pdf, 0, pdf.Length); + } + } + finally + { + + } + } + } +} diff --git a/AdvertsingProfitControl/Resources/Large Allens Icon Template - Copy.png b/AdvertsingProfitControl/Resources/Large Allens Icon Template - Copy.png new file mode 100644 index 0000000..e3db464 Binary files /dev/null and b/AdvertsingProfitControl/Resources/Large Allens Icon Template - Copy.png differ