diff --git a/AdvertsingProfitControl.sln b/AdvertsingProfitControl.sln index fb42036..caa69e2 100644 --- a/AdvertsingProfitControl.sln +++ b/AdvertsingProfitControl.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 15.0.26403.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvertsingProfitControl", "AdvertsingProfitControl\AdvertsingProfitControl.csproj", "{4A45C665-5D02-4724-9CC5-C0C50CA44760}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringInputParseTester", "StringInputParseTester\StringInputParseTester.csproj", "{2663661B-3D90-4D42-B05E-8038923A2891}" -EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SetupProject", "SetupProject\SetupProject.wixproj", "{EB640D80-1A1E-4835-90B3-83A688419321}" EndProject Global @@ -25,14 +23,6 @@ Global {4A45C665-5D02-4724-9CC5-C0C50CA44760}.Release|Any CPU.Build.0 = Release|Any CPU {4A45C665-5D02-4724-9CC5-C0C50CA44760}.Release|x86.ActiveCfg = Release|Any CPU {4A45C665-5D02-4724-9CC5-C0C50CA44760}.Release|x86.Build.0 = Release|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Debug|x86.ActiveCfg = Debug|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Debug|x86.Build.0 = Debug|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Release|Any CPU.Build.0 = Release|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Release|x86.ActiveCfg = Release|Any CPU - {2663661B-3D90-4D42-B05E-8038923A2891}.Release|x86.Build.0 = Release|Any CPU {EB640D80-1A1E-4835-90B3-83A688419321}.Debug|Any CPU.ActiveCfg = Debug|x86 {EB640D80-1A1E-4835-90B3-83A688419321}.Debug|x86.ActiveCfg = Debug|x86 {EB640D80-1A1E-4835-90B3-83A688419321}.Debug|x86.Build.0 = Debug|x86 diff --git a/AdvertsingProfitControl/AdvertsingProfitControl.csproj b/AdvertsingProfitControl/AdvertsingProfitControl.csproj index 7219b2e..a32ac5d 100644 --- a/AdvertsingProfitControl/AdvertsingProfitControl.csproj +++ b/AdvertsingProfitControl/AdvertsingProfitControl.csproj @@ -30,7 +30,7 @@ true - x64 + x86 true full false @@ -82,6 +82,12 @@ app.manifest + + ..\packages\Common.Logging.3.3.1\lib\net40\Common.Logging.dll + + + ..\packages\Common.Logging.Core.3.3.1\lib\net40\Common.Logging.Core.dll + ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll True @@ -90,13 +96,8 @@ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll True - - ..\packages\HtmlRenderer.Core.1.5.0.6\lib\net45\HtmlRenderer.dll - True - - - ..\packages\HtmlRenderer.WinForms.1.5.0.6\lib\net45\HtmlRenderer.WinForms.dll - True + + ..\packages\Pechkin.0.5.8.1\lib\net40\Pechkin.dll @@ -282,7 +283,22 @@ Always + + Always + + + Always + + + Always + + + Always + + + Always +
- +
@@ -30,4 +30,12 @@ + + + + + + + + \ No newline at end of file diff --git a/AdvertsingProfitControl/BackPageGenerator.cs b/AdvertsingProfitControl/BackPageGenerator.cs index 3b31562..96fe57d 100644 --- a/AdvertsingProfitControl/BackPageGenerator.cs +++ b/AdvertsingProfitControl/BackPageGenerator.cs @@ -3,8 +3,8 @@ using System.Data; using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; +using System.Linq; using System.Web.UI; -using TheArtOfDev.HtmlRenderer.WinForms; namespace AdvertsingProfitControl { @@ -22,9 +22,9 @@ namespace AdvertsingProfitControl try { - var imageFromHtml = HtmlRender.RenderToImage(code); - imageFromHtml.Save(Application.StartupPath + "\\BackPage.png", ImageFormat.Png); - imageFromHtml.Dispose(); + //var imageFromHtml = HtmlRender.RenderToImage(code); + //imageFromHtml.Save(Application.StartupPath + "\\BackPage.png", ImageFormat.Png); + //imageFromHtml.Dispose(); } catch (Exception e) { @@ -36,7 +36,28 @@ namespace AdvertsingProfitControl } } - public void GenerateWeeklyInventoryControlPage(int dateId) + public void RenderHtmlCodeToImage(string path, string targetPath) + { + var htmlCode = File.ReadAllLines(path); + var code = htmlCode.Aggregate("", (current, line) => current + "\r\n" + line); + + try + { + //var imageFromHtml = HtmlRender.RenderToImage(code); + //imageFromHtml.Save(targetPath, ImageFormat.Png); + //imageFromHtml.Dispose(); + } + catch (Exception e) + { + _console.WriteToLog(FrmLogConsole.Level.Critical, + "Failed to generate an updated image for the back page of Advertising Profit Control."); + _console.WriteToLog(FrmLogConsole.Level.Debug, e.Message); + _console.WriteToLog(FrmLogConsole.Level.Info, "This is most likely a screw you from the GDI+ subsystem of Windows."); + + } + } + + public void GenerateWeeklyInventoryControlPage(int dateId) { //var databaseTracker = new DatabaseTracker(); //var databaseReader = new DatabaseReader(); diff --git a/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs b/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs index b28c4f5..741a5ac 100644 --- a/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs +++ b/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs @@ -34,7 +34,7 @@ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.convertButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); + this.webBrowser1 = new System.Windows.Forms.WebBrowser(); this.SuspendLayout(); // // existingDatesListBox @@ -90,22 +90,23 @@ this.label1.TabIndex = 4; this.label1.Text = "label1"; // - // button1 + // webBrowser1 // - this.button1.Location = new System.Drawing.Point(400, 530); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(141, 58); - this.button1.TabIndex = 5; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.webBrowser1.AllowNavigation = false; + this.webBrowser1.AllowWebBrowserDrop = false; + this.webBrowser1.Location = new System.Drawing.Point(776, 53); + this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); + this.webBrowser1.Name = "webBrowser1"; + this.webBrowser1.Size = new System.Drawing.Size(1524, 940); + this.webBrowser1.TabIndex = 6; + this.webBrowser1.Url = new System.Uri("file:///C:/Users/Crypto/Desktop/FrontPage.html", System.UriKind.Absolute); // // DebugDatabaseConverter // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(701, 592); - this.Controls.Add(this.button1); + this.ClientSize = new System.Drawing.Size(2374, 1114); + this.Controls.Add(this.webBrowser1); this.Controls.Add(this.label1); this.Controls.Add(this.convertButton); this.Controls.Add(this.moveOverButton); @@ -127,6 +128,6 @@ private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.Button convertButton; private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.WebBrowser webBrowser1; } } \ No newline at end of file diff --git a/AdvertsingProfitControl/FrmLogFileViewer.cs b/AdvertsingProfitControl/FrmLogFileViewer.cs index a36a975..91d9fe0 100644 --- a/AdvertsingProfitControl/FrmLogFileViewer.cs +++ b/AdvertsingProfitControl/FrmLogFileViewer.cs @@ -53,7 +53,14 @@ namespace AdvertsingProfitControl var node = new TreeNode(file.Name) { Name = file.FullName }; fileListTreeView.Nodes.Add(node); } - + //Grab the HTML files + fileNames = Directory.GetFiles(Application.StartupPath, "*.html", SearchOption.TopDirectoryOnly); + foreach (var fileName in fileNames) + { + var file = new FileInfo(fileName); + var node = new TreeNode(file.Name) { Name = file.FullName }; + fileListTreeView.Nodes.Add(node); + } if (fileListTreeView.Nodes.Count <= 0) return; ReadSelectedFile(); } diff --git a/AdvertsingProfitControl/FrmMain.Designer.cs b/AdvertsingProfitControl/FrmMain.Designer.cs index 1d1df48..ab24466 100644 --- a/AdvertsingProfitControl/FrmMain.Designer.cs +++ b/AdvertsingProfitControl/FrmMain.Designer.cs @@ -52,6 +52,7 @@ this.rawViewDebugMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.migrateDatabaseDebugMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.addRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); this.commentMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); this.profitAnalysisMainGroupBox = new System.Windows.Forms.GroupBox(); @@ -140,7 +141,6 @@ this.printPreviewButton.TabIndex = 4; this.printPreviewButton.Text = "Print Preview"; this.printPreviewButton.UseVisualStyleBackColor = true; - this.printPreviewButton.Visible = false; this.printPreviewButton.Click += new System.EventHandler(this.DisplayPrintPreview); // // mainMenu @@ -299,7 +299,8 @@ this.debugMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.rawViewDebugMainMenu, this.migrateDatabaseDebugMainMenu, - this.addRecordToolStripMenuItem}); + this.addRecordToolStripMenuItem, + this.testToolStripMenuItem}); this.debugMainMenu.Name = "debugMainMenu"; this.debugMainMenu.Size = new System.Drawing.Size(87, 34); this.debugMainMenu.Text = "Debug"; @@ -326,6 +327,13 @@ this.addRecordToolStripMenuItem.Text = "Add Re&cord"; this.addRecordToolStripMenuItem.Click += new System.EventHandler(this.DisplayLegacyAddRecord); // + // testToolStripMenuItem + // + this.testToolStripMenuItem.Name = "testToolStripMenuItem"; + this.testToolStripMenuItem.Size = new System.Drawing.Size(270, 34); + this.testToolStripMenuItem.Text = "Test"; + this.testToolStripMenuItem.Click += new System.EventHandler(this.testToolStripMenuItem_Click); + // // mainTableLayoutPanel // this.mainTableLayoutPanel.ColumnCount = 2; @@ -1117,6 +1125,7 @@ private System.Windows.Forms.ToolStripMenuItem clearCurrentRecordSelectedDateToolsMainMenu; private System.Windows.Forms.ToolStripMenuItem clearCurrentActiveYearTools; private System.Windows.Forms.ToolStripMenuItem examineLogsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem testToolStripMenuItem; } } diff --git a/AdvertsingProfitControl/FrmMain.cs b/AdvertsingProfitControl/FrmMain.cs index 49080cf..270abf6 100644 --- a/AdvertsingProfitControl/FrmMain.cs +++ b/AdvertsingProfitControl/FrmMain.cs @@ -2,7 +2,6 @@ using System.Data.Entity.Infrastructure; using System.Drawing; using System.Drawing.Printing; -using System.IO; using System.Linq; using System.Transactions; using System.Windows.Forms; @@ -337,43 +336,68 @@ namespace AdvertsingProfitControl private void DisplayPrintPreview(object sender, EventArgs e) { //Build and render the front and back forms of the document. - var test = new FrontPageGenerator(); - var backPageTest = new BackPageGenerator(); - var printTestPage = new PrintDocument(); - var printDialog = new PrintPreviewDialog(); - if (!usePreRenderedFilesCheckbox.Checked) - { - //var databaseTracker = new DatabaseTracker(); - //var databaseReader = new DatabaseReader(); - //var dateId = - // databaseReader.RetrieveDateIdByDateString(monthCalendar.SelectionStart.ToShortDateString(), - // databaseTracker.DatabaseConnectionString); - //var remaingingSales = _departmentSales - _salesProducedByAdItems; - //var totalProfitReturnFromReminaingSales = remaingingSales * .3m; - //var totalProfitReturn = _totalProfitReturnFromAdItems + totalProfitReturnFromReminaingSales; - ////test.BuildFormFrontCompressedLayout(dateId, _departmentSales, _salesProducedByAdItems, remaingingSales, - // //_totalProfitReturnFromAdItems, totalProfitReturnFromReminaingSales, totalProfitReturn, - // //commentsTextBox.Text); - //test.RenderHtmlToImage(); - //backPageTest.GenerateWeeklyInventoryControlPage(dateId); - //backPageTest.RenderHtmlToImage(); - } - else - { - if (File.Exists(Application.StartupPath + "\\" + "FrontPage.html") && - File.Exists(Application.StartupPath + "\\" + "Backpage.html")) - { - test.RenderHtmlToImage(); - backPageTest.RenderHtmlToImage(); - } - } + //var test = new FrontPageGenerator(); + //var backPageTest = new BackPageGenerator(); + //var printTestPage = new PrintDocument(); + //var printDialog = new PrintPreviewDialog(); + //if (!usePreRenderedFilesCheckbox.Checked) + //{ + // //var databaseTracker = new DatabaseTracker(); + // //var databaseReader = new DatabaseReader(); + // //var dateId = + // // databaseReader.RetrieveDateIdByDateString(monthCalendar.SelectionStart.ToShortDateString(), + // // databaseTracker.DatabaseConnectionString); + // //var remaingingSales = _departmentSales - _salesProducedByAdItems; + // //var totalProfitReturnFromReminaingSales = remaingingSales * .3m; + // //var totalProfitReturn = _totalProfitReturnFromAdItems + totalProfitReturnFromReminaingSales; + // ////test.BuildFormFrontCompressedLayout(dateId, _departmentSales, _salesProducedByAdItems, remaingingSales, + // // //_totalProfitReturnFromAdItems, totalProfitReturnFromReminaingSales, totalProfitReturn, + // // //commentsTextBox.Text); + // //test.RenderHtmlToImage(); + // //backPageTest.GenerateWeeklyInventoryControlPage(dateId); + // //backPageTest.RenderHtmlToImage(); + //} + //else + //{ + // if (File.Exists(Application.StartupPath + "\\" + "FrontPage.html") && + // File.Exists(Application.StartupPath + "\\" + "Backpage.html")) + // { + // test.RenderHtmlToImage(); + // backPageTest.RenderHtmlToImage(); + // } + //} //var margin = new Margins(50, 50, 0, 0); //printDoc.DefaultPageSettings.Margins = margin; - printTestPage.PrintPage += PrintPage; - printDialog.Document = printTestPage; - printDialog.ShowDialog(); - printDialog.Document = new PrintDocument(); + //printTestPage.PrintPage += PrintPage; + //printDialog.Document = printTestPage; + //printDialog.ShowDialog(); + //printDialog.Document = new PrintDocument(); + + //var dialog = new FolderBrowserDialog(); + //dialog.ShowDialog(); + //var path = dialog.SelectedPath; + var gen = new FrontPageGenerator(); + gen.BuildFormFrontCompressedLayout(_currentActiveDate); + //var pdf = gen.RenderHtmlCodeToImage(path + "\\FrontPage.html", path + "\\Image.pdf"); + //var doc = new PrintDocument(); + //doc.PrintPage += RenderPage; + //var spam = new PrintPreviewDialog {Document = doc}; + //spam.ShowDialog(); + //var form = new Test(); + //form.ShowDialog(); + } + + private void RenderPage(object sender, PrintPageEventArgs e) + { + var dialog = new FolderBrowserDialog(); + dialog.ShowDialog(); + var path = dialog.SelectedPath; + var gen = new FrontPageGenerator(); + var pdf = gen.RenderHtmlCodeToImage(path + "\\FrontPage.html", path + "\\Image.pdf"); + e.Graphics.DrawString(pdf.ToString(), DefaultFont, new SolidBrush(Color.Black), 1000, 1000); + + e.Graphics.PageUnit = GraphicsUnit.Inch; } #endregion @@ -500,7 +524,7 @@ namespace AdvertsingProfitControl var adSpecialIndex = -1; decimal totalSales = 0; decimal totalProfitReturn = 0; - var projections = db.Projections.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x); + var projections = db.Projections.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x).OrderBy(x => x.RowPosition); foreach (var p in projections) { @@ -558,7 +582,7 @@ namespace AdvertsingProfitControl { var db = new AdvertisingProfitControlModel(); var adSpecialIndex = -1; - var inventories = db.Inventories.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x); + var inventories = db.Inventories.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x).OrderBy(x => x.RowPosition); foreach (var i in inventories) { @@ -592,7 +616,7 @@ namespace AdvertsingProfitControl var adSpecialIndex = -1; decimal totalSales = 0; decimal totalProfitReturn = 0; - var actualSales = db.ActualSales.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x); + var actualSales = db.ActualSales.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x).OrderBy(x => x.RowPosition); foreach (var a in actualSales) { @@ -1124,5 +1148,13 @@ namespace AdvertsingProfitControl var result = (decimal) form.Shrink / 100; CalculateProfitAnalysis(result); } + + private void testToolStripMenuItem_Click(object sender, EventArgs e) + { + var page = new FrontPageGenerator(); + page.RenderHtmlCodeToImage("C:\\Users\\Crypto\\Desktop\\TestPage.html", + "C:\\Users\\Crypto\\Desktop\\FrontTest.pdf"); + + } } } \ No newline at end of file diff --git a/AdvertsingProfitControl/FrontPageGenerator.cs b/AdvertsingProfitControl/FrontPageGenerator.cs index 90d8a65..a981af4 100644 --- a/AdvertsingProfitControl/FrontPageGenerator.cs +++ b/AdvertsingProfitControl/FrontPageGenerator.cs @@ -1,10 +1,11 @@ using System; +using System.Drawing.Printing; using System.Windows.Forms; using System.IO; using System.Web.UI; -using System.Drawing; -using System.Drawing.Imaging; -using TheArtOfDev.HtmlRenderer.WinForms; +using System.Linq; +using System.Web.UI.WebControls; +using Pechkin; namespace AdvertsingProfitControl { @@ -23,10 +24,10 @@ namespace AdvertsingProfitControl try { - var imageFromHtml = HtmlRender.RenderToImage(code); - imageFromHtml.RotateFlip(RotateFlipType.Rotate90FlipNone); - imageFromHtml.Save(Application.StartupPath + "\\FrontPage.png", ImageFormat.Png); - imageFromHtml.Dispose(); + //var imageFromHtml = HtmlRender.RenderToImage(code); + //imageFromHtml.RotateFlip(RotateFlipType.Rotate90FlipNone); + //imageFromHtml.Save(Application.StartupPath + "\\FrontPage.png", ImageFormat.Png); + //imageFromHtml.Dispose(); } catch (Exception e) { @@ -38,469 +39,466 @@ namespace AdvertsingProfitControl } } - public void BuildFormFrontCompressedLayout(int dateId, double departmentSales, double salesProducedByAdItems, double remainingSales, double totalProfitReturnFromAdItems, double totalProfitReturnFromRemainingSales, double totalProfitReturn, string comments) + public byte[] RenderHtmlCodeToImage(string path, string targetPath) + { + var htmlCode = File.ReadAllLines(path); + var code = htmlCode.Aggregate("", (current, line) => current + "\r\n" + line); + try + { + var config = new Pechkin.GlobalConfig().SetPaperSize(PaperKind.A4).SetPaperOrientation(true); + byte[] pdfBuf = new SimplePechkin(config).Convert(code); + using (var fs = new FileStream(targetPath, FileMode.Create, FileAccess.Write)) + { + fs.Write(pdfBuf, 0, pdfBuf.Length); + } + return pdfBuf; + } + catch (Exception e) + { + _console.WriteToLog(FrmLogConsole.Level.Critical, + "Failed to generate an updated image for the back page of Advertising Profit Control."); + _console.WriteToLog(FrmLogConsole.Level.Debug, e.Message); + _console.WriteToLog(FrmLogConsole.Level.Info, "This is most likely a screw you from the GDI+ subsystem of Windows."); + + } + return new byte[1]; + } + + public void BuildFormFrontCompressedLayout(DateTime date) { - //var databaseTracker = new DatabaseTracker(); - //var databaseReader = new DatabaseReader(); var stringWriter = new StringWriter(); var writer = new HtmlTextWriter(stringWriter); - //var table = databaseReader.ReturnApcTableForReport(dateId, databaseTracker.DatabaseConnectionString); - //var dateString = databaseReader.RetrieveDateStringById(dateId, databaseTracker.DatabaseConnectionString); - //var spam = dateString.Split(' '); - //dateString = spam[0]; - //Begin evaluating the size of the table. - var isCompressedFormat = false; - var willGenerateCommentRow = false; - //if ((table.Rows.Count + 1) == 15) - //{ - // willGenerateCommentRow = true; - //} - //else if ((table.Rows.Count + 1) < 15) - //{ - // isCompressedFormat = true; - //} + var db = new AdvertisingProfitControlModel(); + var dateRecord = db.WeekEndingDates.SingleOrDefault(x => x.EndingDate == date); + if (dateRecord == null) + { + MessageBox.Show("Failed"); + return; + } writer.Write("\n"); writer.RenderBeginTag(HtmlTextWriterTag.Html); writer.RenderBeginTag(HtmlTextWriterTag.Head); writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css"); + //Set the global style for the data cells. writer.RenderBeginTag(HtmlTextWriterTag.Style); - writer.Write("th{margins:0; padding:0; vertical-align:bottom; height:35px; font-size:14px; border:1px solid black}"); - writer.Write("td{margins:0; padding:0; border:1px solid black; font-size:14px; text-align:center; height:35px}"); - writer.RenderEndTag();//style - writer.RenderEndTag(); // Head - writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:11in; height:8in"); + writer.Write("td{margins:0; padding:2px; border:1px solid black; font-size:20px; text-align:center; vertical-align:bottom}"); + writer.RenderEndTag();// end style + writer.RenderEndTag(); // end Head writer.RenderBeginTag(HtmlTextWriterTag.Body); - //Begin building the header for the page, the HTML engine doesn't seem to like putting content in the Head. - writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin-top:200px; width:100%"); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-collapse: collapse; width:100%; height:100%"); //style for the table writer.RenderBeginTag(HtmlTextWriterTag.Table); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin:0px; padding:0px"); - writer.RenderBeginTag(HtmlTextWriterTag.Tr); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "font-size:14px; width:20%; vertical-align:bottom; border:none"); + //Begin rendering the top rows, the form name, store, department and date fields. + writer.RenderBeginTag(HtmlTextWriterTag.Tr);//begin first row + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; font-size:40px"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "20"); writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("

Store Name: Allen's of Hastings

"); - writer.RenderEndTag();//td - writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:50%; font-size:15px; margin:0px; padding: 0px 0px 0px 0px; border:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); //

(Mode: " + (willGenerateCommentRow ? "Generates Comment row" : "Compressed Format") + ") - writer.Write("

Advertising Profit Control v " + Application.ProductVersion + "

"); - writer.RenderEndTag();//td - writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:33%; padding: 0px 0px 0px 0px; margin:0px; border:none; vertical-align:bottom"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("

Week Ending: + dateString +
Department: Produce

"); - writer.RenderEndTag();//td - writer.RenderEndTag();//tr - writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin:0px; padding:0px"); - writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.Write("Advertising Profit Control v" + Application.ProductVersion + ""); + writer.RenderEndTag();//end product cell. + writer.RenderEndTag(); //End of first row + writer.RenderBeginTag(HtmlTextWriterTag.Tr); //begin second row + writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:left; border:none"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "9"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//begin store name cell + writer.Write("Store Name: Allen's of Hastings"); + writer.RenderEndTag();//end store name cell + writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:right; border:none"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "11"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //begin date and department cell + writer.Write("Week Ending: " + date.ToString("d") + "
Department: Produce"); + writer.RenderEndTag();//End date and department cell + writer.RenderEndTag();// second row + writer.RenderBeginTag(HtmlTextWriterTag.Tr);//begin label row writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none"); writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.RenderEndTag();//td + writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("

ProjectionActual

"); - writer.RenderEndTag();//td + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "6"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//projections label cell + writer.Write("Projection"); + writer.RenderEndTag();//end projections label cell writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("

Profit Analysis

"); - writer.RenderEndTag();//td - writer.RenderEndTag();//tr - writer.RenderEndTag();//table - //END of header table structure - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-collapse: collapse; width:11in; height:7.0in; table-layout:fixed"); //style for the table - writer.RenderBeginTag(HtmlTextWriterTag.Table); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "10"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//actual label cell + writer.Write("Actual"); + writer.RenderEndTag();//end actual label cell + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "3"); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//cost analysis label cell + writer.Write("Cost Analysis"); + writer.RenderEndTag();//end cost analysis label cell + writer.RenderEndTag();//end label row (third row) writer.RenderBeginTag(HtmlTextWriterTag.Tr); //Begin building the header row. - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none; border-right:double"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Ad Items"); writer.RenderEndTag(); //th writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Sold"); writer.RenderEndTag(); //th writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Sale
Price"); writer.RenderEndTag(); //th writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Total
Sales"); writer.RenderEndTag(); //th writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Cost"); writer.RenderEndTag(); //th writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("$
Prof.
Retn."); writer.RenderEndTag(); //th - writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border-right:double"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Total
$
Prof.
Retn."); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Beg.
Inv."); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Rec'd"); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Total"); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("End.
Inv."); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Sold"); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Sale
Price"); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Total
Sales"); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Cost"); writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("$
Prof.
Retn."); - writer.RenderEndTag(); //th - writer.RenderBeginTag(HtmlTextWriterTag.Th); + writer.RenderEndTag(); //th + writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write("Total
$
Prof.
Retn."); writer.RenderEndTag(); //th //Department Sales - writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:159px; border-right:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("
Department
Sales

1"+ $"{departmentSales:C}" + "

"); - writer.RenderEndTag();//td + //Grab the department sales from the database + var departmentRecord = db.WeeklySales.SingleOrDefault(x => x.FkDateId == dateRecord.Id); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; border-left:double; font-size:9px"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//begin number cell + writer.Write("1"); + writer.RenderEndTag();//end number cell + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; border-left:none"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//begin department sales cell + writer.Write("Department
Sales"); + writer.RenderEndTag();//end department sales cell + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; border-left:none"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//department sales total sales column + writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin:0px; border-left:1px solid black; border-top:1px dashed black; text-align:right"); + writer.RenderBeginTag(HtmlTextWriterTag.P);//begin department sales paragraph tag; used because the borders of the element are flush with that of the cell's. + writer.Write(departmentRecord == null ? "$0.00" : $"{departmentRecord.TotalSales:C}"); + writer.RenderEndTag();//end department sales paragraph tag + writer.RenderEndTag();//department sales total sales column writer.RenderEndTag();//End of header row code. - - var isRowMember = false; - var isRenderingGroup = false; - var adSpecialRowIndex = -1; - //Variables for the Totals row. - double projectionProfitReturn = 0; - double projectionTotalProfitReturn = 0; - double actualProfitReturn = 0; - double actualTotalProfitReturn = 0; - var adSpecialOffset = 0; //Profit Analysis values. - //for (var rowIndex = 0; rowIndex < (table.Rows.Count < 19 ? 19 : table.Rows.Count); rowIndex++) //The comparison in the for loop is index based, so no need to add one to the row count. - //{ - // var isProfitAnalysisCell = false; - // //IF the row index goes beyond the number of rows that are in the table, then start padding with blank cells to fit the Profit Analysis cells. - // if (rowIndex < table.Rows.Count) - // { - // var row = table.Rows[rowIndex]; - // var rowAttribute = 0; - // var groupId = 0; - // if (int.TryParse(row.ItemArray[17].ToString(), out rowAttribute)) - // { - // if (rowAttribute != 0) - // { - // if (rowAttribute == 1) - // { - // isRowMember = false; - // } - // else - // { - // isRowMember = true; - // } - // isRenderingGroup = true; - // } - // else - // { - // isRenderingGroup = false; - // isRowMember = false; - // } - // } - // if (adSpecialRowIndex == -1 && int.TryParse(row.ItemArray[18].ToString(), out groupId)) - // { - // if (groupId != 0) - // { - // adSpecialRowIndex = rowIndex; - // writer.RenderBeginTag(HtmlTextWriterTag.Tr); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("
" + - // databaseReader.ReturnGroupNameFromGroupId(groupId.ToString(), - // databaseTracker.DatabaseConnectionString) + "
"); - // writer.RenderEndTag(); //td - // writer.RenderEndTag(); //tr - // BuildProfitAnalysisCell(ref writer, rowIndex, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn); - // adSpecialOffset++; - // } - // } - // writer.RenderBeginTag(HtmlTextWriterTag.Tr); - // for (var i = 0; i < row.ItemArray.Length; i++) - // { - // if (i >= 17) continue; - // if (i == 0) - // { - // writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "left"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none"); - // } - // else if (i > 0 && i < 7) - // { - // //background-color:#e9e9e9 - // writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#e9e9e9"); - // } - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // decimal number; - // if (decimal.TryParse(row.ItemArray[i].ToString(), out number)) - // { - // //Check for the inventory columns and the sold columns. - // if (!isRowMember) - // { - // if (i == 1 || i > 6 && i < 12) - // { - // writer.Write(number == 0 ? "0" : row.ItemArray[i].ToString()); - // } - // if (i > 1 && i < 7 || i > 11) - // { - // writer.Write(number == 0 ? "0.00" : $"{number:N}"); - // } - // } + var projections = db.Projections.Where(x => x.FkDateId == dateRecord.Id).OrderBy(x => x.RowPosition).ToList(); + var inventory = db.Inventories.Where(x => x.FkDateId == dateRecord.Id).OrderBy(x => x.RowPosition).ToList(); + var actualSales = db.ActualSales.Where(x => x.FkDateId == dateRecord.Id).OrderBy(x => x.RowPosition).ToList(); + var comments = db.Notes.SingleOrDefault(x => x.FkDateId == dateRecord.Id); + var projectionA = projections.Sum(x => x.TotalSales); + var projectionB = projections.Sum(x => x.TotalProfitReturn); + var actualA = actualSales.Sum(x => x.TotalSales); + var actualB = actualSales.Sum(x => x.TotalProfitReturn); + var adSpecialIndex = -1; + for (var i = 0; i < 25; i++) + { + var skipCheck = false; + if (i < projections.Count) + { + if (projections[i].FkAdSpecialId != null) + { + if (adSpecialIndex == -1) + { + writer.RenderBeginTag(HtmlTextWriterTag.Tr); //ad special table row + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none; border-right:double"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write(projections[i].AdSpecial.Name); + writer.RenderEndTag(); //ad special cell + skipCheck = true; + SelectCostAnalysisCell(i, ref writer, actualA, actualB, departmentRecord, comments); + writer.RenderEndTag(); //end ad special row + } + adSpecialIndex = i; + } + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.AddAttribute(HtmlTextWriterAttribute.Style, + "border-left:none; border-right:double; text-align:left"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //ad item cell + writer.Write(projections[i].AdItem.Name); + writer.RenderEndTag(); //end ad item cell + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //projection sold + writer.Write(projections[i].Sold); + writer.RenderEndTag(); //end projection sold + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //projection sale price + writer.Write(projections[i].SalePrice); + writer.RenderEndTag(); //end projection sale price + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //projection total sales + writer.Write($"{projections[i].TotalSales:N2}"); + writer.RenderEndTag(); //end projection total sales + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //projection cost + writer.Write($"{projections[i].Cost:N2}"); + writer.RenderEndTag(); //end projection cost + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //projection profit return + writer.Write($"{projections[i].ProfitReturn:N2}"); + writer.RenderEndTag(); //end projection profit return + writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border-right:double"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //projection total profit return + writer.Write($"{projections[i].TotalProfitReturn:N2}"); + writer.RenderEndTag(); //end projection total profit return + writer.RenderBeginTag(HtmlTextWriterTag.Td); //inventory beginning + writer.Write(inventory[i].BeginningInventory); + writer.RenderEndTag(); //end inventory beginning + writer.RenderBeginTag(HtmlTextWriterTag.Td); //inventory received + writer.Write(inventory[i].Recieved); + writer.RenderEndTag(); //end inventory received + writer.RenderBeginTag(HtmlTextWriterTag.Td); //inventory total + writer.Write(inventory[i].TotalInventory); + writer.RenderEndTag(); //end inventory total + writer.RenderBeginTag(HtmlTextWriterTag.Td); //inventory ending + writer.Write(inventory[i].EndingInventory); + writer.RenderEndTag(); //end inventory ending + writer.RenderBeginTag(HtmlTextWriterTag.Td); //actual sales sold + writer.Write(actualSales[i].Sold); + writer.RenderEndTag(); //end actual sales sold + writer.RenderBeginTag(HtmlTextWriterTag.Td); //actual sales sale price + writer.Write(actualSales[i].SalePrice); + writer.RenderEndTag(); //end actual sales sale price + writer.RenderBeginTag(HtmlTextWriterTag.Td); //actual sales total sales + writer.Write($"{actualSales[i].TotalSales:N2}"); + writer.RenderEndTag(); //end actual sales total sales + writer.RenderBeginTag(HtmlTextWriterTag.Td); //actual sales cost + writer.Write($"{actualSales[i].Cost:N2}"); + writer.RenderEndTag(); //end actual sales cost + writer.RenderBeginTag(HtmlTextWriterTag.Td); //actual sales profit return + writer.Write($"{actualSales[i].ProfitReturn:N2}"); + writer.RenderEndTag(); //end actual sales profit return + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:double"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); //actual sales total profit return + writer.Write($"{actualSales[i].TotalProfitReturn:N2}"); + writer.RenderEndTag(); //end actual sales total profit return + } + else + { + //Pad + AppendPaddingRow(ref writer); + } + if(!skipCheck) SelectCostAnalysisCell(adSpecialIndex != -1 ? i + 1 : i, ref writer, actualA, actualB, departmentRecord, comments); + writer.RenderEndTag();//tr + } + //Create the totals row + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none; border-right:double"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//empty cell + writer.RenderEndTag();//end padding + writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:right"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//projections total label cell + writer.Write("TOTAL"); + writer.RenderEndTag();//end projections total label cell + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//projections A (total sales) + writer.Write("(A) " + $"{projectionA:N2}"); + writer.RenderEndTag();//end projections A (total sales) + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:double"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//projections B (total profit return) + writer.Write("(B) " + $"{projectionB:N2}"); + writer.RenderEndTag();//end projections B (total profit return) + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5"); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:right"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//actual sales total label cell + writer.Write("TOTAL"); + writer.RenderEndTag();//end actual sales total label cell + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//actual sales A (total sales) + writer.Write("(A) " + $"{actualA:N2}"); + writer.RenderEndTag();//end actual sales A (total sales) + writer.RenderBeginTag(HtmlTextWriterTag.Td);//begin empty cell + writer.RenderEndTag();//end empty cell + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:double"); + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//actual sales B (total profit return) + writer.Write("(B) " + $"{actualB:N2}"); + writer.RenderEndTag();//end actual sales A (total profit return) + writer.RenderEndTag();//end totals row + //end totals row + writer.RenderEndTag();//table + writer.RenderEndTag();//body + writer.RenderEndTag();//HTML - // switch (i) - // { - // case 3: - // projectionProfitReturn += double.Parse(row.ItemArray[3].ToString()); - // break; - // case 6: - // projectionTotalProfitReturn += double.Parse(row.ItemArray[6].ToString()); - // break; - // case 13: - // actualProfitReturn += double.Parse(row.ItemArray[13].ToString()); - // break; - // case 16: - // actualTotalProfitReturn += double.Parse(row.ItemArray[16].ToString()); - // break; - // } - // } - // else - // { - // writer.Write(row.ItemArray[i]); - // } - // writer.RenderEndTag(); //td - // } - // } - // else - // { - // //Padding - // writer.RenderBeginTag(HtmlTextWriterTag.Tr); - // //Generate padding rows to fit the Profit Analysis cells properly onto the sheet. - // //Check to see if the row index is equal to the number of rows in the table. - // if (rowIndex == table.Rows.Count) - // { - // //IF so, then that means the current row index represents the index of the Totals row. So build the totals row with the added values from above. - // //Begin rendering the totals row. - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; border-left:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; text-align:right"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("Total"); - // writer.RenderEndTag(); //td - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(A) " + $"{projectionProfitReturn:C}"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(B) " + $"{projectionTotalProfitReturn:C}"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:right"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("Total"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(A) " + $"{actualProfitReturn:C}"); - // writer.RenderEndTag(); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(B) " + $"{actualTotalProfitReturn:C}"); - // writer.RenderEndTag();//td - // //END rending the totals row. - // BuildProfitAnalysisCell(ref writer, rowIndex + adSpecialOffset, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn); - // } - // else if (rowIndex == (table.Rows.Count + 1)) - // //Check to see if the current index is equal to the row after the totals row and, if so, create the comments row. - // { - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "17"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write( - // "Comments: " + comments); - // writer.RenderEndTag(); //td - // BuildProfitAnalysisCell(ref writer, rowIndex + adSpecialOffset, out isProfitAnalysisCell, salesProducedByAdItems, remainingSales, totalProfitReturnFromAdItems, totalProfitReturnFromRemainingSales, totalProfitReturn); - // } - // else - // { - // var cellCount = 0; - // while (cellCount < 17) - // { - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.RenderEndTag();//td - // cellCount++; - // } - // } - // } - //Check for every 3rd row to append a Profit Analysis cell onto. - // switch (rowIndex + adSpecialOffset) - // { - // case 0: - // writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("
Sales Produced By
Ad Items (A)

