Created the first version of HTML code for the front form. Changed to the Pechkin HTML to PDF library. Removed the string tester. Fixed a bug with the main form where the APC tables would not be sorted by row position.

This commit is contained in:
2017-05-02 23:38:00 -05:00
parent ba5808443b
commit 218d5be4d6
36 changed files with 560 additions and 1502 deletions
-10
View File
@@ -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
@@ -30,7 +30,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -82,6 +82,12 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>..\packages\Common.Logging.3.3.1\lib\net40\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>..\packages\Common.Logging.Core.3.3.1\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
@@ -90,13 +96,8 @@
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlRenderer, Version=1.5.0.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.Core.1.5.0.6\lib\net45\HtmlRenderer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlRenderer.WinForms, Version=1.5.0.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.WinForms.1.5.0.6\lib\net45\HtmlRenderer.WinForms.dll</HintPath>
<Private>True</Private>
<Reference Include="Pechkin, Version=0.5.8.1, Culture=neutral, processorArchitecture=x86">
<HintPath>..\packages\Pechkin.0.5.8.1\lib\net40\Pechkin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
@@ -282,7 +283,22 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="APCDatabase Template Script.sql" />
<Content Include="libeay32.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="libgcc_s_dw2-1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="mingwm10.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ssleay32.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Stretched Logo Collection.ico" />
<Content Include="wkhtmltox0.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+9 -1
View File
@@ -3,7 +3,7 @@
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AdvertsingProfitControl.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
@@ -30,4 +30,12 @@
</setting>
</AdvertsingProfitControl.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+26 -5
View File
@@ -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();
+13 -12
View File
@@ -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;
}
}
+8 -1
View File
@@ -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();
}
+11 -2
View File
@@ -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;
}
}
+70 -38
View File
@@ -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");
}
}
}
+396 -398
View File
@@ -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("<!DOCTYPE html>\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("<p>Store Name:<u> Allen's of Hastings</u></p>");
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); // <br><p style=\"font-size:10px\">(Mode: " + (willGenerateCommentRow ? "Generates Comment row" : "Compressed Format") + ")
writer.Write("<p><center><h2>Advertising Profit Control v " + Application.ProductVersion + "</h2></center></p>");
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("<p><span style=\"margin-left:102px\">Week Ending: <u> + dateString + </u></span><br><span style=\"margin-left:86px\">Department: <u>Produce</u></span></p>");
writer.RenderEndTag();//td
writer.RenderEndTag();//tr
writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin:0px; padding:0px");
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.Write("<b>Advertising Profit Control v" + Application.ProductVersion + "</b>");
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: <u>Allen's of Hastings</u>");
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: <u>" + date.ToString("d") + "</u><br>Department: <u>Produce</u>");
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("<p><span style=\"margin-right:280px\">Projection</span><span>Actual</span></p>");
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("<p style=\"margin-left:150px\">Profit Analysis</p>");
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<br>Price");
writer.RenderEndTag(); //th
writer.AddAttribute(HtmlTextWriterAttribute.Style, "background-color:#e9e9e9");
writer.RenderBeginTag(HtmlTextWriterTag.Th);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Total<br>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("$<br>Prof.<br>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<br>$<br>Prof.<br>Retn.");
writer.RenderEndTag(); //th
writer.RenderBeginTag(HtmlTextWriterTag.Th);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Beg.<br>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.<br>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<br>Price");
writer.RenderEndTag(); //th
writer.RenderBeginTag(HtmlTextWriterTag.Th);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Total<br>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("$<br>Prof.<br>Retn.");
writer.RenderEndTag(); //th
writer.RenderBeginTag(HtmlTextWriterTag.Th);
writer.RenderEndTag(); //th
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Total<br>$<br>Prof.<br>Retn.");
writer.RenderEndTag(); //th
//Department Sales
writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:159px; border-right:none");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("<center>Department<br>Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">1</span><span style=\"margin-left:60px\">"+ $"{departmentSales:C}" + "</span></p>");
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<br>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("<center>" +
// databaseReader.ReturnGroupNameFromGroupId(groupId.ToString(),
// databaseTracker.DatabaseConnectionString) + "</center>");
// 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(
// "<b>Comments:</b> " + 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("<center style=\"margin-top:1px\">Sales Produced By<br>Ad Items (A)</center><p><span style=\"font-size:9px; vertical-align:bottom\">2</span><span style=\"margin-left:60px\">" + $"{salesProducedByAdItems:C}" + "</span></p>");
// 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("<center style=\"margin-top:1px\">Remaining<br>Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">3</span><span style=\"margin-left:60px\">" + $"{remainingSales:C}" + " </span></p>");
// 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("<center style=\"margin-top:1px;\">Total $ Profit Return<br>From Ad Items (B)</center><p><span style=\"font-size:9px; vertical-align:bottom\">4</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromAdItems:C}" + " </span></p>");
// 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("<center style=\"margin-top:2px\">Total $ Profit Return<br>From Remaining Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">5</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromRemainingSales:C}" + "</span></p>");
// writer.RenderEndTag();
// break;
// case 12:
// writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, "2");
// writer.AddAttribute(HtmlTextWriterAttribute.Style, "border-right:none");
// writer.RenderBeginTag(HtmlTextWriterTag.Td);
// writer.Write("<center style=\"margin-top:1px\">Total $ Profit<br>Return</center><p><span style=\"font-size:9px; vertical-align:bottom\">6</span><span style=\"margin-left:60px\">" + $"{totalProfitReturn:C}" + "</span></p>");
// 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<br>Sales";
break;
case CostAnalysisCells.SalesProduced:
number = "2";
labelText = "Sales Produced<br>by<br>Ad Items (A)";
break;
case CostAnalysisCells.RemainingSales:
number = "3";
labelText = "Remaining<br>Sales<br>(Line 1 minus<br>Line 2)";
break;
case CostAnalysisCells.ProfitReturnFromAdItems:
number = "4";
labelText = "Total $ Profit<br>Return From Ad<br>Items (B)";
break;
case CostAnalysisCells.ProfitReturnFromRemainingSales:
number = "5";
labelText = "Total $ Profit Return<br>From Remaining Sales<br><br>Going-in Gross % x Remaining Sales";
break;
case CostAnalysisCells.TotalProfitReturn:
number = "6";
labelText = "Total $ Profit<br>Return<br><br>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<br>Total Profit Return By Dept.<br>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("<center style=\"margin-top:1px\">Sales Produced By<br>Ad Items (A)</center><p><span style=\"font-size:9px; vertical-align:bottom\">2</span><span style=\"margin-left:60px\">" + $"{salesProducedByAdItems:C}" + "</span></p>");
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("<center style=\"margin-top:1px\">Remaining<br>Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">3</span><span style=\"margin-left:60px\">" + $"{remainingSales:C}" + " </span></p>");
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("<center style=\"margin-top:1px;\">Total $ Profit Return<br>From Ad Items (B)</center><p><span style=\"font-size:9px; vertical-align:bottom\">4</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromAdItems:C}" + " </span></p>");
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("<center style=\"margin-top:2px\">Total $ Profit Return<br>From Remaining Sales</center><p><span style=\"font-size:9px; vertical-align:bottom\">5</span><span style=\"margin-left:60px\">" + $"{totalProfitReturnFromRemainingSales:C}" + "</span></p>");
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("<center style=\"margin-top:1px\">Total $ Profit<br>Return</center><p><span style=\"font-size:9px; vertical-align:bottom\">6</span><span style=\"margin-left:60px\">" + $"{totalProfitReturn:C}" + "</span></p>");
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("<br>");
writer.RenderEndTag();
cellCount++;
}
}
private enum CostAnalysisCells
{
DepartmentSales = 0,
SalesProduced = 1,
RemainingSales = 2,
ProfitReturnFromAdItems = 3,
ProfitReturnFromRemainingSales = 4,
TotalProfitReturn = 5,
CrossProfitInfoCell = 6,
Comments = 7
}
}
}
+3 -2
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Common.Logging" version="3.3.1" targetFramework="net45" />
<package id="Common.Logging.Core" version="3.3.1" targetFramework="net45" />
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="HtmlRenderer.Core" version="1.5.0.6" targetFramework="net45" />
<package id="HtmlRenderer.WinForms" version="1.5.0.6" targetFramework="net45" />
<package id="Pechkin" version="0.5.8.1" targetFramework="net45" />
</packages>
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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
@@ -1 +0,0 @@
C:\Users\Crypto\Documents\Source Control\AdvertisingProfitControl\AdvertsingProfitControl\bin\Debug\AdvertsingProfitControl.exe
@@ -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
@@ -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
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
-107
View File
@@ -1,107 +0,0 @@
namespace StringInputParseTester
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}
-339
View File
@@ -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<string>();
var words = new List<string>();
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<string>();
var words = new List<string>();
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;
}
/// <summary>
/// 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.
/// </summary>
/// <param name="text">The string to determine whether or not its a word.</param>
/// <returns></returns>
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<string> abbreviations,
out List<string> words, bool preserveAcronyms = true)
{
abbreviations = new List<string>();
words = new List<string>();
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;
}
}
}
-120
View File
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-22
View File
@@ -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
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
@@ -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")]
-71
View File
@@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StringInputParseTester.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-30
View File
@@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2663661B-3D90-4D42-B05E-8038923A2891}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StringInputParseTester</RootNamespace>
<AssemblyName>StringInputParseTester</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
-50
View File
@@ -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 = "<p><h1>Hello World</h1>This is html rendered text</p>";
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("<p><h1>Hello World</h1>This is html rendered text</p>");
image.Save("image.png", ImageFormat.Png);
}
}