2" + $"{salesProducedByAdItems:C}" + "

"); - // writer.RenderEndTag(); - // break; - // case 3: - // writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("
Remaining
Sales

3" + $"{remainingSales:C}" + "

"); - // writer.RenderEndTag(); - // break; - // case 6: - // writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("
Total $ Profit Return
From Ad Items (B)

4" + $"{totalProfitReturnFromAdItems:C}" + "

"); - // writer.RenderEndTag(); - // break; - // case 9: - // writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-top:1px solid black; border-right:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("
Total $ Profit Return
From Remaining Sales

5" + $"{totalProfitReturnFromRemainingSales:C}" + "

"); - // writer.RenderEndTag(); - // break; - // case 12: - // writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("
Total $ Profit
Return

6" + $"{totalProfitReturn:C}" + "

"); - // writer.RenderEndTag(); - // break; - // case 15: - // //IF either the compressed format or the generate comment row flags are set, then ignore this case. Only tables with 19 or more rows can generate a full comments cell due to the amount of text it can contain. - // if (isCompressedFormat || willGenerateCommentRow) break; - // writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "4"); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("Comments: " + comments); - // writer.RenderEndTag(); - // break; - // } - - // writer.RenderEndTag();//tr - //}//end for loop - - //if (!willGenerateCommentRow && !isCompressedFormat) - //{ - // //Begin rendering the totals row. - // writer.RenderBeginTag(HtmlTextWriterTag.Tr); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; border-left:none"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; text-align:right"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("Total"); - // writer.RenderEndTag(); //td - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(A) " + $"{projectionProfitReturn:C}"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9; border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(B) " + $"{projectionTotalProfitReturn:C}"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; text-align:right"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("Total"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(A) " + $"{actualProfitReturn:C}"); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.RenderEndTag(); - // writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:1px solid black; font-size:12px; border-left: 1px solid #000; padding: 0px 0px 0px 5px"); - // writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2"); - // writer.RenderBeginTag(HtmlTextWriterTag.Td); - // writer.Write("(B) " + $"{actualTotalProfitReturn:C}"); - // writer.RenderEndTag();//td - // writer.RenderEndTag(); //tr - //} - //writer.RenderEndTag();//table - //writer.RenderEndTag();//body - //writer.RenderEndTag();//HTML - - //using (var streamWriter = new StreamWriter(Application.StartupPath + "\\FrontPage.html")) - //{ - // streamWriter.WriteLine(stringWriter.ToString()); - //} - //RenderHtmlToImage(); + using (var streamWriter = new StreamWriter("C:\\Users\\Crypto\\Desktop\\TestPage.html")) + { + streamWriter.WriteLine(stringWriter.ToString()); + } + RenderHtmlToImage(); } - private void BuildProfitAnalysisCell(ref HtmlTextWriter writer, int rowIndex, out bool isProfitAnalysisCell, double salesProducedByAdItems, double remainingSales, double totalProfitReturnFromAdItems, double totalProfitReturnFromRemainingSales, double totalProfitReturn) + private void RenderCostsAnalysisCell(CostAnalysisCells cell, ref HtmlTextWriter writer, decimal? value, string rowSpan) + { + var number = string.Empty; + var labelText = string.Empty; + + switch (cell) + { + case CostAnalysisCells.DepartmentSales: + number = "1"; + labelText = "Department
Sales"; + break; + case CostAnalysisCells.SalesProduced: + number = "2"; + labelText = "Sales Produced
by
Ad Items (A)"; + break; + case CostAnalysisCells.RemainingSales: + number = "3"; + labelText = "Remaining
Sales
(Line 1 minus
Line 2)"; + break; + case CostAnalysisCells.ProfitReturnFromAdItems: + number = "4"; + labelText = "Total $ Profit
Return From Ad
Items (B)"; + break; + case CostAnalysisCells.ProfitReturnFromRemainingSales: + number = "5"; + labelText = "Total $ Profit Return
From Remaining Sales

Going-in Gross % x Remaining Sales"; + break; + case CostAnalysisCells.TotalProfitReturn: + number = "6"; + labelText = "Total $ Profit
Return

Line 4 Plus Line 5"; + break; + case CostAnalysisCells.CrossProfitInfoCell: + break; + case CostAnalysisCells.Comments: + break; + default: + throw new ArgumentOutOfRangeException(nameof(cell), cell, null); + } + writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, rowSpan); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; border-left:double; font-size:14px; width:25px"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//begin number cell + writer.Write(number); + writer.RenderEndTag();//end number cell + writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, rowSpan); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; border-left:none; width:200px"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//begin department sales cell + writer.Write(labelText); + writer.RenderEndTag();//end department sales cell + writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, rowSpan); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; border-left:none; width:75px"); + writer.RenderBeginTag(HtmlTextWriterTag.Td);//department sales total sales column + writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin:0px; border-left:1px solid black; border-top:1px dashed black; text-align:right"); + writer.RenderBeginTag(HtmlTextWriterTag.P);//begin department sales paragraph tag; used because the borders of the element are flush with that of the cell's. + writer.Write($"{value:C}"); + writer.RenderEndTag();//end department sales paragraph tag + writer.RenderEndTag();//department sales total sales column + } + + private void RenderCostsAnalysisCell(CostAnalysisCells cell, ref HtmlTextWriter writer, string value = "") + { + writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "3"); + switch (cell) + { + case CostAnalysisCells.CrossProfitInfoCell: + writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "3"); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; text-align:left"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("To Find Gross Profit % Divide
Total Profit Return By Dept.
Weekly Retail Sales"); + break; + case CostAnalysisCells.Comments: + writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "5"); + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none; text-align:left; vertical-align:top"); + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("Comments: " + value); + break; + } + writer.RenderEndTag(); + } + + private void SelectCostAnalysisCell(int rowIndex, ref HtmlTextWriter writer, decimal? actualA, decimal? actualB, WeeklySale departmentRecord, Note comments) { - isProfitAnalysisCell = false; switch (rowIndex) { case 0: - writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:1px solid black; border-right:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("
Sales Produced By
Ad Items (A)

2" + $"{salesProducedByAdItems:C}" + "

"); - writer.RenderEndTag(); + RenderCostsAnalysisCell(CostAnalysisCells.SalesProduced, ref writer, actualA, "3"); break; case 3: - writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:1px solid black; border-top:1px solid black; border-right:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("
Remaining
Sales

3" + $"{remainingSales:C}" + "

"); - writer.RenderEndTag(); + if (departmentRecord != null) + RenderCostsAnalysisCell(CostAnalysisCells.RemainingSales, ref writer, departmentRecord.TotalSales - actualA, "4"); break; - case 6: - writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:1px solid black; border-top:1px solid black; border-right:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("
Total $ Profit Return
From Ad Items (B)

4" + $"{totalProfitReturnFromAdItems:C}" + "

"); - writer.RenderEndTag(); + case 7: + RenderCostsAnalysisCell(CostAnalysisCells.ProfitReturnFromAdItems, ref writer, actualB, "3"); break; - case 9: - writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-right:1px solid black; border-top:1px solid black; border-right:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("
Total $ Profit Return
From Remaining Sales

5" + $"{totalProfitReturnFromRemainingSales:C}" + "

"); - writer.RenderEndTag(); + case 10: + //get cross profit return + var s = (decimal) 0.3; + RenderCostsAnalysisCell(CostAnalysisCells.ProfitReturnFromRemainingSales, ref writer, s * (departmentRecord.TotalSales - actualA), "5"); break; - case 12: - writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2"); - writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none"); - writer.RenderBeginTag(HtmlTextWriterTag.Td); - writer.Write("
Total $ Profit
Return

6" + $"{totalProfitReturn:C}" + "

"); - writer.RenderEndTag(); + case 15: + var x = (decimal) 0.3 * (departmentRecord.TotalSales - actualA); + RenderCostsAnalysisCell(CostAnalysisCells.TotalProfitReturn, ref writer, x + actualB, "4"); + break; + case 19: + RenderCostsAnalysisCell(CostAnalysisCells.CrossProfitInfoCell, ref writer); + break; + case 22: + RenderCostsAnalysisCell(CostAnalysisCells.Comments, ref writer, comments.Remark); break; } } + + private void AppendPaddingRow(ref HtmlTextWriter writer) + { + var cellCount = 0; + writer.RenderBeginTag(HtmlTextWriterTag.Tr); + while (cellCount < 17) + { + switch (cellCount) + { + case 0: + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-left:none; border-right:double"); + break; + case 6: + case 16: + writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:double"); + break; + } + writer.RenderBeginTag(HtmlTextWriterTag.Td); + writer.Write("
"); + writer.RenderEndTag(); + cellCount++; + } + } + + private enum CostAnalysisCells + { + DepartmentSales = 0, + SalesProduced = 1, + RemainingSales = 2, + ProfitReturnFromAdItems = 3, + ProfitReturnFromRemainingSales = 4, + TotalProfitReturn = 5, + CrossProfitInfoCell = 6, + Comments = 7 + } } } diff --git a/AdvertsingProfitControl/packages.config b/AdvertsingProfitControl/packages.config index d705809..c2bb520 100644 --- a/AdvertsingProfitControl/packages.config +++ b/AdvertsingProfitControl/packages.config @@ -1,6 +1,7 @@  + + - - + \ No newline at end of file diff --git a/SetupProject/bin/Debug/SetupProject.msi b/SetupProject/bin/Debug/SetupProject.msi deleted file mode 100644 index f22cc11..0000000 Binary files a/SetupProject/bin/Debug/SetupProject.msi and /dev/null differ diff --git a/SetupProject/bin/Debug/SetupProject.wixpdb b/SetupProject/bin/Debug/SetupProject.wixpdb deleted file mode 100644 index d15c2ee..0000000 --- a/SetupProject/bin/Debug/SetupProject.wixpdb +++ /dev/null @@ -1 +0,0 @@ -
112522Installation Database3SetupProject4Garritt McCune5Installer6This installer database contains the logic and data required to install SetupProject.7Intel;10339{A8EBA790-33E9-4644-A865-FF3F46A4B6C4}14200152192122017/04/11 13:47:22132017/04/11 13:47:2218Windows Installer XML Toolset (3.11.0.1528)
_SummaryInformationPropertyIdN_SummaryInformationValueN_ValidationTableNIdentifierName of table_ValidationColumnNIdentifierName of column_ValidationNullableNY;NWhether the column is nullable_ValidationMinValueY-21474836472147483647Minimum value allowed_ValidationMaxValueY-21474836472147483647Maximum value allowed_ValidationKeyTableYIdentifierFor foreign key, Name of table to which data must link_ValidationKeyColumnY132Column to which foreign key connects_ValidationCategoryYText;Formatted;Template;Condition;Guid;Path;Version;Language;Identifier;Binary;UpperCase;LowerCase;Filename;Paths;AnyPath;WildCardFilename;RegPath;CustomSource;Property;Cabinet;Shortcut;FormattedSDDLText;Integer;DoubleInteger;TimeDate;DefaultDirString category_ValidationSetYTextSet of values that are permitted_ValidationDescriptionYTextDescription of columnAdminExecuteSequenceActionNIdentifierName of action to invoke, either in the engine or the handler DLL.AdminExecuteSequenceConditionYConditionOptional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.AdminExecuteSequenceSequenceY-432767Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.AdminUISequenceActionNIdentifierName of action to invoke, either in the engine or the handler DLL.AdminUISequenceConditionYConditionOptional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.AdminUISequenceSequenceY-432767Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.AdvtExecuteSequenceActionNIdentifierName of action to invoke, either in the engine or the handler DLL.AdvtExecuteSequenceConditionYConditionOptional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.AdvtExecuteSequenceSequenceY-432767Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.ComponentComponentNIdentifierPrimary key used to identify a particular component record.ComponentComponentIdYGuidA string GUID unique to this component, version, and language.ComponentDirectory_NDirectory1IdentifierRequired key of a Directory table record. This is actually a property name whose value contains the actual path, set either by the AppSearch action or with the default setting obtained from the Directory table.ComponentAttributesNRemote execution option, one of irsEnumComponentConditionYConditionA conditional statement that will disable this component if the specified condition evaluates to the 'True' state. If a component is disabled, it will not be installed, regardless of the 'Action' state associated with the component.ComponentKeyPathYFile;Registry;ODBCDataSource1IdentifierEither the primary key into the File table, Registry table, or ODBCDataSource table. This extract path is stored when the component is installed, and is used to detect the presence of the component and to return the path to it.DirectoryDirectoryNIdentifierUnique identifier for directory entry, primary key. If a property by this name is defined, it contains the full path to the directory.DirectoryDirectory_ParentYDirectory1IdentifierReference to the entry in this table specifying the default parent directory. A record parented to itself or with a Null parent represents a root of the install tree.DirectoryDefaultDirNDefaultDirThe default sub-path under parent's path.FeatureFeatureNIdentifierPrimary key used to identify a particular feature record.FeatureFeature_ParentYFeature1IdentifierOptional key of a parent record in the same table. If the parent is not selected, then the record will not be installed. Null indicates a root item.FeatureTitleYTextShort text identifying a visible feature item.FeatureDescriptionYTextLonger descriptive text describing a visible feature item.FeatureDisplayY032767Numeric sort order, used to force a specific display ordering.FeatureLevelN032767The install level at which record will be initially selected. An install level of 0 will disable an item and prevent its display.FeatureDirectory_YDirectory1UpperCaseThe name of the Directory that can be configured by the UI. A non-null value will enable the browse button.FeatureAttributesN0;1;2;4;5;6;8;9;10;16;17;18;20;21;22;24;25;26;32;33;34;36;37;38;48;49;50;52;53;54Feature attributesFeatureComponentsFeature_NFeature1IdentifierForeign key into Feature table.FeatureComponentsComponent_NComponent1IdentifierForeign key into Component table.FileFileNIdentifierPrimary key, non-localized token, must match identifier in cabinet. For uncompressed files, this field is ignored.FileComponent_NComponent1IdentifierForeign key referencing Component that controls the file.FileFileNameNFilenameFile name used for installation, may be localized. This may contain a "short name|long name" pair.FileFileSizeN02147483647Size of file in bytes (long integer).FileVersionYFile1VersionVersion string for versioned files; Blank for unversioned files.FileLanguageYLanguageList of decimal language Ids, comma-separated if more than one.FileAttributesY032767Integer containing bit flags representing file attributes (with the decimal value of each bit position in parentheses)FileSequenceN12147483647Sequence with respect to the media images; order must track cabinet order.InstallExecuteSequenceActionNIdentifierName of action to invoke, either in the engine or the handler DLL.InstallExecuteSequenceConditionYConditionOptional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.InstallExecuteSequenceSequenceY-432767Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.InstallUISequenceActionNIdentifierName of action to invoke, either in the engine or the handler DLL.InstallUISequenceConditionYConditionOptional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.InstallUISequenceSequenceY-432767Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.LaunchConditionConditionNConditionExpression which must evaluate to TRUE in order for install to commence.LaunchConditionDescriptionNFormattedLocalizable text to display when condition fails and install must abort.MediaDiskIdN132767Primary key, integer to determine sort order for table.MediaLastSequenceN02147483647File sequence number for the last file for this media.MediaDiskPromptYTextDisk name: the visible text actually printed on the disk. This will be used to prompt the user when this disk needs to be inserted.MediaCabinetYCabinetIf some or all of the files stored on the media are compressed in a cabinet, the name of that cabinet.MediaVolumeLabelYTextThe label attributed to the volume.MediaSourceYPropertyThe property defining the location of the cabinet file.PropertyPropertyNIdentifierName of property, uppercase if settable by launcher or loader.PropertyValueNTextString value for property. Never null or empty.RegistryRegistryNIdentifierPrimary key, non-localized token.RegistryRootN-13The predefined root key for the registry value, one of rrkEnum.RegistryKeyNRegPathThe key for the registry value.RegistryNameYFormattedThe registry value name.RegistryValueYFormattedThe registry value.RegistryComponent_NComponent1IdentifierForeign key into the Component table referencing component that controls the installing of the registry value.RemoveFileFileKeyNIdentifierPrimary key used to identify a particular file entryRemoveFileComponent_NComponent1IdentifierForeign key referencing Component that controls the file to be removed.RemoveFileFileNameYWildCardFilenameName of the file to be removed.RemoveFileDirPropertyNIdentifierName of a property whose value is assumed to resolve to the full pathname to the folder of the file to be removed.RemoveFileInstallModeN1;2;3Installation option, one of iimEnum.ShortcutShortcutNIdentifierPrimary key, non-localized token.ShortcutDirectory_NDirectory1IdentifierForeign key into the Directory table denoting the directory where the shortcut file is created.ShortcutNameNFilenameThe name of the shortcut to be created.ShortcutComponent_NComponent1IdentifierForeign key into the Component table denoting the component whose selection gates the the shortcut creation/deletion.ShortcutTargetNShortcutThe shortcut target. This is usually a property that is expanded to a file or a folder that the shortcut points to.ShortcutArgumentsYFormattedThe command-line arguments for the shortcut.ShortcutDescriptionYTextThe description for the shortcut.ShortcutHotkeyY032767The hotkey for the shortcut. It has the virtual-key code for the key in the low-order byte, and the modifier flags in the high-order byte. ShortcutIcon_YIcon1IdentifierForeign key into the File table denoting the external icon file for the shortcut.ShortcutIconIndexY-3276732767The icon index for the shortcut.ShortcutShowCmdY1;3;7The show command for the application window.The following values may be used.ShortcutWkDirYIdentifierName of property defining location of working directory.ShortcutDisplayResourceDLLYFormattedThe Formatted string providing the full path to the language neutral file containing the MUI Manifest.ShortcutDisplayResourceIdY032767The display name index for the shortcut. This must be a non-negative number.ShortcutDescriptionResourceDLLYFormattedThe Formatted string providing the full path to the language neutral file containing the MUI Manifest.ShortcutDescriptionResourceIdY032767The description name index for the shortcut. This must be a non-negative number.UpgradeUpgradeCodeNGuidThe UpgradeCode GUID belonging to the products in this set.UpgradeVersionMinYTextThe minimum ProductVersion of the products in this set. The set may or may not include products with this particular version.UpgradeVersionMaxYTextThe maximum ProductVersion of the products in this set. The set may or may not include products with this particular version.UpgradeLanguageYLanguageA comma-separated list of languages for either products in this set or products not in this set.UpgradeAttributesN02147483647The attributes of this product set.UpgradeRemoveYFormattedThe list of features to remove when uninstalling a product from this set. The default is "ALL".UpgradeActionPropertyNUpperCaseThe property to set when a product in this set is found.
CostInitialize800FileCost900CostFinalize1000InstallValidate1400InstallInitialize1500InstallAdminPackage3900InstallFiles4000InstallFinalize6600
CostInitialize800FileCost900CostFinalize1000ExecuteAction1300
CostInitialize800CostFinalize1000InstallValidate1400InstallInitialize1500CreateShortcuts4500PublishFeatures6300PublishProduct6400InstallFinalize6600
AdvertisingProfitControl.exe{AAAD87C7-D51C-5756-BDDB-6A4DDE4DED70}INSTALLFOLDER0AdvertsingProfitControl.exeApplicationShortcut{6C1CB7D7-F3C3-57BA-A6F4-0D8A93A4290C}ApplicationProgramsFolder4reg768CF79333DAE472F46E14E8D9D119FA
INSTALLFOLDERProgramFilesFoldercream0jw|Advertising Profit ControlProgramFilesFolderTARGETDIR.ApplicationProgramsFolderProgramMenuFoldergehljqbi|Advertising Profit ControlProgramMenuFolderTARGETDIR.AppDataFolderLocalAppDataFolderAPCLocalAppDataFolderTARGETDIR.TARGETDIRSourceDir
ProductFeatureAdvertisingProfitControl210
ProductFeatureAdvertisingProfitControl.exeProductFeatureApplicationShortcut
AdvertsingProfitControl.exeAdvertisingProfitControl.exejk2qbs2k.exe|AdvertsingProfitControl.exe31590401.10.0.005121
FindRelatedProducts25LaunchConditions100ValidateProductID700CostInitialize800FileCost900CostFinalize1000MigrateFeatureStates1200InstallValidate1400InstallInitialize1500ProcessComponents1600UnpublishFeatures1800RemoveRegistryValues2600RemoveShortcuts3200RemoveFiles3500InstallFiles4000CreateShortcuts4500WriteRegistryValues5000RegisterUser6000RegisterProduct6100PublishFeatures6300PublishProduct6400InstallFinalize6600RemoveExistingProducts1401
FindRelatedProducts25LaunchConditions100ValidateProductID700CostInitialize800FileCost900CostFinalize1000MigrateFeatureStates1200ExecuteAction1300
NOT WIX_DOWNGRADE_DETECTEDA newer version of [ProductName] is already installed.
11#cab1.cab
ALLUSERS1ManufacturerGarritt McCuneProductCode{9038E443-1B25-4942-973C-41ED2ECA96C3}ProductLanguage1033ProductNameSetupProjectProductVersion1.0.0.0UpgradeCode{A416A558-D7C0-4F24-8B1E-2D01761AD15F}SecureCustomPropertiesWIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED
reg768CF79333DAE472F46E14E8D9D119FA1Software\Microsoft\AdvertsingProfitControlinstalled#1ApplicationShortcut
CleanUpShortCutApplicationShortcutApplicationProgramsFolder2
ApplicationStartMenuShortcutApplicationProgramsFolderqg7xgcex|Advertising Profit ControlApplicationShortcut[#AdvertsingProfitControl.exe]Profit Control Recording SoftwareAPPLICATIONROOTDIRECTORY
{A416A558-D7C0-4F24-8B1E-2D01761AD15F}1.0.0.01WIX_UPGRADE_DETECTED{A416A558-D7C0-4F24-8B1E-2D01761AD15F}1.0.0.02WIX_DOWNGRADE_DETECTED
InstallExecuteSequenceRemoveExistingProducts1401InstallValidate0
3.11.0.1528C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.msiC:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\SetupProject.wixprojC:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.wixpdb
*5ProductFeature20ProductFeature1AdvertisingProfitControl.exe10ProductFeature1ApplicationShortcut10
ProductComponents
AdvertsingProfitControl.exeINSTALLFOLDER1C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\AdvertsingProfitControl\bin\Debug\AdvertsingProfitControl.exe-110
ProductFeatureFeatureProductComponentsComponentGroupProductFeatureFeatureApplicationShortcutComponent*ProductProductFeatureFeatureProductComponentsComponentGroupAdvertisingProfitControl.exeComponent
1
#cab{0}.cab2000
PropertyManufacturerPropertyProductCodePropertyProductLanguagePropertyProductNamePropertyProductVersionPropertyUpgradeCodeWixComponentGroupProductComponentsComponentApplicationShortcutDirectoryINSTALLFOLDERMedia1DirectoryApplicationProgramsFolderDirectoryApplicationProgramsFolder
\ No newline at end of file diff --git a/SetupProject/obj/Debug/Product.wixobj b/SetupProject/obj/Debug/Product.wixobj deleted file mode 100644 index 90e8d1a..0000000 --- a/SetupProject/obj/Debug/Product.wixobj +++ /dev/null @@ -1 +0,0 @@ -
112522Installation Database3SetupProject4Garritt McCune5Installer6This installer database contains the logic and data required to install SetupProject.7Intel;10339*14200152192
ProductFeatureAdvertisingProfitControl210
NOT WIX_DOWNGRADE_DETECTEDA newer version of [ProductName] is already installed.
1
ALLUSERS1
{A416A558-D7C0-4F24-8B1E-2D01761AD15F}1.0.0.01WIX_UPGRADE_DETECTED{A416A558-D7C0-4F24-8B1E-2D01761AD15F}1.0.0.02WIX_DOWNGRADE_DETECTED
InstallExecuteSequenceRemoveExistingProductsInstallValidate0
ProductFeature1ProductComponents30ProductFeature1ApplicationShortcut10*5ProductFeature20
ProductFeatureFeatureProductComponentsComponentGroupProductFeatureFeatureApplicationShortcutComponent*ProductProductFeatureFeature
#cab{0}.cab2000
PropertyManufacturerPropertyProductCodePropertyProductLanguagePropertyProductNamePropertyProductVersionPropertyUpgradeCodeWixComponentGroupProductComponentsComponentApplicationShortcut
ManufacturerGarritt McCune
ProductCode*
ProductLanguage1033
ProductNameSetupProject
ProductVersion1.0.0.0
UpgradeCode{A416A558-D7C0-4F24-8B1E-2D01761AD15F}
INSTALLFOLDERProgramFilesFoldercream0jw|Advertising Profit ControlProgramFilesFolderTARGETDIR.ApplicationProgramsFolderProgramMenuFoldergehljqbi|Advertising Profit ControlProgramMenuFolderTARGETDIR.AppDataFolderLocalAppDataFolderAPCLocalAppDataFolderTARGETDIR.TARGETDIRSourceDir
ApplicationShortcut*ApplicationProgramsFolder4reg768CF79333DAE472F46E14E8D9D119FA
reg768CF79333DAE472F46E14E8D9D119FA1Software\Microsoft\AdvertsingProfitControlinstalled#1ApplicationShortcut
CleanUpShortCutApplicationShortcutApplicationProgramsFolder2
ApplicationStartMenuShortcutApplicationProgramsFolderqg7xgcex|Advertising Profit ControlApplicationShortcut[#AdvertsingProfitControl.exe]Profit Control Recording SoftwareAPPLICATIONROOTDIRECTORY
DirectoryApplicationProgramsFolderDirectoryApplicationProgramsFolder
AdvertisingProfitControl.exe*INSTALLFOLDER0AdvertsingProfitControl.exe
AdvertsingProfitControl.exeAdvertisingProfitControl.exejk2qbs2k.exe|AdvertsingProfitControl.exe0512
ProductComponents2AdvertisingProfitControl.exe10
ProductComponents
AdvertsingProfitControl.exeINSTALLFOLDER1C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\AdvertsingProfitControl\bin\Debug\AdvertsingProfitControl.exe-110
ProductComponentsComponentGroupAdvertisingProfitControl.exeComponent
DirectoryINSTALLFOLDERMedia1
\ No newline at end of file diff --git a/SetupProject/obj/Debug/SetupProject.wixproj.BindBuiltOutputsFileListnull.txt b/SetupProject/obj/Debug/SetupProject.wixproj.BindBuiltOutputsFileListnull.txt deleted file mode 100644 index 55627c1..0000000 --- a/SetupProject/obj/Debug/SetupProject.wixproj.BindBuiltOutputsFileListnull.txt +++ /dev/null @@ -1,2 +0,0 @@ -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.msi -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.wixpdb diff --git a/SetupProject/obj/Debug/SetupProject.wixproj.BindContentsFileListnull.txt b/SetupProject/obj/Debug/SetupProject.wixproj.BindContentsFileListnull.txt deleted file mode 100644 index 416d7dc..0000000 --- a/SetupProject/obj/Debug/SetupProject.wixproj.BindContentsFileListnull.txt +++ /dev/null @@ -1 +0,0 @@ -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\AdvertsingProfitControl\bin\Debug\AdvertsingProfitControl.exe diff --git a/SetupProject/obj/Debug/SetupProject.wixproj.BindOutputsFileListnull.txt b/SetupProject/obj/Debug/SetupProject.wixproj.BindOutputsFileListnull.txt deleted file mode 100644 index 55627c1..0000000 --- a/SetupProject/obj/Debug/SetupProject.wixproj.BindOutputsFileListnull.txt +++ /dev/null @@ -1,2 +0,0 @@ -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.msi -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.wixpdb diff --git a/SetupProject/obj/Debug/SetupProject.wixproj.FileList.txt b/SetupProject/obj/Debug/SetupProject.wixproj.FileList.txt deleted file mode 100644 index 38028e7..0000000 --- a/SetupProject/obj/Debug/SetupProject.wixproj.FileList.txt +++ /dev/null @@ -1,6 +0,0 @@ -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.msi -C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\SetupProject\bin\Debug\SetupProject.wixpdb -obj\Debug\Product.wixobj -obj\Debug\SetupProject.wixproj.BindContentsFileListnull.txt -obj\Debug\SetupProject.wixproj.BindOutputsFileListnull.txt -obj\Debug\SetupProject.wixproj.BindBuiltOutputsFileListnull.txt diff --git a/StringInputParseTester/App.config b/StringInputParseTester/App.config deleted file mode 100644 index 88fa402..0000000 --- a/StringInputParseTester/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/StringInputParseTester/Form1.Designer.cs b/StringInputParseTester/Form1.Designer.cs deleted file mode 100644 index e942dec..0000000 --- a/StringInputParseTester/Form1.Designer.cs +++ /dev/null @@ -1,107 +0,0 @@ -namespace StringInputParseTester -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - 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.inputTextBox = new System.Windows.Forms.TextBox(); - this.outputTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.richTextBoxOutput = new System.Windows.Forms.RichTextBox(); - this.SuspendLayout(); - // - // inputTextBox - // - this.inputTextBox.Location = new System.Drawing.Point(22, 79); - this.inputTextBox.Margin = new System.Windows.Forms.Padding(6); - this.inputTextBox.Name = "inputTextBox"; - this.inputTextBox.Size = new System.Drawing.Size(473, 29); - this.inputTextBox.TabIndex = 0; - // - // outputTextBox - // - this.outputTextBox.Location = new System.Drawing.Point(22, 220); - this.outputTextBox.Margin = new System.Windows.Forms.Padding(6); - this.outputTextBox.Name = "outputTextBox"; - this.outputTextBox.Size = new System.Drawing.Size(473, 29); - this.outputTextBox.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(22, 291); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(64, 25); - this.label1.TabIndex = 2; - this.label1.Text = "label1"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 448); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(64, 25); - this.label2.TabIndex = 3; - this.label2.Text = "label2"; - // - // richTextBoxOutput - // - this.richTextBoxOutput.Location = new System.Drawing.Point(22, 173); - this.richTextBoxOutput.Name = "richTextBoxOutput"; - this.richTextBoxOutput.Size = new System.Drawing.Size(473, 49); - this.richTextBoxOutput.TabIndex = 4; - this.richTextBoxOutput.Text = ""; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(521, 482); - this.Controls.Add(this.richTextBoxOutput); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.outputTextBox); - this.Controls.Add(this.inputTextBox); - this.Margin = new System.Windows.Forms.Padding(6); - this.Name = "Form1"; - this.Text = "Form1"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox inputTextBox; - private System.Windows.Forms.TextBox outputTextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.RichTextBox richTextBoxOutput; - } -} - diff --git a/StringInputParseTester/Form1.cs b/StringInputParseTester/Form1.cs deleted file mode 100644 index 6e367ab..0000000 --- a/StringInputParseTester/Form1.cs +++ /dev/null @@ -1,339 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace StringInputParseTester -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - inputTextBox.Leave += ExecuteParserCode; - } - - private string CapitalizeFirstLetter(string word) - { - if (string.IsNullOrEmpty(word)) return string.Empty; - return word.First().ToString().ToUpperInvariant() + string.Join("", word.Skip(1)); - } - - private void ExecuteParserCode(object sender, EventArgs e) - { - var adItemText = inputTextBox.Text.Trim(); - //var splitInput = inputTextBox.Text.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); - var isInsideBrackets = false; - var isPreviousCharWhiteSpace = false; - //preserveAcronyms - var preserveAcronyms = true; - var cleanedInputString = ""; - var lastnumberStartingIndex = -1; - //Create an array of brackets to test for, and either balance out or simply ignore. - char[] openBrackets = {'(', '<', '{', '['}; - char[] closedBrackets = {')', '>', '}', ']'}; - for (var currentCharacter = 0; currentCharacter < adItemText.Length; currentCharacter++) - { - //Capitalize the first character in the string and move to the next character. - if (currentCharacter == 0) - { - cleanedInputString += char.ToUpperInvariant(adItemText[0]); - continue; - } - //IF the current character is a whitespace character, mark it as such, add to the temporary string, and move on to the next. - if (char.IsWhiteSpace(adItemText[currentCharacter])) - { - //Check for more then one space in a row. - if (isPreviousCharWhiteSpace) - { - //If more then one space is found to be in a row, then ignore it and move onto the next character. - continue; - } - //IF the current character is whitespace, then mark it and move onto the next loop. - isPreviousCharWhiteSpace = true; - cleanedInputString += adItemText[currentCharacter]; - continue; - } - //IF the current character is an open bracket then mark it so we're inside brackets and move to the next character. - if (openBrackets.Contains(adItemText[currentCharacter])) - { - if (isInsideBrackets) - { - //If we are already inside of brackets then don't add anymore to the string just continue. - continue; - } - isInsideBrackets = true; - //Just gonna force parenthesis for now. - cleanedInputString += '('; - continue; - } - //IF the current character is a closing bracket then mark it as such and move to the next character (if any). - if (closedBrackets.Contains(adItemText[currentCharacter])) - { - //IF we're not inside brackets then there is an imbalance so discard this parenthesis. - if (!isInsideBrackets) - { - continue; - } - //Just gonna force parenthesis for now. - cleanedInputString += ')'; - lastnumberStartingIndex = -1; //reset - //Clear the current working word. - isInsideBrackets = false; - continue; - } - //IF the current character is not a number and the previous character is a white space character - //then capitalize the current character and add it to the string. - if (!char.IsNumber(adItemText[currentCharacter]) && isPreviousCharWhiteSpace) - { - //Check to see if the character before the whitespace is a number. - if (char.IsNumber(cleanedInputString[cleanedInputString.Length - 2])) - { - var abbreviations = new List(); - var words = new List(); - BuildAbbreviationsAndWordsLists(adItemText, currentCharacter, out abbreviations, out words); - //Remove the last space if there are any abbreviations or words found. - if (abbreviations.Count > 0 || words.Count > 0) - { - cleanedInputString = cleanedInputString.Remove(cleanedInputString.Length - 1, 1); - } - //Begin checking to see how to place these items back into the final string. - if (abbreviations.Count >= 1 && words.Count == 0) - { - if (!isInsideBrackets) - { - cleanedInputString += abbreviations[0] + ")"; - if (lastnumberStartingIndex != -1) - { - cleanedInputString = cleanedInputString.Insert(lastnumberStartingIndex, "("); - } - } - else - { - cleanedInputString += abbreviations[0] + ")"; - } - break; - } - if (abbreviations.Count >= 1 && words.Count == 1) - { - cleanedInputString += abbreviations[0] + " " + words[0]; - //Clear all braces since this format doesn't allow for braces in this set up. - cleanedInputString = cleanedInputString.Replace("(", ""); - break; - } - if (abbreviations.Count >= 0 && words.Count >= 1) - { - if (abbreviations.Count != 0) - { - cleanedInputString += abbreviations[0]; - } - cleanedInputString = words.Aggregate(cleanedInputString, (current, word) => current + (" " + word)); - //Clear all braces since this format doesn't allow for braces in this set up. - cleanedInputString = cleanedInputString.Replace("(", ""); - break; - } - } - //Check to see the length of the string and determine if the word with the number needs to be capitalized. - cleanedInputString += char.ToUpperInvariant(adItemText[currentCharacter]); - } - //However, if the current character is not a number but the previous character is NOT a white space character - //then run a few checks before adding it to the string. - else if (!char.IsNumber(adItemText[currentCharacter]) && char.IsLetter(adItemText[currentCharacter])) - { - //IF the previous character is a number... - if (char.IsNumber(cleanedInputString[cleanedInputString.Length - 1])) - { - //Check to see the length of the string and determine if the word with the number needs to be capitalized. - var abbreviations = new List(); - var words = new List(); - BuildAbbreviationsAndWordsLists(adItemText, currentCharacter, out abbreviations, out words); - //Check to see if braces are necessary for the format we're going for. - if (abbreviations.Count >= 1 && words.Count == 0) - { - if (!isInsideBrackets) - { - cleanedInputString += abbreviations[0] + ")"; - if (lastnumberStartingIndex != -1) - { - cleanedInputString = cleanedInputString.Insert(lastnumberStartingIndex, "("); - } - } - else - { - cleanedInputString += abbreviations[0] + ")"; - } - break; - } - if (abbreviations.Count >= 1 && words.Count == 1) - { - cleanedInputString += abbreviations[0] + " " + words[0]; - //Clear all braces since this format doesn't allow for braces in this set up. - cleanedInputString = cleanedInputString.Replace("(", ""); - break; - } - if (abbreviations.Count >= 0 && words.Count >= 1) - { - if (abbreviations.Count != 0) - { - cleanedInputString += abbreviations[0]; - } - cleanedInputString = words.Aggregate(cleanedInputString, (current, word) => current + (" " + word)); - //Clear all braces since this format doesn't allow for braces in this set up. - cleanedInputString = cleanedInputString.Replace("(", ""); - break; - } - } - else if (char.IsLetter(adItemText[currentCharacter - 1])) - { - cleanedInputString += char.ToLowerInvariant(adItemText[currentCharacter]); - } - } - //IF a number is found, and we're not inside brackets, check to see if there is an opening parenthesis and if there aren't create one. - if (char.IsNumber(adItemText[currentCharacter])) - { - - cleanedInputString += adItemText[currentCharacter]; - if (lastnumberStartingIndex == -1) - { - lastnumberStartingIndex = cleanedInputString.Length - 1; //This is index based. - } - } - //Check for any allowed punctuation. - if (adItemText[currentCharacter] == '\'') - { - cleanedInputString += adItemText[currentCharacter]; - } - //Check if the previous character is an "'". - else if (cleanedInputString[cleanedInputString.Length - 1] == '\'') - { - cleanedInputString += adItemText[currentCharacter]; - } - //Since whitespace booleans are handled above, set the boolean for white spaces false. - //IF we've made it this far that means the current character is not a white space character. - isPreviousCharWhiteSpace = false; - //IF we're at the end of the string and we're inside brackets then balance out the open bracket. - if ((currentCharacter + 1) == adItemText.Length && isInsideBrackets) - { - cleanedInputString += ')'; - } - } - outputTextBox.Text = cleanedInputString; - } - - /// - /// Determines whether or not a string is an abbreviation or a word. - /// A word is defined as being at least three (3) characters long and having - /// at least one (1) vowel. Where as an abbreviation is defined as less then - /// three (3) characters long or being exactly three characters long but having - /// zero (0) vowels. - /// - /// The string to determine whether or not its a word. - /// - private bool IsWord(string text) - { - if (string.IsNullOrEmpty(text)) return false; - var isWord = true; - //Most abbreviations do not have vowels in them so check to see if the "abbreviation" - //isn't just a short word like "Box", as opposed to "lbs". - char[] vowels = {'a', 'e', 'i', 'o', 'u', 'y'}; - //Count the number of vowels the word has. - var vowelCount = text.Count(x => vowels.Contains(x)); - //IF the string is exactly three (3) characters long and has more then zero (0) vowels then it is considered a word. - if (text.Length == 3 && vowelCount == 0) - { - isWord = false; - } - else if (text.Length < 3) - { - isWord = false; - } - //Return the verdict. - return isWord; - } - - private void BuildAbbreviationsAndWordsLists(string adItemText, int startingIndex, out List abbreviations, - out List words, bool preserveAcronyms = true) - { - abbreviations = new List(); - words = new List(); - var currentWorkingString = ""; - //Starting at the next character, spin through and find all words or abbreviations that are separated by white space. - for (var i = startingIndex; i < adItemText.Length; i++) - { - //If the current character is a letter and if so add it to the current working string. - if (char.IsLetter(adItemText[i])) - { - currentWorkingString += adItemText[i]; - } - //Check for the current character being a white space, showing the end of a word or abbreviation. - else if (char.IsWhiteSpace(adItemText[i])) - { - //Block against null values from messing things up. - if (string.IsNullOrEmpty(currentWorkingString)) continue; - //The end of what ever word we were on has been reached, so check to see what the string is. - if (IsWord(currentWorkingString)) - { - words.Add(currentWorkingString); - } - else - { - abbreviations.Add(currentWorkingString); - } - //Clear the current working string to start on the next. - currentWorkingString = ""; - } - //Run a check to see if this is the last character in the string. - if ((i + 1) != adItemText.Length) continue; - //The end of whatever word we were on has been reached, so check to see what the string is. - if (IsWord(currentWorkingString)) - { - words.Add(currentWorkingString); - } - else - { - abbreviations.Add(currentWorkingString); - } - } - //Clean the cases of the abbreviations and words. - for (var i = 0; i < abbreviations.Count; i++) - { - //If preserve acronyms is set to true then just leave the cases of the abbreviations alone. - if (!preserveAcronyms) - { - abbreviations[i] = abbreviations[i].ToLowerInvariant(); - } - } - - for (var i = 0; i < words.Count; i++) - { - words[i] = words[i].ToLowerInvariant(); - words[i] = CapitalizeFirstLetter(words[i]); - } - } - - public string FormatShit(string inputString) - { - var finalString = ""; - var workingText = ""; - //The (char[])null avoids creating a new object in memory. - var splitInput = inputString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); - - foreach (var text in splitInput) - { - //Clear the working text to start building the next one to test. - workingText = ""; - foreach (var character in text) - { - - } - } - - return finalString; - } - } -} diff --git a/StringInputParseTester/Form1.resx b/StringInputParseTester/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/StringInputParseTester/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/StringInputParseTester/Program.cs b/StringInputParseTester/Program.cs deleted file mode 100644 index bb79a59..0000000 --- a/StringInputParseTester/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace StringInputParseTester -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} diff --git a/StringInputParseTester/Properties/AssemblyInfo.cs b/StringInputParseTester/Properties/AssemblyInfo.cs deleted file mode 100644 index 6175c42..0000000 --- a/StringInputParseTester/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("StringInputParseTester")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("StringInputParseTester")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2663661b-3d90-4d42-b05e-8038923a2891")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StringInputParseTester/Properties/Resources.Designer.cs b/StringInputParseTester/Properties/Resources.Designer.cs deleted file mode 100644 index fe87e08..0000000 --- a/StringInputParseTester/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace StringInputParseTester.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StringInputParseTester.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/StringInputParseTester/Properties/Resources.resx b/StringInputParseTester/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/StringInputParseTester/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/StringInputParseTester/Properties/Settings.Designer.cs b/StringInputParseTester/Properties/Settings.Designer.cs deleted file mode 100644 index 4fb8d0c..0000000 --- a/StringInputParseTester/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace StringInputParseTester.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/StringInputParseTester/Properties/Settings.settings b/StringInputParseTester/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/StringInputParseTester/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/StringInputParseTester/StringInputParseTester.csproj b/StringInputParseTester/StringInputParseTester.csproj deleted file mode 100644 index 983da40..0000000 --- a/StringInputParseTester/StringInputParseTester.csproj +++ /dev/null @@ -1,90 +0,0 @@ - - - - - Debug - AnyCPU - {2663661B-3D90-4D42-B05E-8038923A2891} - WinExe - Properties - StringInputParseTester - StringInputParseTester - v4.5.2 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - \ No newline at end of file diff --git a/StringInputParseTester/bin/Debug/StringInputParseTester.vshost.exe.config b/StringInputParseTester/bin/Debug/StringInputParseTester.vshost.exe.config deleted file mode 100644 index 88fa402..0000000 --- a/StringInputParseTester/bin/Debug/StringInputParseTester.vshost.exe.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/StringInputParseTester/bin/Debug/StringInputParseTester.vshost.exe.manifest b/StringInputParseTester/bin/Debug/StringInputParseTester.vshost.exe.manifest deleted file mode 100644 index 061c9ca..0000000 --- a/StringInputParseTester/bin/Debug/StringInputParseTester.vshost.exe.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/StringInputParseTester/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/StringInputParseTester/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs deleted file mode 100644 index e69de29..0000000 diff --git a/StringInputParseTester/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/StringInputParseTester/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs deleted file mode 100644 index e69de29..0000000 diff --git a/StringInputParseTester/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/StringInputParseTester/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs deleted file mode 100644 index e69de29..0000000 diff --git a/packages/HtmlRenderer.Core.1.5.0.6/HtmlRenderer.Core.1.5.0.6.nupkg b/packages/HtmlRenderer.Core.1.5.0.6/HtmlRenderer.Core.1.5.0.6.nupkg deleted file mode 100644 index a2c8ba4..0000000 Binary files a/packages/HtmlRenderer.Core.1.5.0.6/HtmlRenderer.Core.1.5.0.6.nupkg and /dev/null differ diff --git a/packages/HtmlRenderer.WinForms.1.5.0.6/HtmlRenderer.WinForms.1.5.0.6.nupkg b/packages/HtmlRenderer.WinForms.1.5.0.6/HtmlRenderer.WinForms.1.5.0.6.nupkg deleted file mode 100644 index d49dabe..0000000 Binary files a/packages/HtmlRenderer.WinForms.1.5.0.6/HtmlRenderer.WinForms.1.5.0.6.nupkg and /dev/null differ diff --git a/packages/HtmlRenderer.WinForms.1.5.0.6/readme.txt b/packages/HtmlRenderer.WinForms.1.5.0.6/readme.txt deleted file mode 100644 index 8c2fe70..0000000 --- a/packages/HtmlRenderer.WinForms.1.5.0.6/readme.txt +++ /dev/null @@ -1,50 +0,0 @@ - -********** Welcome to the HTML Renderer WinForms library! ***************************************** - -This library provides the rich formatting power of HTML in your WinForms .NET applications using -simple controls or static rendering code. -For more info see HTML Renderer on CodePlex: http://htmlrenderer.codeplex.com - -********** DEMO APPLICATION *********************************************************************** - -HTML Renderer Demo application showcases HTML Renderer capabilities, use it to explore and learn -on the library: http://htmlrenderer.codeplex.com/wikipage?title=Demo%20application - -********** FEEDBACK / RELEASE NOTES *************************************************************** - -If you have problems, wish to report a bug, or have a suggestion please start a thread on -HTML Renderer discussions page: http://htmlrenderer.codeplex.com/discussions - -For full release notes and all versions see: http://htmlrenderer.codeplex.com/releases - -********** QUICK START **************************************************************************** - -For more Quick Start see: https://htmlrenderer.codeplex.com/wikipage?title=Quick%20start - -*************************************************************************************************** -********** Quick Start: Use HTML panel control on WinForms form - -public partial class Form1 : Form -{ - public Form1() - { - InitializeComponent(); - - TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel htmlPanel = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); - htmlPanel.Text = "

Hello World

This is html rendered text

"; - htmlPanel.Dock = DockStyle.Fill; - Controls.Add(htmlPanel); - } -} - -*************************************************************************************************** -********** Quick Start: Create image from HTML snippet - -class Program -{ - private static void Main(string[] args) - { - Image image = TheArtOfDev.HtmlRenderer.WinForms.HtmlRender.RenderToImage("

Hello World

This is html rendered text

"); - image.Save("image.png", ImageFormat.Png); - } -}