Marked as 'AdvertsingProfitControl v 0.8.5' by its folder name. The 'Add Records' form has been finshed to at least include all the information the Advertising Profit Control sheet had.

This commit is contained in:
2021-01-28 19:54:35 -06:00
parent 58501fec36
commit 4c01f4ba46
38 changed files with 36559 additions and 715 deletions
Binary file not shown.
@@ -9,11 +9,28 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AdvertsingProfitControl</RootNamespace>
<AssemblyName>AdvertsingProfitControl</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\glmcc\Desktop\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -21,6 +38,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -30,48 +48,112 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<StartupObject>AdvertsingProfitControl.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>43F3577995641EA2A08A4951340360E3396F8F04</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>AdvertsingProfitControl_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>AdvertsingProfitControl_TemporaryKey.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Stretched Logo Collection.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AddRecord.cs" />
<Compile Include="apcDatabase.cs">
<DependentUpon>apcDatabase.xsd</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="apcDatabase.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>apcDatabase.xsd</DependentUpon>
</Compile>
<Compile Include="DatabaseTracker.cs" />
<Compile Include="DatabaseWriter.cs" />
<Compile Include="ExecuteCommand.cs" />
<Compile Include="frmAddRecord.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmAddRecord.Designer.cs">
<DependentUpon>frmAddRecord.cs</DependentUpon>
</Compile>
<Compile Include="frmAdSpecialRegister.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmAdSpecialRegister.Designer.cs">
<DependentUpon>frmAdSpecialRegister.cs</DependentUpon>
</Compile>
<Compile Include="frmDeleteRecord.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmDeleteRecord.Designer.cs">
<DependentUpon>frmDeleteRecord.cs</DependentUpon>
</Compile>
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.Designer.cs">
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="frmShrink.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmShrink.Designer.cs">
<DependentUpon>frmShrink.cs</DependentUpon>
</Compile>
<Compile Include="GlobalClasses.cs" />
<Compile Include="LogConsole.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LogConsole.Designer.cs">
<DependentUpon>LogConsole.cs</DependentUpon>
</Compile>
<Compile Include="RowParsing.cs" />
<Compile Include="HMergedCell.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RetrieveTables.cs" />
<Compile Include="WriteToDatabase.cs" />
<Compile Include="RetrieveFromDatabase.cs" />
<EmbeddedResource Include="frmAddRecord.resx">
<DependentUpon>frmAddRecord.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmAdSpecialRegister.resx">
<DependentUpon>frmAdSpecialRegister.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmDeleteRecord.resx">
<DependentUpon>frmDeleteRecord.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmShrink.resx">
<DependentUpon>frmShrink.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LogConsole.resx">
<DependentUpon>LogConsole.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -80,19 +162,11 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="apcDatabase.xsc">
<DependentUpon>apcDatabase.xsd</DependentUpon>
</None>
<None Include="apcDatabase.xsd">
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>apcDatabase.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>
<None Include="apcDatabase.xss">
<DependentUpon>apcDatabase.xsd</DependentUpon>
</None>
<None Include="AdvertsingProfitControl_TemporaryKey.pfx" />
<None Include="app.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -104,9 +178,24 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="apcDatabase.accdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="Stretched Logo Collection.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdvertsingProfitControl
{
class DataBaseReader
{
private string gConnectionString = "";
public DataBaseReader(string databaseLocation)
{
//Grab the location of the database.
gConnectionString = gDatabaseLocation;
}
}
}
@@ -0,0 +1,22 @@
using System.Configuration;
using System.IO;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
class DatabaseTracker
{
//private string _DatabaseProvider = "Provider=Microsoft.ACE.OLEDB.12.0;";
//private string _SecuritySettings = "Persist Security Info=False";
public DatabaseTracker()
{
}
public string DatabaseConnectionString
{
get { return "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=APCDatabase.accdb;Persist Security Info=False"; }
}
}
}
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
class ExecuteCommand
{
public DataGridViewRow ExecuteRepeatCommand(DataGridViewRow targetRow)
{
DataGridViewRow copiedRow = new DataGridViewRow();
foreach (DataGridViewCell cell in targetRow.Cells)
{
copiedRow.Cells.Add(cell);
}
return copiedRow;
}
public DataGridViewRow[] ExecuteRepeatCommand(DataGridViewRow[] targetRows)
{
DataGridViewRow[] copiedRows = new DataGridViewRow[targetRows.Length];
int i = 0;
foreach (DataGridViewRow row in targetRows)
{
foreach (DataGridViewCell cell in row.Cells)
{
copiedRows[i].Cells.Add(cell);
}
i++;
}
return copiedRows;
}
}
}
+50
View File
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
class GlobalClasses
{
public static void LogError(object sender, System.Threading.ThreadExceptionEventArgs e)
{
using (
StreamWriter file =
new StreamWriter(@"C:\Users\" + Environment.UserName + @"\AppData\Local\APC\" + DateTime.Now.ToString("MM-dd-yyyy") + ".log", true))
{
file.WriteLine(DateTime.Now + ": Unhandled Thread Exception:\n" + e.Exception.Message + "\n" + e.Exception.StackTrace);
MessageBox.Show("An unhandled thread exception has occurred. Advertising Profit Control will be forced to exit.",
"Fatal Error");
Application.Exit();
}
}
public static void LogError(object sender, UnhandledExceptionEventArgs e)
{
using (
StreamWriter file =
new StreamWriter(@"C:\Users\" + Environment.UserName + @"\AppData\Local\APC\" + DateTime.Now.ToString("MM-dd-yyyy") + ".log", true))
{
file.WriteLine(DateTime.Now + ": An unhandled exception occurred. \nException Object: " + e.ExceptionObject);
MessageBox.Show("And unknown error has occurred. Advertising Profit Control will be forced to exit.",
"Fatal Error");
Application.Exit();
}
}
public static void WriteToLog(string message)
{
using (
StreamWriter file =
new StreamWriter(@"C:\Users\" + Environment.UserName + @"\AppData\Local\APC\Information.log", true))
{
file.WriteLine(message);
}
}
}
}
+101
View File
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Drawing.Drawing2D;
namespace AdvertsingProfitControl
{
//http://forums.codeguru.com/showthread.php?415930-DataGridView-Merging-Cells
public class HMergedCell : DataGridViewTextBoxCell
{
private int m_nLeftColumn = 0;
private int m_nRightColumn = 0;
/// <summary>
/// Column Index of the left-most cell to be merged.
/// This cell controls the merged text.
/// </summary>
public int LeftColumn
{
get
{
return m_nLeftColumn;
}
set
{
m_nLeftColumn = value;
}
}
/// <summary>
/// Column Index of the right-most cell to be merged
/// </summary>
public int RightColumn
{
get
{
return m_nRightColumn;
}
set
{
m_nRightColumn = value;
}
}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
try
{
int mergeindex = ColumnIndex - m_nLeftColumn;
int i;
int nWidth;
int nWidthLeft;
string strText;
Pen pen = new Pen(Brushes.Black);
// Draw the background
graphics.FillRectangle(new SolidBrush(SystemColors.Control), cellBounds);
// Draw the separator for rows
graphics.DrawLine(new Pen(new SolidBrush(SystemColors.ControlDark)), cellBounds.Left, cellBounds.Bottom - 1, cellBounds.Right, cellBounds.Bottom - 1);
// Draw the right vertical line for the cell
if (ColumnIndex == m_nRightColumn)
graphics.DrawLine(new Pen(new SolidBrush(SystemColors.ControlDark)), cellBounds.Right - 1, cellBounds.Top, cellBounds.Right - 1, cellBounds.Bottom);
// Draw the text
RectangleF rectDest = RectangleF.Empty;
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
sf.Trimming = StringTrimming.EllipsisCharacter;
// Determine the total width of the merged cell
nWidth = 0;
for (i = m_nLeftColumn; i <= m_nRightColumn; i++)
nWidth += this.OwningRow.Cells[i].Size.Width;
// Determine the width before the current cell.
nWidthLeft = 0;
for (i = m_nLeftColumn; i < ColumnIndex; i++)
nWidthLeft += this.OwningRow.Cells[i].Size.Width;
// Retrieve the text to be displayed
strText = this.OwningRow.Cells[m_nLeftColumn].Value.ToString();
rectDest = new RectangleF(cellBounds.Left - nWidthLeft, cellBounds.Top, nWidth, cellBounds.Height);
graphics.DrawString(strText, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, rectDest, sf);
}
catch (Exception ex)
{
Trace.WriteLine(ex.ToString());
}
}
}// class
}
+163
View File
@@ -0,0 +1,163 @@
namespace AdvertsingProfitControl
{
partial class LogConsole
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LogConsole));
this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.mainMenu = new System.Windows.Forms.MenuStrip();
this.logMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.saveLogMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.clearLogMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.closeLogMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.sourcesMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.logListView = new System.Windows.Forms.ListView();
this.mainTableLayoutPanel.SuspendLayout();
this.mainMenu.SuspendLayout();
this.SuspendLayout();
//
// mainTableLayoutPanel
//
this.mainTableLayoutPanel.ColumnCount = 1;
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.mainTableLayoutPanel.Controls.Add(this.mainMenu, 0, 0);
this.mainTableLayoutPanel.Controls.Add(this.logListView, 0, 1);
this.mainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.mainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.mainTableLayoutPanel.Name = "mainTableLayoutPanel";
this.mainTableLayoutPanel.RowCount = 2;
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.mainTableLayoutPanel.Size = new System.Drawing.Size(876, 863);
this.mainTableLayoutPanel.TabIndex = 0;
//
// mainMenu
//
this.mainMenu.BackColor = System.Drawing.SystemColors.Control;
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.logMainMenu,
this.sourcesMainMenu});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Padding = new System.Windows.Forms.Padding(9, 3, 0, 3);
this.mainMenu.Size = new System.Drawing.Size(876, 35);
this.mainMenu.TabIndex = 0;
this.mainMenu.Text = "menuStrip1";
//
// logMainMenu
//
this.logMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveLogMainMenu,
this.clearLogMainMenu,
this.toolStripSeparator1,
this.closeLogMainMenu});
this.logMainMenu.Name = "logMainMenu";
this.logMainMenu.Size = new System.Drawing.Size(54, 29);
this.logMainMenu.Text = "&Log";
//
// saveLogMainMenu
//
this.saveLogMainMenu.Name = "saveLogMainMenu";
this.saveLogMainMenu.Size = new System.Drawing.Size(133, 30);
this.saveLogMainMenu.Text = "S&ave...";
//
// clearLogMainMenu
//
this.clearLogMainMenu.Name = "clearLogMainMenu";
this.clearLogMainMenu.Size = new System.Drawing.Size(133, 30);
this.clearLogMainMenu.Text = "C&lear";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(130, 6);
//
// closeLogMainMenu
//
this.closeLogMainMenu.Name = "closeLogMainMenu";
this.closeLogMainMenu.Size = new System.Drawing.Size(133, 30);
this.closeLogMainMenu.Text = "&Close";
//
// sourcesMainMenu
//
this.sourcesMainMenu.Name = "sourcesMainMenu";
this.sourcesMainMenu.Size = new System.Drawing.Size(86, 29);
this.sourcesMainMenu.Text = "&Sources";
//
// logListView
//
this.logListView.BackColor = System.Drawing.SystemColors.ControlLight;
this.logListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.logListView.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.logListView.FullRowSelect = true;
this.logListView.GridLines = true;
this.logListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.logListView.Location = new System.Drawing.Point(4, 43);
this.logListView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.logListView.Name = "logListView";
this.logListView.Size = new System.Drawing.Size(868, 815);
this.logListView.TabIndex = 1;
this.logListView.UseCompatibleStateImageBehavior = false;
this.logListView.View = System.Windows.Forms.View.Details;
//
// LogConsole
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(876, 863);
this.Controls.Add(this.mainTableLayoutPanel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.mainMenu;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.Name = "LogConsole";
this.Text = "Program Log Form";
this.mainTableLayoutPanel.ResumeLayout(false);
this.mainTableLayoutPanel.PerformLayout();
this.mainMenu.ResumeLayout(false);
this.mainMenu.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel mainTableLayoutPanel;
private System.Windows.Forms.MenuStrip mainMenu;
private System.Windows.Forms.ToolStripMenuItem logMainMenu;
private System.Windows.Forms.ToolStripMenuItem closeLogMainMenu;
private System.Windows.Forms.ListView logListView;
private System.Windows.Forms.ToolStripMenuItem sourcesMainMenu;
private System.Windows.Forms.ToolStripMenuItem saveLogMainMenu;
private System.Windows.Forms.ToolStripMenuItem clearLogMainMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
}
}
+137
View File
@@ -0,0 +1,137 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
public sealed partial class LogConsole : Form
{
//Source code: https://hashfactor.wordpress.com/2009/03/31/c-winforms-create-a-single-instance-form/
private static readonly LogConsole gLogConsoleInstance = new LogConsole();
private static bool gIsShown = false;
public LogConsole()
{
InitializeComponent();
logListView.Scrollable = true;
logListView.View = View.Details;
//Information for drawing header columns and sub-items in ListView:
//http://stackoverflow.com/questions/561798/how-do-i-align-text-for-a-single-subitem-in-a-listview-using-c
ColumnHeader header = new ColumnHeader();
header.Text = "Advertising Profit Control " + Application.ProductVersion + " Debug Console";
header.Name = "LogConsoleHeader";
header.Width = logListView.Width;
logListView.Columns.Add(header);
}
static LogConsole()
{
GetStaticInstance.FormClosing += new FormClosingEventHandler(LogConsole_FormClosing);
//Set the maximum and minimum size of the form.
GetStaticInstance.MaximumSize = new Size(900, 900);
GetStaticInstance.MinimumSize = new Size(400, 400);
}
public new void Show()
{
if (gIsShown)
{
base.Show();
}
else
{
base.Show();
gIsShown = true;
}
}
public new void Hide()
{
if (gIsShown)
{
base.Hide();
gIsShown = false;
}
}
public enum Level : int
{
Critical = 0,
Error = 1,
Warning = 2,
Info = 3,
Verbose = 4,
Debug = 5
};
public void WriteToLog(Level level, string message)
{
Color color;
int index;
switch (level)
{
case Level.Critical:
color = Color.White;
break;
case Level.Error:
color = Color.Red;
break;
case Level.Warning:
color = Color.Goldenrod;
break;
case Level.Info:
color = Color.Green;
break;
case Level.Verbose:
color = Color.Blue;
break;
default:
color = Color.Black;
break;
}
index = logListView.Items.Count;
try
{
message = String.Format("{0}: {1}", level, message);
if (level != Level.Info)
{
GlobalClasses.WriteToLog(DateTime.Now + ": " + message + Environment.NewLine);
}
logListView.Items.Add(message);
logListView.Items[index].ForeColor = color;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
if (level == Level.Critical)
{
logListView.Items[index].BackColor = Color.Red;
}
else
{
logListView.Items[index].BackColor = Color.WhiteSmoke;
}
}
private static void LogConsole_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
GetStaticInstance.Hide();
gIsShown = false;
}
public static LogConsole GetStaticInstance
{
get { return gLogConsoleInstance; }
}
public bool IsVisable
{
get { return gIsShown; }
}
}
}
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -1,5 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Forms;
namespace AdvertsingProfitControl
@@ -12,8 +12,15 @@ namespace AdvertsingProfitControl
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += GlobalClasses.LogError;
AppDomain.CurrentDomain.UnhandledException += GlobalClasses.LogError;
//LogConsole console = LogConsole.GetStaticInstance;
//var errorConsoleThread = new Thread(console.Show);
//errorConsoleThread.IsBackground = true;
//errorConsoleThread.Start();
Application.Run(new frmMain());
}
}
@@ -5,12 +5,12 @@ 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("AdvertsingProfitControl")]
[assembly: AssemblyTitle("Advertsing Profit Control")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdvertsingProfitControl")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyProduct("Advertsing Profit Control")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 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")]
[assembly: AssemblyVersion("0.8.5.0")]
[assembly: AssemblyFileVersion("0.8.5.0")]
+18 -26
View File
@@ -1,17 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// 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 AdvertsingProfitControl.Properties
{
namespace AdvertsingProfitControl.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -22,48 +22,40 @@ namespace AdvertsingProfitControl.Properties
[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
{
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()
{
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))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AdvertsingProfitControl.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
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
+1 -45
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -22,49 +22,5 @@ namespace AdvertsingProfitControl.Properties {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\apc.accdb;Persist S" +
"ecurity Info=True")]
public string apcConnectionString {
get {
return ((string)(this["apcConnectionString"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\apc.accdb;Persist S" +
"ecurity Info=True")]
public string apc___CopyConnectionString {
get {
return ((string)(this["apc___CopyConnectionString"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\apcDatabase.accdb;P" +
"ersist Security Info=True")]
public string apc___CopyConnectionString1 {
get {
return ((string)(this["apc___CopyConnectionString1"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\apcDatabase.accdb;P" +
"ersist Security Info=True")]
public string apc___CopyConnectionString2 {
get {
return ((string)(this["apc___CopyConnectionString2"]));
}
}
}
}
@@ -1,38 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="AdvertsingProfitControl.Properties" GeneratedClassName="Settings">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles />
<Settings>
<Setting Name="apcConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apc.accdb;Persist Security Info=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.OleDb&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apc.accdb;Persist Security Info=True</Value>
</Setting>
<Setting Name="apc___CopyConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apc.accdb;Persist Security Info=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.OleDb&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apc.accdb;Persist Security Info=True</Value>
</Setting>
<Setting Name="apc___CopyConnectionString1" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apcDatabase.accdb;Persist Security Info=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.OleDb&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apcDatabase.accdb;Persist Security Info=True</Value>
</Setting>
<Setting Name="apc___CopyConnectionString2" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apcDatabase.accdb;Persist Security Info=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.OleDb&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apcDatabase.accdb;Persist Security Info=True</Value>
</Setting>
</Settings>
<Settings />
</SettingsFile>
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Windows will automatically select the most compatible environment.-->
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
</application>
</compatibility>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!-- <dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>-->
</asmv1:assembly>
@@ -0,0 +1,593 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
/// <summary>
/// Deprecated!
/// </summary>
class RetrieveFromDatabase
{
DatabaseTracker gDatabaseLocation = new DatabaseTracker();
LogConsole console = LogConsole.GetStaticInstance;
private string gConnectionString;
public RetrieveFromDatabase()
{
//First thing, get the connection string from the DatabaseTracker.
gConnectionString = gDatabaseLocation.DatabaseConnectionString;
}
private DataTable ExecuteQuery(OleDbCommand sqlCommand)
{
DataTable table = new DataTable();
try
{
sqlCommand.Connection.Open();
OleDbDataAdapter a = new OleDbDataAdapter(sqlCommand);
a.Fill(table);
}
catch (Exception e)
{
console.WriteToLog(LogConsole.Level.Error, "Error attempting to retrieve database from the database.");
console.WriteToLog(LogConsole.Level.Debug, "Retrieval error: " + e.Message);
}
finally
{
sqlCommand.Connection.Close();
}
return table;
}
public string RetrieveMostRecentDateId()
{
string dateID = "";
string selectString = "SELECT WeekEnding.ID FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = (SELECT MAX(WeekEnding.EndOfWeekDate) FROM WeekEnding)";
DataTable table = new DataTable();
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Connection = connection;
connection.Open();
var reader = command.ExecuteReader();
while (reader != null && reader.Read())
{
dateID = reader[0].ToString();
}
connection.Close();
return dateID;
}
public string RetrieveAdItemId(string adItem)
{
string ID = "-1";
DataTable table = new DataTable();
string selectString = "SELECT AdItem.ID FROM AdItem WHERE AdItem.AdItem = @ID";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.AddWithValue("@ID", adItem);
table = ExecuteQuery(command);
if (table.Rows[0][0].ToString() != "")
{
ID = table.Rows[0][0].ToString();
}
return ID;
}
public string RetrieveDateIdByDateString(string dateString)
{
string dateID = "-1";
DataTable table = new DataTable();
string selectString = "SELECT WeekEnding.ID FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = @dateString";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.AddWithValue("@dateString", dateString);
table = ExecuteQuery(command);
try
{
if (table.Rows[0][0].ToString() != "")
{
dateID = table.Rows[0][0].ToString();
}
}
catch (Exception e)
{
dateID = "-1";
}
return dateID;
}
public string RetrieveComments(string dateId)
{
string comments;
DataTable table = new DataTable();
string selectString = "SELECT Comment.Comment FROM Comment WHERE Comment.FK_DateID = @dateString";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.AddWithValue("@dateString", dateId);
table = ExecuteQuery(command);
if (table.Rows.Count == 0)
{
DateTime time = Convert.ToDateTime(RetrieveDateStringByID(dateId));
comments = "No comments to display for " + time.ToLongDateString() + ".";
}
else
{
comments = table.Rows[0][0].ToString();
}
return comments;
}
public string RetrieveDateStringByID(string dateID)
{
string dateString = "";
DataTable table = new DataTable();
string selectString = "SELECT WeekEnding.EndOfWeekDate FROM WeekEnding WHERE WeekEnding.ID = dateID ORDER BY EndOfWeekDate ASC";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.AddWithValue("dateID", dateID);
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
command.Connection = connection;
connection.Open();
adapter.Fill(table);
connection.Close();
table = ExecuteQuery(command);
dateString = table.Rows[0][0].ToString();
return dateString;
}
public string RetrieveGroupIDByString(string groupName)
{
string groupID = "";
string sqlCommand = "SELECT GroupCategory.ID FROM GroupCategory WHERE GroupCategory.GroupDescription = groupString";
var connection = new OleDbConnection(gConnectionString);
var command = new OleDbCommand(sqlCommand, connection);
command.Parameters.AddWithValue("groupString", groupName);
try
{
var reader = command.ExecuteReader();
while (reader != null && reader.Read())
{
groupID = reader[0].ToString();
}
}
catch (Exception e)
{
return "";
}
finally
{
connection.Close();
}
return groupID;
}
public List<string> ReturnGroupNameList()
{
string sqlCommand = "SELECT GroupCategory.GroupDescription FROM GroupCategory WHERE NOT GroupDescription = 'HeaderRow' AND NOT GroupDescription = 'MemberRow'";
var connection = new OleDbConnection(gConnectionString);
var command = new OleDbCommand(sqlCommand, connection);
List<string> groupNames = new List<string>();
try
{
connection.Open();
var reader = command.ExecuteReader();
while (reader != null && reader.Read())
{
groupNames.Add(reader[0].ToString());
}
}
catch (Exception e)
{
return groupNames;
}
finally
{
connection.Close();
}
return groupNames;
}
public AutoCompleteStringCollection GetAdItemsSuggestionList()
{
AutoCompleteStringCollection autoCompleteList = new AutoCompleteStringCollection();
var command = "SELECT AdItem.AdItem FROM AdItem ORDER BY AdItem.AdItem ASC";
DataTable table = new DataTable();
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand commandObject = new OleDbCommand(command, connection);
commandObject.Connection.Open();
OleDbDataAdapter a = new OleDbDataAdapter(commandObject);
a.Fill(table);
commandObject.Connection.Close();
int i = 0;
foreach (DataRow row in table.Rows)
{
if (row[0].ToString() != "")
{
autoCompleteList.Add(row[0].ToString());
}
i++;
}
return autoCompleteList;
}
public AutoCompleteStringCollection GetSupplierSuggestionList()
{
AutoCompleteStringCollection autoCompleteList = new AutoCompleteStringCollection();
string command = "SELECT SupplierName FROM Supplier ORDER BY SupplierName ASC";
DataTable table = new DataTable();
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand commandObject = new OleDbCommand(command, connection);
commandObject.Connection.Open();
OleDbDataAdapter a = new OleDbDataAdapter(commandObject);
a.Fill(table);
commandObject.Connection.Close();
int i = 0;
foreach (DataRow row in table.Rows)
{
if (row[0].ToString() != "")
{
autoCompleteList.Add(row[0].ToString());
}
i++;
}
return autoCompleteList;
}
public DataTable ReturnProjectionsTable(string dateID)
{
DataTable dataTable = new DataTable();
string sqlCommand = "SELECT AdItem.AdItem, APC.ProjectionSold, APC.ProjectionSalePrice, APC.ProjectionTotalSales, APC.ProjectionCost, APC.ProjectionProfitReturn, APC.ProjectionTotalProfitReturn, FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = DateID";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(sqlCommand, connection);
command.Parameters.Add(new OleDbParameter("DateID", dateID));
dataTable = ExecuteQuery(command);
return dataTable;
}
public DataTable ReturnActualSales(string dateID)
{
DataTable dataTable = new DataTable();
string selectString = "SELECT AdItem.AdItem, APC.ActualSold, APC.ActualSalePrice, APC.ActualTotalSales, APC.ActualCost, APC.ActualProfitReturn, APC.ActualTotalProfitReturn, FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = DateID";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.Add(new OleDbParameter("DateID", dateID));
dataTable = ExecuteQuery(command);
return dataTable;
}
public DataTable ReturnInventoryTable(string dateID)
{
DataTable dataTable = new DataTable();
string selectString = "SELECT AdItem.AdItem, APC.BeginingInventory, APC.Received, APC.TotalInventory, APC.EndingInventory, FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = DateID";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.Add(new OleDbParameter("DateID", dateID));
dataTable = ExecuteQuery(command);
return dataTable;
}
public DataTable ReturnGroupIDTable(string dateID)
{
DataTable dataTable = new DataTable();
string[] groupNameCollection;
string selectString = "SELECT APC.FK_GroupID FROM APC WHERE FK_DateID = DateID";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.Add(new OleDbParameter("DateID", dateID));
try
{
}
catch (Exception e)
{
}
finally
{
connection.Close();
}
return dataTable;
}
public string ReturnGroupNameFromGroupId(string id)
{
string name = "";
string selectString = "SELECT GroupDescription FROM GroupCategory WHERE ID = ?";
OleDbConnection connection = new OleDbConnection(gConnectionString);
OleDbCommand command = new OleDbCommand(selectString, connection);
command.Parameters.AddWithValue("GroupID", id);
try
{
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
while (reader != null && reader.Read())
{
name = reader[0].ToString();
}
}
catch (Exception e)
{
}
finally
{
connection.Close();
}
return name;
}
public DataTable ReturnInvoiceTable(string dateID)
{
DataTable dataTable = new DataTable();
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.CommandText = "SELECT FK_Supplier, InvoiceNumber, InvoiceDate, InvoiceNetAmountAtCost, InvoiceNetAmount, InvoiceNote FROM Invoice WHERE FK_DateID = ?";
OleDbConnection oleDbConnection = new OleDbConnection(gConnectionString);
oleDbCommand.Connection = oleDbConnection;
oleDbCommand.Parameters.AddWithValue("DateID", dateID);
try
{
OleDbDataAdapter adapater = new OleDbDataAdapter(oleDbCommand);
int index = 0;
oleDbCommand.Connection.Open();
adapater.Fill(dataTable);
string[] supplierNames = new string[dataTable.Rows.Count];
foreach (DataRow row in dataTable.Rows)
{
supplierNames[index] = RetrieveSupplierNameByID(row[0].ToString());
index++;
}
dataTable.Columns.RemoveAt(0);
dataTable.Columns.Add("SupplierName");
dataTable.Columns[5].SetOrdinal(0);
dataTable.Columns[0].DataType = typeof (string);
index = 0;
foreach (string name in supplierNames)
{
dataTable.Rows[index][0] = name;
index++;
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
finally
{
oleDbCommand.Connection.Close();
}
return dataTable;
}
/// <summary>
/// Infrastructure
/// </summary>
/// <param name="supplierID"></param>
/// <returns></returns>
private string RetrieveSupplierNameByID(string supplierID)
{
string supplierName = "";
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.CommandText = "SELECT SupplierName FROM Supplier WHERE ID = ?";
oleDbCommand.Parameters.AddWithValue("ID", supplierID);
OleDbConnection oleDbConnection = new OleDbConnection(gConnectionString);
oleDbCommand.Connection = oleDbConnection;
oleDbCommand.Connection.Open();
OleDbDataReader reader = oleDbCommand.ExecuteReader();
while (reader != null && reader.Read())
{
supplierName = reader[0].ToString();
}
oleDbConnection.Close();
return supplierName;
}
public DataTable ReturnWeeklySalesFromDateID(string dateID)
{
DataTable dataTable = new DataTable();
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.CommandText = "SELECT Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, TotalSales FROM WeeklySales WHERE FK_DateID = ?";
oleDbCommand.Parameters.AddWithValue("dateID", dateID);
OleDbConnection connection = new OleDbConnection(gConnectionString);
oleDbCommand.Connection = connection;
OleDbDataAdapter a = new OleDbDataAdapter(oleDbCommand);
try
{
oleDbCommand.Connection.Open();
a.Fill(dataTable);
}
catch (Exception e)
{
console.WriteToLog(LogConsole.Level.Error, e.Message);
}
finally
{
oleDbCommand.Connection.Close();
}
return dataTable;
}
public DataTable ReturnWeekEndingTable()
{
var weekendingDatesTeable = new DataTable();
var oleDbCommand = new OleDbCommand {CommandText = "SELECT EndOfWeekDate FROM WeekEnding ORDER BY EndOfWeekDate ASC"};
var connection = new OleDbConnection(gConnectionString);
oleDbCommand.Connection = connection;
try
{
var a = new OleDbDataAdapter(oleDbCommand);
a.Fill(weekendingDatesTeable);
}
catch (Exception e)
{
}
finally
{
connection.Close();
}
return weekendingDatesTeable;
}
public List<string> ReturnUniqueYearsList()
{
var datesList = new List<string>();
var uniqueDateSelection = new OleDbCommand();
uniqueDateSelection.CommandText =
"SELECT Distinct YEAR(EndOfWeekDate) FROM WeekEnding";
var connection = new OleDbConnection(gConnectionString);
uniqueDateSelection.Connection = connection;
try
{
connection.Open();
var reader = uniqueDateSelection.ExecuteReader();
while (reader != null && reader.Read())
{
datesList.Add(reader[0].ToString());
}
}
catch (OleDbException e)
{
console.WriteToLog(LogConsole.Level.Error, "An error has occurred trying to retrieve the list of dates.");
console.WriteToLog(LogConsole.Level.Debug, e.Message);
}
finally
{
connection.Close();
}
return datesList;
}
/// <summary>
/// Returns a list of months available based on the year supplied.
/// </summary>
/// <param name="year"></param>
/// <returns></returns>
public List<string> ReturnUniqueMonthsList(string year)
{
var datesList = new List<string>();
var uniqueDateSelection = new OleDbCommand();
uniqueDateSelection.CommandText =
"SELECT Distinct MONTH(EndOfWeekDate) FROM WeekEnding WHERE YEAR(EndOfWeekDate) = YEAR(#" + year + "#)";
var connection = new OleDbConnection(gConnectionString);
uniqueDateSelection.Connection = connection;
try
{
connection.Open();
var reader = uniqueDateSelection.ExecuteReader();
while (reader != null && reader.Read())
{
datesList.Add(reader[0].ToString());
}
}
catch (OleDbException e)
{
console.WriteToLog(LogConsole.Level.Error, "An error has occurred trying to retrieve the list of dates.");
console.WriteToLog(LogConsole.Level.Debug, e.Message);
}
finally
{
connection.Close();
}
return datesList;
}
public DateTime ReturnMostRecentDateString()
{
DateTime dateString = new DateTime();
var oleDbCommand = new OleDbCommand();
oleDbCommand.CommandText = "SELECT WeekEnding.EndOfWeekDate FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = (SELECT MAX(WeekEnding.EndOfWeekDate) FROM WeekEnding)";
var connection = new OleDbConnection(gConnectionString);
oleDbCommand.Connection = connection;
try
{
connection.Open();
var reader = oleDbCommand.ExecuteReader();
while (reader != null && reader.Read())
{
dateString = (DateTime) reader[0];
}
}
catch (OleDbException e)
{
console.WriteToLog(LogConsole.Level.Error, "An error has occurred trying to retrieve the most recent date string.");
console.WriteToLog(LogConsole.Level.Debug, e.Message);
}
finally
{
connection.Close();
}
return dateString;
}
/// <summary>
/// Pattern Must Be: MM/*/YYYY
/// </summary>
/// <param name="dateString"></param>
/// <returns></returns>
public DataTable ReturnDateStringsLike(string dateString)
{
//Grabbing the year supplied and the last years dates:
//SELECT EndOfWeekDate FROM WeekEnding WHERE YEAR(DATEADD('yyyy', -1, #" + dateString + "#)) = YEAR(EndOFWeekDate) OR YEAR(#" + dateString + "#) = YEAR(EndOfWeekDate) ORDER BY EndOfWeekDate ASC
DataTable table = new DataTable();
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.CommandText = "SELECT EndOfWeekDate FROM WeekEnding WHERE YEAR(#" + dateString + "#) = YEAR(EndOFWeekDate) ORDER BY EndOfWeekDate ASC";
//oleDbCommand.Parameters.AddWithValue("datePattern", dateString);
OleDbConnection connection = new OleDbConnection(gConnectionString);
oleDbCommand.Connection = connection;
connection.Open();
try
{
OleDbDataAdapter a = new OleDbDataAdapter(oleDbCommand);
a.Fill(table);
}
catch (Exception e)
{
}
finally
{
connection.Close();
}
return table;
}
}
}
+113
View File
@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Linq;
namespace AdvertsingProfitControl
{
class RowParsing
{
public string CheckForGroupKeyWord(string cellContents)
{
string[] weekendAdIdentifiers = {"Weekend Ad", "Valentines", "Affiliated Weekend Ad", "Daily Coupons", "New Years Ad", "Christmas", "Mother's Day"};
var keyWord = "NoGroupFound";
var query = from adI in weekendAdIdentifiers
where adI.Equals(cellContents, StringComparison.InvariantCultureIgnoreCase)
select adI;
if (query.ToArray().Length > 0)
{
//Grab the first object in the array and return it.
keyWord = query.ToArray().First();
}
return keyWord;
}
/// <summary>
/// Determines a row's status.
/// </summary>
/// <param name="row">The row from a DataGridView object to be examined.</param>
/// <returns>The row's status, such as HeaderRow or NewRow.</returns>
public string GetRowAttribute(DataGridViewRow row)
{
//IF the supplied row is null, then simply declare it an IncompleteRow.
if (row == null)
{
return "IncompleteRow";
}
//IF the supplied row is a new row, by the definition of the DataGridViewRow class, then return NewRow.
if (row.IsNewRow)
{
return "NewRow";
}
var rowContents = new List<string>();
var rowAttribute = "MemberRow";
//Get the contents of the row that's being examined and add then to a List<string> array.
var i = 0;
foreach (DataGridViewCell cell in row.Cells)
{
//Strip all whitespace characters from the cell, this includes vertical tabs, newlines, and any number of spaces.
string cellContentsStripped = new string(cell.EditedFormattedValue.ToString().Where(c => !char.IsWhiteSpace(c)).ToArray());
//Now remove all zeros, including any decimal points as these values are meaningless.
cellContentsStripped = cellContentsStripped.Replace("0", "");
cellContentsStripped = cellContentsStripped.Replace(".", "");
if (cellContentsStripped != "")
{
rowContents.Add(cell.EditedFormattedValue.ToString());
}
//If the first cell contains nothing, than return as IncompleteRow.
else if (cellContentsStripped == "" && i == 0)
{
return "IncompleteRow";
}
i++;
}
//With all meaningless content removed, only actual data should be here. So if there are more then one items, than that means there are more then one
//cells with meaningful data in them. Which means that this row can be a header row with member rows under it.
if (rowContents.Count > 1)
{
rowAttribute = "HeaderRow";
}
else if (rowContents.Count == 1) //Check to see if this row is intended to be for a special ad.
{
var keyWord = "";
keyWord = CheckForGroupKeyWord(rowContents[0]);
//IF a keyword is found then declare this row an AdSpecialRow.
if (keyWord != "NoGroupFound")
{
return "AdSpecialRow";
}
}
return rowAttribute;
}
/// <summary>
/// Checks for the presents of a repeat command using the Regex engine.
/// If a repeat command is found it returns the line number the command
/// specifies to repeat.
/// </summary>
/// <param name="rowCommandField">The contents of Cell[0] in the row being parsed.</param>
/// <returns>Line number to be repeated, -1 if no command is found.</returns>
public int CheckForRepeatCommand(string rowCommandField)
{
var repeatCommandPattern = @"^repeat( line)?:? [0-9]"; //Reference sheet: https://msdn.microsoft.com/en-us/library/az24scfc.aspx
var rgx = new Regex(repeatCommandPattern, RegexOptions.IgnoreCase);
var lineNumber = -1;
if (rgx.IsMatch(rowCommandField))
{
//Parse the string and retrieve the line number
var numbers = Regex.Split(rowCommandField, @"\D+");
lineNumber = int.Parse(numbers[1]);
}
return lineNumber;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

+4 -16
View File
@@ -1,19 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="AdvertsingProfitControl.Properties.Settings.apcConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apc.accdb;Persist Security Info=True"
providerName="System.Data.OleDb" />
<add name="AdvertsingProfitControl.Properties.Settings.apc___CopyConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apc.accdb;Persist Security Info=True"
providerName="System.Data.OleDb" />
<add name="AdvertsingProfitControl.Properties.Settings.apc___CopyConnectionString1"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apcDatabase.accdb;Persist Security Info=True"
providerName="System.Data.OleDb" />
<add name="AdvertsingProfitControl.Properties.Settings.apc___CopyConnectionString2"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\apcDatabase.accdb;Persist Security Info=True"
providerName="System.Data.OleDb" />
</connectionStrings>
</configuration>
<connectionStrings/>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
</configuration>
+154
View File
@@ -0,0 +1,154 @@
namespace AdvertsingProfitControl
{
partial class frmAdSpecialRegister
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmAdSpecialRegister));
this.mainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.currentAdSpecialKeyWords = new System.Windows.Forms.Label();
this.adSpecialKeyWordsListBox = new System.Windows.Forms.ListBox();
this.registerAdSpecialPanel = new System.Windows.Forms.Panel();
this.enterNewKeyWordTextBox = new System.Windows.Forms.TextBox();
this.registerKeyWordButton = new System.Windows.Forms.Button();
this.enterKeyWordHeaderLabel = new System.Windows.Forms.Label();
this.mainLayoutPanel.SuspendLayout();
this.registerAdSpecialPanel.SuspendLayout();
this.SuspendLayout();
//
// mainLayoutPanel
//
this.mainLayoutPanel.ColumnCount = 2;
this.mainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.mainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.mainLayoutPanel.Controls.Add(this.currentAdSpecialKeyWords, 1, 0);
this.mainLayoutPanel.Controls.Add(this.adSpecialKeyWordsListBox, 1, 1);
this.mainLayoutPanel.Controls.Add(this.registerAdSpecialPanel, 0, 1);
this.mainLayoutPanel.Controls.Add(this.enterKeyWordHeaderLabel, 0, 0);
this.mainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.mainLayoutPanel.Name = "mainLayoutPanel";
this.mainLayoutPanel.RowCount = 3;
this.mainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.mainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.mainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.mainLayoutPanel.Size = new System.Drawing.Size(749, 563);
this.mainLayoutPanel.TabIndex = 0;
//
// currentAdSpecialKeyWords
//
this.currentAdSpecialKeyWords.AutoSize = true;
this.currentAdSpecialKeyWords.Dock = System.Windows.Forms.DockStyle.Fill;
this.currentAdSpecialKeyWords.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.currentAdSpecialKeyWords.Location = new System.Drawing.Point(377, 0);
this.currentAdSpecialKeyWords.Name = "currentAdSpecialKeyWords";
this.currentAdSpecialKeyWords.Size = new System.Drawing.Size(369, 35);
this.currentAdSpecialKeyWords.TabIndex = 0;
this.currentAdSpecialKeyWords.Text = "Registered Key Words:";
//
// adSpecialKeyWordsListBox
//
this.adSpecialKeyWordsListBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.adSpecialKeyWordsListBox.FormattingEnabled = true;
this.adSpecialKeyWordsListBox.ItemHeight = 20;
this.adSpecialKeyWordsListBox.Location = new System.Drawing.Point(377, 38);
this.adSpecialKeyWordsListBox.Name = "adSpecialKeyWordsListBox";
this.mainLayoutPanel.SetRowSpan(this.adSpecialKeyWordsListBox, 2);
this.adSpecialKeyWordsListBox.Size = new System.Drawing.Size(369, 522);
this.adSpecialKeyWordsListBox.Sorted = true;
this.adSpecialKeyWordsListBox.TabIndex = 1;
//
// registerAdSpecialPanel
//
this.registerAdSpecialPanel.Controls.Add(this.enterNewKeyWordTextBox);
this.registerAdSpecialPanel.Controls.Add(this.registerKeyWordButton);
this.registerAdSpecialPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.registerAdSpecialPanel.Location = new System.Drawing.Point(3, 38);
this.registerAdSpecialPanel.Name = "registerAdSpecialPanel";
this.registerAdSpecialPanel.Size = new System.Drawing.Size(368, 258);
this.registerAdSpecialPanel.TabIndex = 3;
//
// enterNewKeyWordTextBox
//
this.enterNewKeyWordTextBox.Location = new System.Drawing.Point(3, 14);
this.enterNewKeyWordTextBox.Name = "enterNewKeyWordTextBox";
this.enterNewKeyWordTextBox.Size = new System.Drawing.Size(257, 26);
this.enterNewKeyWordTextBox.TabIndex = 0;
//
// registerKeyWordButton
//
this.registerKeyWordButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.registerKeyWordButton.Location = new System.Drawing.Point(170, 211);
this.registerKeyWordButton.Name = "registerKeyWordButton";
this.registerKeyWordButton.Size = new System.Drawing.Size(195, 44);
this.registerKeyWordButton.TabIndex = 2;
this.registerKeyWordButton.Text = "Add new Key Word";
this.registerKeyWordButton.UseVisualStyleBackColor = true;
this.registerKeyWordButton.Click += new System.EventHandler(this.registerKeyWordButton_Click);
//
// enterKeyWordHeaderLabel
//
this.enterKeyWordHeaderLabel.AutoSize = true;
this.enterKeyWordHeaderLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.enterKeyWordHeaderLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.enterKeyWordHeaderLabel.Location = new System.Drawing.Point(3, 0);
this.enterKeyWordHeaderLabel.Name = "enterKeyWordHeaderLabel";
this.enterKeyWordHeaderLabel.Size = new System.Drawing.Size(368, 35);
this.enterKeyWordHeaderLabel.TabIndex = 4;
this.enterKeyWordHeaderLabel.Text = "Enter New Ad Special Key Word:";
//
// frmAdSpecialRegister
//
this.AcceptButton = this.registerKeyWordButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(749, 563);
this.Controls.Add(this.mainLayoutPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmAdSpecialRegister";
this.Text = "Register Ad Specials";
this.Load += new System.EventHandler(this.frmAdSpecialRegister_Load);
this.mainLayoutPanel.ResumeLayout(false);
this.mainLayoutPanel.PerformLayout();
this.registerAdSpecialPanel.ResumeLayout(false);
this.registerAdSpecialPanel.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel mainLayoutPanel;
private System.Windows.Forms.Label currentAdSpecialKeyWords;
private System.Windows.Forms.ListBox adSpecialKeyWordsListBox;
private System.Windows.Forms.Panel registerAdSpecialPanel;
private System.Windows.Forms.TextBox enterNewKeyWordTextBox;
private System.Windows.Forms.Button registerKeyWordButton;
private System.Windows.Forms.Label enterKeyWordHeaderLabel;
}
}
@@ -0,0 +1,63 @@
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 AdvertsingProfitControl
{
public partial class frmAdSpecialRegister : Form
{
public frmAdSpecialRegister()
{
InitializeComponent();
}
private void frmAdSpecialRegister_Load(object sender, EventArgs e)
{
var dbReader = new RetrieveFromDatabase();
var groupNameCollection = dbReader.ReturnGroupNameList();
foreach (var groupName in groupNameCollection)
{
adSpecialKeyWordsListBox.Items.Add(groupName);
}
}
private void registerKeyWordButton_Click(object sender, EventArgs e)
{
var dbReader = new RetrieveFromDatabase();
var tracker = new DatabaseTracker();
var dbWriter = new DatabaseWriter(tracker.DatabaseConnectionString);
int rowsEffected = 0;
if (enterNewKeyWordTextBox.Text == "") return;
rowsEffected = dbWriter.RedundantlessInsertIntoGroupCategory(enterNewKeyWordTextBox.Text);
if (rowsEffected == 1)
{
var groupNameCollection = dbReader.ReturnGroupNameList();
adSpecialKeyWordsListBox.Items.Clear();
foreach (var groupName in groupNameCollection)
{
adSpecialKeyWordsListBox.Items.Add(groupName);
}
enterNewKeyWordTextBox.Text = "";
enterNewKeyWordTextBox.Focus();
}
else
{
MessageBox.Show(
"An error has occurred trying to write " + enterNewKeyWordTextBox.Text + " to the database.",
"Unknown Write Error");
}
}
}
}
File diff suppressed because it is too large Load Diff
+333 -139
View File
@@ -28,183 +28,377 @@
/// </summary>
private void InitializeComponent()
{
this.addRecordMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.addRecordMainTabControl = new System.Windows.Forms.TabControl();
this.APCTabPage = new System.Windows.Forms.TabPage();
this.addRecordAPCMainDataGridView = new System.Windows.Forms.DataGridView();
this.WICTabPage = new System.Windows.Forms.TabPage();
this.addRecordWICMainDataGridView = new System.Windows.Forms.DataGridView();
this.addRecordMainMenu = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editAddRecordMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.addRecEditAddRecordMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.textBoxMenu = new System.Windows.Forms.ToolStripTextBox();
this.dateMaskedTextBox = new System.Windows.Forms.MaskedTextBox();
this.addRecordMainTableLayoutPanel.SuspendLayout();
this.addRecordMainTabControl.SuspendLayout();
this.APCTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.addRecordAPCMainDataGridView)).BeginInit();
this.WICTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.addRecordWICMainDataGridView)).BeginInit();
this.addRecordMainMenu.SuspendLayout();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmAddRecord));
this.mainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.addRecordTabControl = new System.Windows.Forms.TabControl();
this.projectionsTabPage = new System.Windows.Forms.TabPage();
this.projectionsDataGridView = new System.Windows.Forms.DataGridView();
this.inventoryActualSalesTabPage = new System.Windows.Forms.TabPage();
this.inventoryActualSalesDataGridView = new System.Windows.Forms.DataGridView();
this.suppliersTabPage = new System.Windows.Forms.TabPage();
this.suppliersDataGridView = new System.Windows.Forms.DataGridView();
this.weeklySalesTabPage = new System.Windows.Forms.TabPage();
this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView();
this.mainMenu = new System.Windows.Forms.MenuStrip();
this.fileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.clearFormFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.closeFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.commentsAndDateLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.dateGroupBox = new System.Windows.Forms.GroupBox();
this.weekEndingDateMaskedTextBox = new System.Windows.Forms.MaskedTextBox();
this.commentsGroupBox = new System.Windows.Forms.GroupBox();
this.commentsTextBox = new System.Windows.Forms.TextBox();
this.errorReportingLabel = new System.Windows.Forms.Label();
this.addRecordsButton = new System.Windows.Forms.Button();
this.mainLayoutPanel.SuspendLayout();
this.addRecordTabControl.SuspendLayout();
this.projectionsTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.projectionsDataGridView)).BeginInit();
this.inventoryActualSalesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.inventoryActualSalesDataGridView)).BeginInit();
this.suppliersTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).BeginInit();
this.weeklySalesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).BeginInit();
this.mainMenu.SuspendLayout();
this.commentsAndDateLayoutPanel.SuspendLayout();
this.dateGroupBox.SuspendLayout();
this.commentsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// addRecordMainTableLayoutPanel
// mainLayoutPanel
//
this.addRecordMainTableLayoutPanel.ColumnCount = 1;
this.addRecordMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.addRecordMainTableLayoutPanel.Controls.Add(this.addRecordMainTabControl, 0, 2);
this.addRecordMainTableLayoutPanel.Controls.Add(this.addRecordMainMenu, 0, 0);
this.addRecordMainTableLayoutPanel.Controls.Add(this.dateMaskedTextBox, 0, 1);
this.addRecordMainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.addRecordMainTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.addRecordMainTableLayoutPanel.Name = "addRecordMainTableLayoutPanel";
this.addRecordMainTableLayoutPanel.RowCount = 3;
this.addRecordMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.addRecordMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.addRecordMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.addRecordMainTableLayoutPanel.Size = new System.Drawing.Size(1084, 478);
this.addRecordMainTableLayoutPanel.TabIndex = 0;
this.mainLayoutPanel.ColumnCount = 1;
this.mainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.mainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.mainLayoutPanel.Controls.Add(this.addRecordTabControl, 0, 1);
this.mainLayoutPanel.Controls.Add(this.mainMenu, 0, 0);
this.mainLayoutPanel.Controls.Add(this.commentsAndDateLayoutPanel, 0, 2);
this.mainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.mainLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.mainLayoutPanel.Name = "mainLayoutPanel";
this.mainLayoutPanel.RowCount = 3;
this.mainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
this.mainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.mainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.mainLayoutPanel.Size = new System.Drawing.Size(1278, 744);
this.mainLayoutPanel.TabIndex = 0;
//
// addRecordMainTabControl
// addRecordTabControl
//
this.addRecordMainTabControl.Controls.Add(this.APCTabPage);
this.addRecordMainTabControl.Controls.Add(this.WICTabPage);
this.addRecordMainTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.addRecordMainTabControl.Location = new System.Drawing.Point(3, 53);
this.addRecordMainTabControl.Name = "addRecordMainTabControl";
this.addRecordMainTabControl.SelectedIndex = 0;
this.addRecordMainTabControl.Size = new System.Drawing.Size(1078, 422);
this.addRecordMainTabControl.TabIndex = 1;
this.addRecordTabControl.Controls.Add(this.projectionsTabPage);
this.addRecordTabControl.Controls.Add(this.inventoryActualSalesTabPage);
this.addRecordTabControl.Controls.Add(this.suppliersTabPage);
this.addRecordTabControl.Controls.Add(this.weeklySalesTabPage);
this.addRecordTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.addRecordTabControl.Location = new System.Drawing.Point(4, 43);
this.addRecordTabControl.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.addRecordTabControl.Name = "addRecordTabControl";
this.addRecordTabControl.SelectedIndex = 0;
this.addRecordTabControl.Size = new System.Drawing.Size(1270, 554);
this.addRecordTabControl.TabIndex = 1;
//
// APCTabPage
// projectionsTabPage
//
this.APCTabPage.Controls.Add(this.addRecordAPCMainDataGridView);
this.APCTabPage.Location = new System.Drawing.Point(4, 22);
this.APCTabPage.Name = "APCTabPage";
this.APCTabPage.Padding = new System.Windows.Forms.Padding(3);
this.APCTabPage.Size = new System.Drawing.Size(1070, 396);
this.APCTabPage.TabIndex = 0;
this.APCTabPage.Text = "Advertising Profit Control";
this.APCTabPage.UseVisualStyleBackColor = true;
this.projectionsTabPage.Controls.Add(this.projectionsDataGridView);
this.projectionsTabPage.Location = new System.Drawing.Point(4, 29);
this.projectionsTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionsTabPage.Name = "projectionsTabPage";
this.projectionsTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionsTabPage.Size = new System.Drawing.Size(1262, 521);
this.projectionsTabPage.TabIndex = 0;
this.projectionsTabPage.Text = "Projections";
this.projectionsTabPage.UseVisualStyleBackColor = true;
//
// addRecordAPCMainDataGridView
// projectionsDataGridView
//
this.addRecordAPCMainDataGridView.AllowUserToResizeRows = false;
this.addRecordAPCMainDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.addRecordAPCMainDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.addRecordAPCMainDataGridView.Location = new System.Drawing.Point(3, 3);
this.addRecordAPCMainDataGridView.Name = "addRecordAPCMainDataGridView";
this.addRecordAPCMainDataGridView.Size = new System.Drawing.Size(1064, 390);
this.addRecordAPCMainDataGridView.TabIndex = 1;
this.projectionsDataGridView.AllowUserToResizeRows = false;
this.projectionsDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.projectionsDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.projectionsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.projectionsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.projectionsDataGridView.Location = new System.Drawing.Point(4, 5);
this.projectionsDataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionsDataGridView.MultiSelect = false;
this.projectionsDataGridView.Name = "projectionsDataGridView";
this.projectionsDataGridView.Size = new System.Drawing.Size(1254, 511);
this.projectionsDataGridView.TabIndex = 0;
//
// WICTabPage
// inventoryActualSalesTabPage
//
this.WICTabPage.Controls.Add(this.addRecordWICMainDataGridView);
this.WICTabPage.Location = new System.Drawing.Point(4, 22);
this.WICTabPage.Name = "WICTabPage";
this.WICTabPage.Padding = new System.Windows.Forms.Padding(3);
this.WICTabPage.Size = new System.Drawing.Size(1070, 396);
this.WICTabPage.TabIndex = 1;
this.WICTabPage.Text = "Weekly Inventory Control";
this.WICTabPage.UseVisualStyleBackColor = true;
this.inventoryActualSalesTabPage.Controls.Add(this.inventoryActualSalesDataGridView);
this.inventoryActualSalesTabPage.Location = new System.Drawing.Point(4, 29);
this.inventoryActualSalesTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.inventoryActualSalesTabPage.Name = "inventoryActualSalesTabPage";
this.inventoryActualSalesTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.inventoryActualSalesTabPage.Size = new System.Drawing.Size(1610, 514);
this.inventoryActualSalesTabPage.TabIndex = 1;
this.inventoryActualSalesTabPage.Text = "Inventory / Actual Sales";
this.inventoryActualSalesTabPage.UseVisualStyleBackColor = true;
//
// addRecordWICMainDataGridView
// inventoryActualSalesDataGridView
//
this.addRecordWICMainDataGridView.AllowUserToResizeRows = false;
this.addRecordWICMainDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.addRecordWICMainDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.addRecordWICMainDataGridView.Location = new System.Drawing.Point(3, 3);
this.addRecordWICMainDataGridView.Name = "addRecordWICMainDataGridView";
this.addRecordWICMainDataGridView.Size = new System.Drawing.Size(1064, 390);
this.addRecordWICMainDataGridView.TabIndex = 2;
this.inventoryActualSalesDataGridView.AllowUserToResizeRows = false;
this.inventoryActualSalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.inventoryActualSalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.inventoryActualSalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.inventoryActualSalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.inventoryActualSalesDataGridView.Location = new System.Drawing.Point(4, 5);
this.inventoryActualSalesDataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.inventoryActualSalesDataGridView.MultiSelect = false;
this.inventoryActualSalesDataGridView.Name = "inventoryActualSalesDataGridView";
this.inventoryActualSalesDataGridView.Size = new System.Drawing.Size(1602, 504);
this.inventoryActualSalesDataGridView.TabIndex = 0;
//
// addRecordMainMenu
// suppliersTabPage
//
this.addRecordMainMenu.Dock = System.Windows.Forms.DockStyle.Fill;
this.addRecordMainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.editAddRecordMainMenu,
this.textBoxMenu});
this.addRecordMainMenu.Location = new System.Drawing.Point(0, 0);
this.addRecordMainMenu.Name = "addRecordMainMenu";
this.addRecordMainMenu.Size = new System.Drawing.Size(1084, 25);
this.addRecordMainMenu.TabIndex = 0;
this.addRecordMainMenu.Text = "menuStrip1";
this.suppliersTabPage.Controls.Add(this.suppliersDataGridView);
this.suppliersTabPage.Location = new System.Drawing.Point(4, 29);
this.suppliersTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersTabPage.Name = "suppliersTabPage";
this.suppliersTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersTabPage.Size = new System.Drawing.Size(1610, 514);
this.suppliersTabPage.TabIndex = 2;
this.suppliersTabPage.Text = "Suppliers";
this.suppliersTabPage.UseVisualStyleBackColor = true;
//
// fileToolStripMenuItem
// suppliersDataGridView
//
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 21);
this.fileToolStripMenuItem.Text = "&File";
this.suppliersDataGridView.AllowUserToResizeRows = false;
this.suppliersDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.suppliersDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.suppliersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.suppliersDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.suppliersDataGridView.Location = new System.Drawing.Point(4, 5);
this.suppliersDataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersDataGridView.MultiSelect = false;
this.suppliersDataGridView.Name = "suppliersDataGridView";
this.suppliersDataGridView.Size = new System.Drawing.Size(1602, 504);
this.suppliersDataGridView.TabIndex = 0;
//
// editAddRecordMainMenu
// weeklySalesTabPage
//
this.editAddRecordMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addRecEditAddRecordMainMenu});
this.editAddRecordMainMenu.Name = "editAddRecordMainMenu";
this.editAddRecordMainMenu.Size = new System.Drawing.Size(39, 21);
this.editAddRecordMainMenu.Text = "&Edit";
this.weeklySalesTabPage.Controls.Add(this.weeklySalesDataGridView);
this.weeklySalesTabPage.Location = new System.Drawing.Point(4, 29);
this.weeklySalesTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.weeklySalesTabPage.Name = "weeklySalesTabPage";
this.weeklySalesTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.weeklySalesTabPage.Size = new System.Drawing.Size(1610, 514);
this.weeklySalesTabPage.TabIndex = 3;
this.weeklySalesTabPage.Text = "Weekly Sales";
this.weeklySalesTabPage.UseVisualStyleBackColor = true;
//
// addRecEditAddRecordMainMenu
// weeklySalesDataGridView
//
this.addRecEditAddRecordMainMenu.Name = "addRecEditAddRecordMainMenu";
this.addRecEditAddRecordMainMenu.Size = new System.Drawing.Size(136, 22);
this.addRecEditAddRecordMainMenu.Text = "&Add Record";
this.addRecEditAddRecordMainMenu.Click += new System.EventHandler(this.addRecEditAddRecordMainMenu_Click);
this.weeklySalesDataGridView.AllowUserToAddRows = false;
this.weeklySalesDataGridView.AllowUserToDeleteRows = false;
this.weeklySalesDataGridView.AllowUserToResizeRows = false;
this.weeklySalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.weeklySalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.weeklySalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weeklySalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklySalesDataGridView.Location = new System.Drawing.Point(4, 5);
this.weeklySalesDataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.weeklySalesDataGridView.MultiSelect = false;
this.weeklySalesDataGridView.Name = "weeklySalesDataGridView";
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1602, 504);
this.weeklySalesDataGridView.TabIndex = 0;
//
// textBoxMenu
// mainMenu
//
this.textBoxMenu.Name = "textBoxMenu";
this.textBoxMenu.Size = new System.Drawing.Size(100, 21);
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMainMenu,
this.debugToolStripMenuItem});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Padding = new System.Windows.Forms.Padding(9, 3, 0, 3);
this.mainMenu.Size = new System.Drawing.Size(1278, 35);
this.mainMenu.TabIndex = 2;
this.mainMenu.Text = "menuStrip1";
//
// dateMaskedTextBox
// fileMainMenu
//
this.dateMaskedTextBox.Location = new System.Drawing.Point(3, 28);
this.dateMaskedTextBox.Mask = "00/00/0000";
this.dateMaskedTextBox.Name = "dateMaskedTextBox";
this.dateMaskedTextBox.Size = new System.Drawing.Size(64, 20);
this.dateMaskedTextBox.TabIndex = 1;
this.dateMaskedTextBox.ValidatingType = typeof(System.DateTime);
this.fileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clearFormFileMainMenu,
this.closeFileMainMenu});
this.fileMainMenu.Name = "fileMainMenu";
this.fileMainMenu.Size = new System.Drawing.Size(50, 29);
this.fileMainMenu.Text = "&File";
//
// clearFormFileMainMenu
//
this.clearFormFileMainMenu.Name = "clearFormFileMainMenu";
this.clearFormFileMainMenu.Size = new System.Drawing.Size(170, 30);
this.clearFormFileMainMenu.Text = "C&lear Form";
this.clearFormFileMainMenu.Click += new System.EventHandler(this.clearFormFileMainMenu_Click);
//
// closeFileMainMenu
//
this.closeFileMainMenu.Name = "closeFileMainMenu";
this.closeFileMainMenu.Size = new System.Drawing.Size(170, 30);
this.closeFileMainMenu.Text = "&Close";
this.closeFileMainMenu.Click += new System.EventHandler(this.closeFileMainMenu_Click);
//
// debugToolStripMenuItem
//
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
this.debugToolStripMenuItem.Size = new System.Drawing.Size(78, 29);
this.debugToolStripMenuItem.Text = "Debug";
//
// commentsAndDateLayoutPanel
//
this.commentsAndDateLayoutPanel.AutoSize = true;
this.commentsAndDateLayoutPanel.ColumnCount = 4;
this.commentsAndDateLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.commentsAndDateLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.commentsAndDateLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.commentsAndDateLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.commentsAndDateLayoutPanel.Controls.Add(this.dateGroupBox, 0, 0);
this.commentsAndDateLayoutPanel.Controls.Add(this.commentsGroupBox, 1, 0);
this.commentsAndDateLayoutPanel.Controls.Add(this.errorReportingLabel, 2, 0);
this.commentsAndDateLayoutPanel.Controls.Add(this.addRecordsButton, 3, 0);
this.commentsAndDateLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsAndDateLayoutPanel.Location = new System.Drawing.Point(4, 607);
this.commentsAndDateLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentsAndDateLayoutPanel.Name = "commentsAndDateLayoutPanel";
this.commentsAndDateLayoutPanel.RowCount = 1;
this.commentsAndDateLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.commentsAndDateLayoutPanel.Size = new System.Drawing.Size(1270, 132);
this.commentsAndDateLayoutPanel.TabIndex = 3;
//
// dateGroupBox
//
this.dateGroupBox.Controls.Add(this.weekEndingDateMaskedTextBox);
this.dateGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.dateGroupBox.Location = new System.Drawing.Point(4, 5);
this.dateGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.dateGroupBox.Name = "dateGroupBox";
this.dateGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.dateGroupBox.Size = new System.Drawing.Size(182, 122);
this.dateGroupBox.TabIndex = 0;
this.dateGroupBox.TabStop = false;
this.dateGroupBox.Text = "Week Ending Date";
//
// weekEndingDateMaskedTextBox
//
this.weekEndingDateMaskedTextBox.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.weekEndingDateMaskedTextBox.Location = new System.Drawing.Point(9, 29);
this.weekEndingDateMaskedTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.weekEndingDateMaskedTextBox.Mask = "00/00/0000";
this.weekEndingDateMaskedTextBox.Name = "weekEndingDateMaskedTextBox";
this.weekEndingDateMaskedTextBox.Size = new System.Drawing.Size(116, 35);
this.weekEndingDateMaskedTextBox.TabIndex = 0;
this.weekEndingDateMaskedTextBox.ValidatingType = typeof(System.DateTime);
//
// commentsGroupBox
//
this.commentsGroupBox.Controls.Add(this.commentsTextBox);
this.commentsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsGroupBox.Location = new System.Drawing.Point(194, 5);
this.commentsGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentsGroupBox.Name = "commentsGroupBox";
this.commentsGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentsGroupBox.Size = new System.Drawing.Size(436, 122);
this.commentsGroupBox.TabIndex = 1;
this.commentsGroupBox.TabStop = false;
this.commentsGroupBox.Text = "Comments";
//
// commentsTextBox
//
this.commentsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsTextBox.Location = new System.Drawing.Point(4, 24);
this.commentsTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentsTextBox.Multiline = true;
this.commentsTextBox.Name = "commentsTextBox";
this.commentsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.commentsTextBox.Size = new System.Drawing.Size(428, 93);
this.commentsTextBox.TabIndex = 0;
//
// errorReportingLabel
//
this.errorReportingLabel.AutoSize = true;
this.errorReportingLabel.Location = new System.Drawing.Point(638, 0);
this.errorReportingLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.errorReportingLabel.Name = "errorReportingLabel";
this.errorReportingLabel.Size = new System.Drawing.Size(0, 20);
this.errorReportingLabel.TabIndex = 2;
//
// addRecordsButton
//
this.addRecordsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.addRecordsButton.Location = new System.Drawing.Point(1146, 92);
this.addRecordsButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.addRecordsButton.Name = "addRecordsButton";
this.addRecordsButton.Size = new System.Drawing.Size(120, 35);
this.addRecordsButton.TabIndex = 3;
this.addRecordsButton.Text = "Add Records";
this.addRecordsButton.UseVisualStyleBackColor = true;
this.addRecordsButton.Click += new System.EventHandler(this.addRecordsButton_Click);
//
// frmAddRecord
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1084, 478);
this.Controls.Add(this.addRecordMainTableLayoutPanel);
this.MainMenuStrip = this.addRecordMainMenu;
this.ClientSize = new System.Drawing.Size(1278, 744);
this.Controls.Add(this.mainLayoutPanel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.mainMenu;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximumSize = new System.Drawing.Size(1300, 800);
this.MinimumSize = new System.Drawing.Size(1000, 500);
this.Name = "frmAddRecord";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Add Record Form";
this.Load += new System.EventHandler(this.frmAddRecord_Load);
this.addRecordMainTableLayoutPanel.ResumeLayout(false);
this.addRecordMainTableLayoutPanel.PerformLayout();
this.addRecordMainTabControl.ResumeLayout(false);
this.APCTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.addRecordAPCMainDataGridView)).EndInit();
this.WICTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.addRecordWICMainDataGridView)).EndInit();
this.addRecordMainMenu.ResumeLayout(false);
this.addRecordMainMenu.PerformLayout();
this.mainLayoutPanel.ResumeLayout(false);
this.mainLayoutPanel.PerformLayout();
this.addRecordTabControl.ResumeLayout(false);
this.projectionsTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.projectionsDataGridView)).EndInit();
this.inventoryActualSalesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.inventoryActualSalesDataGridView)).EndInit();
this.suppliersTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).EndInit();
this.weeklySalesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).EndInit();
this.mainMenu.ResumeLayout(false);
this.mainMenu.PerformLayout();
this.commentsAndDateLayoutPanel.ResumeLayout(false);
this.commentsAndDateLayoutPanel.PerformLayout();
this.dateGroupBox.ResumeLayout(false);
this.dateGroupBox.PerformLayout();
this.commentsGroupBox.ResumeLayout(false);
this.commentsGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel addRecordMainTableLayoutPanel;
private System.Windows.Forms.MenuStrip addRecordMainMenu;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editAddRecordMainMenu;
private System.Windows.Forms.ToolStripMenuItem addRecEditAddRecordMainMenu;
private System.Windows.Forms.TabControl addRecordMainTabControl;
private System.Windows.Forms.TabPage APCTabPage;
private System.Windows.Forms.DataGridView addRecordAPCMainDataGridView;
private System.Windows.Forms.TabPage WICTabPage;
private System.Windows.Forms.DataGridView addRecordWICMainDataGridView;
private System.Windows.Forms.MaskedTextBox dateMaskedTextBox;
private System.Windows.Forms.ToolStripTextBox textBoxMenu;
private System.Windows.Forms.TableLayoutPanel mainLayoutPanel;
private System.Windows.Forms.TabControl addRecordTabControl;
private System.Windows.Forms.TabPage projectionsTabPage;
private System.Windows.Forms.DataGridView projectionsDataGridView;
private System.Windows.Forms.TabPage inventoryActualSalesTabPage;
private System.Windows.Forms.DataGridView inventoryActualSalesDataGridView;
private System.Windows.Forms.TabPage suppliersTabPage;
private System.Windows.Forms.DataGridView suppliersDataGridView;
private System.Windows.Forms.MenuStrip mainMenu;
private System.Windows.Forms.ToolStripMenuItem fileMainMenu;
private System.Windows.Forms.ToolStripMenuItem closeFileMainMenu;
private System.Windows.Forms.TableLayoutPanel commentsAndDateLayoutPanel;
private System.Windows.Forms.GroupBox dateGroupBox;
private System.Windows.Forms.MaskedTextBox weekEndingDateMaskedTextBox;
private System.Windows.Forms.GroupBox commentsGroupBox;
private System.Windows.Forms.TextBox commentsTextBox;
private System.Windows.Forms.Label errorReportingLabel;
private System.Windows.Forms.TabPage weeklySalesTabPage;
private System.Windows.Forms.DataGridView weeklySalesDataGridView;
private System.Windows.Forms.Button addRecordsButton;
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem clearFormFileMainMenu;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+475
View File
@@ -0,0 +1,475 @@
namespace AdvertsingProfitControl
{
partial class frmDeleteRecord
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDeleteRecord));
this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.mainMenu = new System.Windows.Forms.MenuStrip();
this.fileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.exitFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.projectionsTabPage = new System.Windows.Forms.TabPage();
this.projectionsDataGridView = new System.Windows.Forms.DataGridView();
this.inventoryTabPage = new System.Windows.Forms.TabPage();
this.inventoryDataGridView = new System.Windows.Forms.DataGridView();
this.actualTabPage = new System.Windows.Forms.TabPage();
this.actualSalesDataGridView = new System.Windows.Forms.DataGridView();
this.suppliersTabPage = new System.Windows.Forms.TabPage();
this.suppliersDataGridView = new System.Windows.Forms.DataGridView();
this.weeklySalesTabPage = new System.Windows.Forms.TabPage();
this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView();
this.secondaryLayOutPanel = new System.Windows.Forms.TableLayoutPanel();
this.commmentsGroupBox = new System.Windows.Forms.GroupBox();
this.commentsTextBox = new System.Windows.Forms.TextBox();
this.datePickerGroupBox = new System.Windows.Forms.GroupBox();
this.DELETE = new System.Windows.Forms.Button();
this.informationLabel = new System.Windows.Forms.Label();
this.dateSelectorFormatLable = new System.Windows.Forms.Label();
this.yearComboBox = new System.Windows.Forms.ComboBox();
this.monthComboBox = new System.Windows.Forms.ComboBox();
this.dayComboBox = new System.Windows.Forms.ComboBox();
this.clearSelectedYearGroupBox = new System.Windows.Forms.GroupBox();
this.clearSelectedYearInfoLabel = new System.Windows.Forms.Label();
this.yearClearingWarningLabel = new System.Windows.Forms.Label();
this.mainTableLayoutPanel.SuspendLayout();
this.mainMenu.SuspendLayout();
this.mainTabControl.SuspendLayout();
this.projectionsTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.projectionsDataGridView)).BeginInit();
this.inventoryTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.inventoryDataGridView)).BeginInit();
this.actualTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.actualSalesDataGridView)).BeginInit();
this.suppliersTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).BeginInit();
this.weeklySalesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).BeginInit();
this.secondaryLayOutPanel.SuspendLayout();
this.commmentsGroupBox.SuspendLayout();
this.datePickerGroupBox.SuspendLayout();
this.clearSelectedYearGroupBox.SuspendLayout();
this.SuspendLayout();
//
// mainTableLayoutPanel
//
this.mainTableLayoutPanel.ColumnCount = 1;
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.mainTableLayoutPanel.Controls.Add(this.mainMenu, 0, 0);
this.mainTableLayoutPanel.Controls.Add(this.mainTabControl, 0, 1);
this.mainTableLayoutPanel.Controls.Add(this.secondaryLayOutPanel, 0, 2);
this.mainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.mainTableLayoutPanel.Name = "mainTableLayoutPanel";
this.mainTableLayoutPanel.RowCount = 3;
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.mainTableLayoutPanel.Size = new System.Drawing.Size(1278, 844);
this.mainTableLayoutPanel.TabIndex = 0;
//
// mainMenu
//
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMainMenu});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Size = new System.Drawing.Size(1278, 33);
this.mainMenu.TabIndex = 0;
this.mainMenu.Text = "menuStrip1";
//
// fileMainMenu
//
this.fileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitFileMainMenu});
this.fileMainMenu.Name = "fileMainMenu";
this.fileMainMenu.Size = new System.Drawing.Size(50, 29);
this.fileMainMenu.Text = "&File";
//
// exitFileMainMenu
//
this.exitFileMainMenu.Name = "exitFileMainMenu";
this.exitFileMainMenu.Size = new System.Drawing.Size(111, 30);
this.exitFileMainMenu.Text = "E&xit";
//
// mainTabControl
//
this.mainTabControl.Controls.Add(this.projectionsTabPage);
this.mainTabControl.Controls.Add(this.inventoryTabPage);
this.mainTabControl.Controls.Add(this.actualTabPage);
this.mainTabControl.Controls.Add(this.suppliersTabPage);
this.mainTabControl.Controls.Add(this.weeklySalesTabPage);
this.mainTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainTabControl.Location = new System.Drawing.Point(3, 38);
this.mainTabControl.Name = "mainTabControl";
this.mainTabControl.SelectedIndex = 0;
this.mainTabControl.Size = new System.Drawing.Size(1272, 519);
this.mainTabControl.TabIndex = 1;
//
// projectionsTabPage
//
this.projectionsTabPage.Controls.Add(this.projectionsDataGridView);
this.projectionsTabPage.Location = new System.Drawing.Point(4, 29);
this.projectionsTabPage.Name = "projectionsTabPage";
this.projectionsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.projectionsTabPage.Size = new System.Drawing.Size(1264, 486);
this.projectionsTabPage.TabIndex = 0;
this.projectionsTabPage.Text = "Projections";
this.projectionsTabPage.UseVisualStyleBackColor = true;
//
// projectionsDataGridView
//
this.projectionsDataGridView.AllowUserToAddRows = false;
this.projectionsDataGridView.AllowUserToResizeRows = false;
this.projectionsDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.projectionsDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.projectionsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.projectionsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.projectionsDataGridView.Location = new System.Drawing.Point(3, 3);
this.projectionsDataGridView.MultiSelect = false;
this.projectionsDataGridView.Name = "projectionsDataGridView";
this.projectionsDataGridView.ReadOnly = true;
this.projectionsDataGridView.RowTemplate.Height = 28;
this.projectionsDataGridView.ShowEditingIcon = false;
this.projectionsDataGridView.Size = new System.Drawing.Size(1258, 480);
this.projectionsDataGridView.TabIndex = 0;
//
// inventoryTabPage
//
this.inventoryTabPage.Controls.Add(this.inventoryDataGridView);
this.inventoryTabPage.Location = new System.Drawing.Point(4, 29);
this.inventoryTabPage.Name = "inventoryTabPage";
this.inventoryTabPage.Padding = new System.Windows.Forms.Padding(3);
this.inventoryTabPage.Size = new System.Drawing.Size(1264, 486);
this.inventoryTabPage.TabIndex = 1;
this.inventoryTabPage.Text = "Inventory";
this.inventoryTabPage.UseVisualStyleBackColor = true;
//
// inventoryDataGridView
//
this.inventoryDataGridView.AllowUserToAddRows = false;
this.inventoryDataGridView.AllowUserToResizeRows = false;
this.inventoryDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.inventoryDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.inventoryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.inventoryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.inventoryDataGridView.Location = new System.Drawing.Point(3, 3);
this.inventoryDataGridView.Name = "inventoryDataGridView";
this.inventoryDataGridView.ReadOnly = true;
this.inventoryDataGridView.RowTemplate.Height = 28;
this.inventoryDataGridView.ShowEditingIcon = false;
this.inventoryDataGridView.Size = new System.Drawing.Size(1258, 480);
this.inventoryDataGridView.TabIndex = 0;
//
// actualTabPage
//
this.actualTabPage.Controls.Add(this.actualSalesDataGridView);
this.actualTabPage.Location = new System.Drawing.Point(4, 29);
this.actualTabPage.Name = "actualTabPage";
this.actualTabPage.Size = new System.Drawing.Size(1264, 486);
this.actualTabPage.TabIndex = 2;
this.actualTabPage.Text = "Actual Sales";
this.actualTabPage.UseVisualStyleBackColor = true;
//
// actualSalesDataGridView
//
this.actualSalesDataGridView.AllowUserToAddRows = false;
this.actualSalesDataGridView.AllowUserToResizeRows = false;
this.actualSalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.actualSalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.actualSalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.actualSalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.actualSalesDataGridView.Location = new System.Drawing.Point(0, 0);
this.actualSalesDataGridView.Name = "actualSalesDataGridView";
this.actualSalesDataGridView.ReadOnly = true;
this.actualSalesDataGridView.RowTemplate.Height = 28;
this.actualSalesDataGridView.ShowEditingIcon = false;
this.actualSalesDataGridView.Size = new System.Drawing.Size(1264, 486);
this.actualSalesDataGridView.TabIndex = 0;
//
// suppliersTabPage
//
this.suppliersTabPage.Controls.Add(this.suppliersDataGridView);
this.suppliersTabPage.Location = new System.Drawing.Point(4, 29);
this.suppliersTabPage.Name = "suppliersTabPage";
this.suppliersTabPage.Size = new System.Drawing.Size(1264, 486);
this.suppliersTabPage.TabIndex = 3;
this.suppliersTabPage.Text = "Suppliers";
this.suppliersTabPage.UseVisualStyleBackColor = true;
//
// suppliersDataGridView
//
this.suppliersDataGridView.AllowUserToAddRows = false;
this.suppliersDataGridView.AllowUserToResizeRows = false;
this.suppliersDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.suppliersDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.suppliersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.suppliersDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.suppliersDataGridView.Location = new System.Drawing.Point(0, 0);
this.suppliersDataGridView.Name = "suppliersDataGridView";
this.suppliersDataGridView.ReadOnly = true;
this.suppliersDataGridView.RowTemplate.Height = 28;
this.suppliersDataGridView.ShowEditingIcon = false;
this.suppliersDataGridView.Size = new System.Drawing.Size(1264, 486);
this.suppliersDataGridView.TabIndex = 0;
//
// weeklySalesTabPage
//
this.weeklySalesTabPage.Controls.Add(this.weeklySalesDataGridView);
this.weeklySalesTabPage.Location = new System.Drawing.Point(4, 29);
this.weeklySalesTabPage.Name = "weeklySalesTabPage";
this.weeklySalesTabPage.Size = new System.Drawing.Size(1264, 486);
this.weeklySalesTabPage.TabIndex = 4;
this.weeklySalesTabPage.Text = "Weekly Sales";
this.weeklySalesTabPage.UseVisualStyleBackColor = true;
//
// weeklySalesDataGridView
//
this.weeklySalesDataGridView.AllowUserToAddRows = false;
this.weeklySalesDataGridView.AllowUserToDeleteRows = false;
this.weeklySalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weeklySalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklySalesDataGridView.Enabled = false;
this.weeklySalesDataGridView.Location = new System.Drawing.Point(0, 0);
this.weeklySalesDataGridView.Name = "weeklySalesDataGridView";
this.weeklySalesDataGridView.ReadOnly = true;
this.weeklySalesDataGridView.RowTemplate.Height = 28;
this.weeklySalesDataGridView.ShowEditingIcon = false;
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1264, 486);
this.weeklySalesDataGridView.TabIndex = 0;
//
// secondaryLayOutPanel
//
this.secondaryLayOutPanel.ColumnCount = 3;
this.secondaryLayOutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.secondaryLayOutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.secondaryLayOutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.secondaryLayOutPanel.Controls.Add(this.commmentsGroupBox, 0, 0);
this.secondaryLayOutPanel.Controls.Add(this.datePickerGroupBox, 1, 0);
this.secondaryLayOutPanel.Controls.Add(this.clearSelectedYearGroupBox, 2, 0);
this.secondaryLayOutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.secondaryLayOutPanel.Location = new System.Drawing.Point(3, 563);
this.secondaryLayOutPanel.Name = "secondaryLayOutPanel";
this.secondaryLayOutPanel.RowCount = 1;
this.secondaryLayOutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.secondaryLayOutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.secondaryLayOutPanel.Size = new System.Drawing.Size(1272, 278);
this.secondaryLayOutPanel.TabIndex = 2;
//
// commmentsGroupBox
//
this.commmentsGroupBox.Controls.Add(this.commentsTextBox);
this.commmentsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commmentsGroupBox.Location = new System.Drawing.Point(3, 3);
this.commmentsGroupBox.Name = "commmentsGroupBox";
this.commmentsGroupBox.Size = new System.Drawing.Size(418, 272);
this.commmentsGroupBox.TabIndex = 0;
this.commmentsGroupBox.TabStop = false;
this.commmentsGroupBox.Text = "Comments";
//
// commentsTextBox
//
this.commentsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsTextBox.Location = new System.Drawing.Point(3, 22);
this.commentsTextBox.Multiline = true;
this.commentsTextBox.Name = "commentsTextBox";
this.commentsTextBox.Size = new System.Drawing.Size(412, 247);
this.commentsTextBox.TabIndex = 0;
//
// datePickerGroupBox
//
this.datePickerGroupBox.Controls.Add(this.informationLabel);
this.datePickerGroupBox.Controls.Add(this.dateSelectorFormatLable);
this.datePickerGroupBox.Controls.Add(this.yearComboBox);
this.datePickerGroupBox.Controls.Add(this.monthComboBox);
this.datePickerGroupBox.Controls.Add(this.dayComboBox);
this.datePickerGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.datePickerGroupBox.Location = new System.Drawing.Point(427, 3);
this.datePickerGroupBox.Name = "datePickerGroupBox";
this.datePickerGroupBox.Size = new System.Drawing.Size(418, 272);
this.datePickerGroupBox.TabIndex = 1;
this.datePickerGroupBox.TabStop = false;
this.datePickerGroupBox.Text = "Select A Date:";
//
// DELETE
//
this.DELETE.Location = new System.Drawing.Point(125, 225);
this.DELETE.Name = "DELETE";
this.DELETE.Size = new System.Drawing.Size(181, 41);
this.DELETE.TabIndex = 5;
this.DELETE.Text = "Clear Selected Year";
this.DELETE.UseVisualStyleBackColor = true;
this.DELETE.Click += new System.EventHandler(this.DELETE_Click);
//
// informationLabel
//
this.informationLabel.AutoSize = true;
this.informationLabel.Location = new System.Drawing.Point(1, 170);
this.informationLabel.Name = "informationLabel";
this.informationLabel.Size = new System.Drawing.Size(0, 20);
this.informationLabel.TabIndex = 4;
//
// dateSelectorFormatLable
//
this.dateSelectorFormatLable.AutoSize = true;
this.dateSelectorFormatLable.Location = new System.Drawing.Point(126, 49);
this.dateSelectorFormatLable.Name = "dateSelectorFormatLable";
this.dateSelectorFormatLable.Size = new System.Drawing.Size(127, 20);
this.dateSelectorFormatLable.TabIndex = 3;
this.dateSelectorFormatLable.Text = "MM / DD / YYYY";
//
// yearComboBox
//
this.yearComboBox.FormattingEnabled = true;
this.yearComboBox.Location = new System.Drawing.Point(259, 85);
this.yearComboBox.Name = "yearComboBox";
this.yearComboBox.Size = new System.Drawing.Size(152, 28);
this.yearComboBox.TabIndex = 2;
//
// monthComboBox
//
this.monthComboBox.FormattingEnabled = true;
this.monthComboBox.Location = new System.Drawing.Point(5, 85);
this.monthComboBox.Name = "monthComboBox";
this.monthComboBox.Size = new System.Drawing.Size(121, 28);
this.monthComboBox.TabIndex = 1;
//
// dayComboBox
//
this.dayComboBox.FormattingEnabled = true;
this.dayComboBox.Location = new System.Drawing.Point(130, 85);
this.dayComboBox.Name = "dayComboBox";
this.dayComboBox.Size = new System.Drawing.Size(121, 28);
this.dayComboBox.TabIndex = 0;
//
// clearSelectedYearGroupBox
//
this.clearSelectedYearGroupBox.Controls.Add(this.yearClearingWarningLabel);
this.clearSelectedYearGroupBox.Controls.Add(this.clearSelectedYearInfoLabel);
this.clearSelectedYearGroupBox.Controls.Add(this.DELETE);
this.clearSelectedYearGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.clearSelectedYearGroupBox.Location = new System.Drawing.Point(851, 3);
this.clearSelectedYearGroupBox.Name = "clearSelectedYearGroupBox";
this.clearSelectedYearGroupBox.Size = new System.Drawing.Size(418, 272);
this.clearSelectedYearGroupBox.TabIndex = 2;
this.clearSelectedYearGroupBox.TabStop = false;
//
// clearSelectedYearInfoLabel
//
this.clearSelectedYearInfoLabel.AutoSize = true;
this.clearSelectedYearInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.clearSelectedYearInfoLabel.Location = new System.Drawing.Point(20, 45);
this.clearSelectedYearInfoLabel.Name = "clearSelectedYearInfoLabel";
this.clearSelectedYearInfoLabel.Size = new System.Drawing.Size(391, 50);
this.clearSelectedYearInfoLabel.TabIndex = 6;
this.clearSelectedYearInfoLabel.Text = "Clearing the selected year will remove ALL \r\nentries for that year as well as the" +
" year itself.";
//
// yearClearingWarningLabel
//
this.yearClearingWarningLabel.AutoSize = true;
this.yearClearingWarningLabel.ForeColor = System.Drawing.Color.Red;
this.yearClearingWarningLabel.Location = new System.Drawing.Point(104, 169);
this.yearClearingWarningLabel.Name = "yearClearingWarningLabel";
this.yearClearingWarningLabel.Size = new System.Drawing.Size(222, 20);
this.yearClearingWarningLabel.TabIndex = 7;
this.yearClearingWarningLabel.Text = "This action cannot be undone!";
//
// frmDeleteRecord
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1278, 844);
this.Controls.Add(this.mainTableLayoutPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.mainMenu;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(1300, 900);
this.MinimumSize = new System.Drawing.Size(1300, 900);
this.Name = "frmDeleteRecord";
this.Text = "Delete Records";
this.Load += new System.EventHandler(this.frmDeleteRecord_Load);
this.mainTableLayoutPanel.ResumeLayout(false);
this.mainTableLayoutPanel.PerformLayout();
this.mainMenu.ResumeLayout(false);
this.mainMenu.PerformLayout();
this.mainTabControl.ResumeLayout(false);
this.projectionsTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.projectionsDataGridView)).EndInit();
this.inventoryTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.inventoryDataGridView)).EndInit();
this.actualTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.actualSalesDataGridView)).EndInit();
this.suppliersTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).EndInit();
this.weeklySalesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).EndInit();
this.secondaryLayOutPanel.ResumeLayout(false);
this.commmentsGroupBox.ResumeLayout(false);
this.commmentsGroupBox.PerformLayout();
this.datePickerGroupBox.ResumeLayout(false);
this.datePickerGroupBox.PerformLayout();
this.clearSelectedYearGroupBox.ResumeLayout(false);
this.clearSelectedYearGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel mainTableLayoutPanel;
private System.Windows.Forms.MenuStrip mainMenu;
private System.Windows.Forms.ToolStripMenuItem fileMainMenu;
private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu;
private System.Windows.Forms.TabControl mainTabControl;
private System.Windows.Forms.TabPage projectionsTabPage;
private System.Windows.Forms.TabPage inventoryTabPage;
private System.Windows.Forms.TabPage actualTabPage;
private System.Windows.Forms.TabPage suppliersTabPage;
private System.Windows.Forms.TabPage weeklySalesTabPage;
private System.Windows.Forms.TableLayoutPanel secondaryLayOutPanel;
private System.Windows.Forms.GroupBox commmentsGroupBox;
private System.Windows.Forms.TextBox commentsTextBox;
private System.Windows.Forms.DataGridView projectionsDataGridView;
private System.Windows.Forms.DataGridView inventoryDataGridView;
private System.Windows.Forms.DataGridView actualSalesDataGridView;
private System.Windows.Forms.DataGridView suppliersDataGridView;
private System.Windows.Forms.DataGridView weeklySalesDataGridView;
private System.Windows.Forms.GroupBox datePickerGroupBox;
private System.Windows.Forms.Label dateSelectorFormatLable;
private System.Windows.Forms.ComboBox yearComboBox;
private System.Windows.Forms.ComboBox monthComboBox;
private System.Windows.Forms.ComboBox dayComboBox;
private System.Windows.Forms.Label informationLabel;
private System.Windows.Forms.Button DELETE;
private System.Windows.Forms.GroupBox clearSelectedYearGroupBox;
private System.Windows.Forms.Label yearClearingWarningLabel;
private System.Windows.Forms.Label clearSelectedYearInfoLabel;
}
}
+448
View File
@@ -0,0 +1,448 @@
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;
using System.Text.RegularExpressions;
namespace AdvertsingProfitControl
{
public partial class frmDeleteRecord : Form
{
readonly LogConsole _console = LogConsole.GetStaticInstance;
private List<string> _gDateStringCollection = new List<string>();
private string _LastComment = "";
public frmDeleteRecord()
{
InitializeComponent();
}
private void frmDeleteRecord_Load(object sender, EventArgs e)
{
FillDateSuggestionComboBoxes();
BuildAndFillDataGridViews();
//Setup event handlers
projectionsDataGridView.UserDeletingRow += ClearRecordFromDatabaseOnRemoving;
inventoryDataGridView.UserDeletingRow += ClearRecordFromDatabaseOnRemoving;
actualSalesDataGridView.UserDeletingRow += ClearRecordFromDatabaseOnRemoving;
suppliersDataGridView.UserDeletingRow += ClearInvoiceFromDatabaseOnRemoving;
commentsTextBox.Leave += UpdateCommentsOnLeave;
}
/// <summary>
/// Event USed: UserDeletingRow
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ClearInvoiceFromDatabaseOnRemoving(object sender, DataGridViewRowCancelEventArgs e)
{
var dataGridView = (DataGridView) sender;
var databaseReader = new RetrieveFromDatabase();
var databaseTracker = new DatabaseTracker();
var databaseWriter = new DatabaseWriter(databaseTracker.DatabaseConnectionString);
var dateId = databaseReader.RetrieveDateIdByDateString(monthComboBox.Text + "/" + dayComboBox.Text + "/" + yearComboBox.Text);
if (dateId == "-1")
{
informationLabel.Text = "An error has occurred trying to obtain the ID\nfor the date " +
monthComboBox.Text + "/" + dayComboBox.Text + "/" + yearComboBox.Text + ".";
}
var supplierName = dataGridView.Rows[e.Row.Index].Cells[0].EditedFormattedValue.ToString();
var invoiceNumber = dataGridView.Rows[e.Row.Index].Cells[1].EditedFormattedValue.ToString();
var count = databaseWriter.RemoveInvoice(invoiceNumber, dateId);
if (count == 1)
{
informationLabel.Text = "Successfully removed the invoice from " + supplierName +
" with\nthe invoice number of " + invoiceNumber + ".";
}
else if(count == 0)
{
informationLabel.Text = "Failed to remove the invoice from " + supplierName + " from the database.";
e.Cancel = true;
}
}
/// <summary>
/// Event Used: Leave
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateCommentsOnLeave(object sender, EventArgs e)
{
var databaseReader = new RetrieveFromDatabase();
var databaseTracker = new DatabaseTracker();
var datbaseWriter = new DatabaseWriter(databaseTracker.DatabaseConnectionString);
if (commentsTextBox.Text == _LastComment)
{
return;
}
var dateId =
databaseReader.RetrieveDateIdByDateString(monthComboBox.Text + "/" + dayComboBox.Text + "/" +
yearComboBox.Text);
if (dateId == "-1"){ informationLabel.Text = "unable to find date in database."; return; }
var recordsAffected = datbaseWriter.UpdateCommentsByDateId(commentsTextBox.Text, dateId);
if (recordsAffected == true)
{
informationLabel.Text = "Successfully updated the comments for the selected date.";
}
else
{
informationLabel.Text = "Failed to update the comments for the selected date.";
}
_LastComment = commentsTextBox.Text;
}
/// <summary>
/// Event Used: UserDeletingRow
/// Clears the record in the row being deleted from the database.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ClearRecordFromDatabaseOnRemoving(object sender, DataGridViewRowCancelEventArgs e)
{
var dataGridView = (DataGridView) sender;
var dataBaseReader = new RetrieveFromDatabase();
var tracker = new DatabaseTracker();
var databaseWriter = new DatabaseWriter(tracker.DatabaseConnectionString);
var dateId = dataBaseReader.RetrieveDateIdByDateString(monthComboBox.Text + "/" + dayComboBox.Text + "/" + yearComboBox.Text);
var adItemName = e.Row.Cells[0].EditedFormattedValue.ToString();
var adItemId = dataBaseReader.RetrieveAdItemId(adItemName);
var count = databaseWriter.RemoveRecord(adItemId, dateId);
if (count == 1)
{
informationLabel.Text = "Successfully removed " + adItemName + " from the database.";
//
projectionsDataGridView.UserDeletingRow -= ClearRecordFromDatabaseOnRemoving;
inventoryDataGridView.UserDeletingRow -= ClearRecordFromDatabaseOnRemoving;
actualSalesDataGridView.UserDeletingRow -= ClearRecordFromDatabaseOnRemoving;
//Maybe make this based on tab page index.
if (dataGridView.Name == "projectionsDataGridView")
{
inventoryDataGridView.Rows.RemoveAt(e.Row.Index);
actualSalesDataGridView.Rows.RemoveAt(e.Row.Index);
}
else if (dataGridView.Name == "inventoryDataGridView")
{
projectionsDataGridView.Rows.RemoveAt(e.Row.Index);
actualSalesDataGridView.Rows.RemoveAt(e.Row.Index);
}
else if (dataGridView.Name == "actualSalesDataGridView")
{
projectionsDataGridView.Rows.RemoveAt(e.Row.Index);
inventoryDataGridView.Rows.RemoveAt(e.Row.Index);
}
}
else
{
informationLabel.Text = "Failed to remove " + adItemName + " from the database.";
e.Cancel = true;
}
projectionsDataGridView.UserDeletingRow += ClearRecordFromDatabaseOnRemoving;
inventoryDataGridView.UserDeletingRow += ClearRecordFromDatabaseOnRemoving;
actualSalesDataGridView.UserDeletingRow += ClearRecordFromDatabaseOnRemoving;
}
private void UpdateDataGridViewInformation(object sender, EventArgs e)
{
string dateString = monthComboBox.Text + "/" + dayComboBox.Text + "/" + yearComboBox.Text;
BuildAndFillDataGridViews(dateString);
}
private void BuildAndFillDataGridViews(string dateString = "")
{
var dataBaseReader = new RetrieveFromDatabase();
var dateId = "";
//Check to see if a parameter has been passed.
if (dateString == "")
{
//IF non were, then grab the most recent date ID from the database and use that.
dateId = dataBaseReader.RetrieveMostRecentDateId();
_console.WriteToLog(LogConsole.Level.Info, dateId != "-1" ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable.");
}
else
{
//ELSE IF one was passed, then use it's ID to build the tables.
dateId = dataBaseReader.RetrieveDateIdByDateString(dateString);
_console.WriteToLog(LogConsole.Level.Info, dateId != "-1" ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database.");
if (dateId == "-1")
{
_gDateStringCollection.Remove(dateString);
}
}
//Now check to make sure there were no errors grabbing the ID, IF there were return.
if (dateId == "-1") return;
//Clear all DataGridViews since the date supplied is valid and in the database.
projectionsDataGridView.DataSource = null;
inventoryDataGridView.DataSource = null;
actualSalesDataGridView.DataSource = null;
suppliersDataGridView.DataSource = null;
weeklySalesDataGridView.DataSource = null;
//Fill the tables from the database.
projectionsDataGridView.DataSource = CleanDataTable(dataBaseReader.ReturnProjectionsTable(dateId));
inventoryDataGridView.DataSource = CleanDataTable(dataBaseReader.ReturnInventoryTable(dateId));
actualSalesDataGridView.DataSource = CleanDataTable(dataBaseReader.ReturnActualSales(dateId));
suppliersDataGridView.DataSource = dataBaseReader.ReturnInvoiceTable(dateId);
weeklySalesDataGridView.DataSource = dataBaseReader.ReturnWeeklySalesFromDateID(dateId);
commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId);
if (commentsTextBox.Text.StartsWith("No comments"))
{
commentsTextBox.Enabled = false;
}
else
{
commentsTextBox.Enabled = true;
_LastComment = commentsTextBox.Text;
}
}
private DataTable CleanDataTable(DataTable table)
{
var cleanedTable = new DataTable();
if (table.Columns[table.Columns.Count - 1].ColumnName == "FK_GroupID")
{
table.Columns.RemoveAt(table.Columns.Count - 1);
}
cleanedTable = table;
return cleanedTable;
}
/// <summary>
/// Grabs all dates from the database and splits the returned strings
/// into months, days, and years and stores them in their respective
/// combo boxes to display to the user. Also stores the list of dates
/// inside a class wide variable.
/// </summary>
private void FillDateSuggestionComboBoxes()
{
//Create a connection to the database retrieval class.
var dbReader = new RetrieveFromDatabase();
//Grab the most recent date in the database.
var mostRecentDateTime = dbReader.ReturnMostRecentDateString();
var mostRecentDateString = mostRecentDateTime.ToString("MM/dd/yyyy");
//Check to see if the return value is null and IF so log the error and return.
if (mostRecentDateString == "") { _console.WriteToLog(LogConsole.Level.Error, "No dates could be found in the database."); return; }
//Otherwise, if there was a return date, split it into a array.
var mostRecentDateParts = mostRecentDateString.Split('/');
//Grab only the most recent years in the database (only say 2015) and fill a table with the dates. Indexes are as follows: [0] is Month, [1] is Day and [2] is Year.
DataTable oneYearDatesTable = dbReader.ReturnDateStringsLike(mostRecentDateParts[0] + "/" + mostRecentDateParts[1] + "/" + mostRecentDateParts[2]);
//Suspend the control's drawing so the user doesn't see any ugly enumeration and index changing.
DrawingControl.SuspendDrawing(secondaryLayOutPanel);
//Considering there was a return value for the most recent date, its safe to assume there is at least one date in the database, so clear the class's date collection.
_gDateStringCollection.Clear();
monthComboBox.Items.Clear();
dayComboBox.Items.Clear();
yearComboBox.Items.Clear();
monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation;
yearComboBox.SelectedIndexChanged -= UpdateDaysOfMonthByYear;
//Now spin through the oneYearDatesTable and fill the class wide object with all the dates for the most recent year.
for (var i = 0; i < oneYearDatesTable.Rows.Count; i++)
{
var fullDateTime = (DateTime)oneYearDatesTable.Rows[i][0];
var fullDateString = fullDateTime.ToString("MM/dd/yyyy");
//Check for nulls just to be paranoid.
if (fullDateString == "")
{
return;
}
//IF the date string collection already contains the date, then continue to the next iteration.
if (_gDateStringCollection.Contains(fullDateString))
{
continue;
}
_gDateStringCollection.Add(fullDateString);
}
var dayBasedOnMonthAndYeaRegex = new Regex("^0?" + mostRecentDateParts[0] + @"/\d{2}/" + mostRecentDateParts[2]);
var monthBasedOnYearRegex = new Regex(@"^\d{2}/\d{2}/" + mostRecentDateParts[2]);
for (var i = 0; i < _gDateStringCollection.Count; i++)
{
string[] dateArray = _gDateStringCollection[i].Split('/');
var month = dateArray[0];
var day = dateArray[1];
if (dayBasedOnMonthAndYeaRegex.IsMatch(_gDateStringCollection[i]))
{
dayComboBox.Items.Add(day);
}
if (monthBasedOnYearRegex.IsMatch(_gDateStringCollection[i]))
{
if (!monthComboBox.Items.Contains(month))
{
monthComboBox.Items.Add(month);
}
}
}
var yearsInDatabase = dbReader.ReturnUniqueYearsList();
foreach (var year in yearsInDatabase)
{
yearComboBox.Items.Add(year);
}
if (dayComboBox.Items.Count >= 1 && yearComboBox.Items.Count >= 1 && monthComboBox.Items.Count >= 1)
{
monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1;
dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1;
yearComboBox.SelectedIndex = yearComboBox.Items.Count - 1;
monthComboBox.Enabled = true;
dayComboBox.Enabled = true;
yearComboBox.Enabled = true;
}
else
{
monthComboBox.Enabled = false;
dayComboBox.Enabled = false;
yearComboBox.Enabled = false;
}
monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation;
yearComboBox.SelectedIndexChanged += UpdateDaysOfMonthByYear;
DrawingControl.ResumeDrawing(secondaryLayOutPanel);
}
private void UpdateDaysOfMonth(object sender, EventArgs e)
{
if (yearComboBox.SelectedIndex == -1) return;
var year = yearComboBox.SelectedItem.ToString();
var month = monthComboBox.SelectedItem.ToString();
var dateParserPattern = new Regex("^" + month + @"\/\d{2}\/" + year);
dayComboBox.Items.Clear();
for (var i = 0; i < _gDateStringCollection.Count; i++)
{
if (dateParserPattern.IsMatch(_gDateStringCollection[i]))
{
var dateArray = _gDateStringCollection[i].Split('/');
var day = dateArray[1];
dayComboBox.Items.Add(day);
}
}
if (dayComboBox.Items.Count > 0)
{
dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1;
}
}
/// <summary>
/// Fires when the Year combo box's index changes.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateDaysOfMonthByYear(object sender, EventArgs e)
{
//Obligatory database retrieval call...
var dbReader = new RetrieveFromDatabase();
//First, grab the year and the month from their respective combo boxes.
var year = yearComboBox.SelectedItem.ToString();
var month = monthComboBox.SelectedItem.ToString();
//Since we can more or less be certain that nothing is null, clear the current date collection.
_gDateStringCollection.Clear();
var months = dbReader.ReturnUniqueMonthsList(month + "/" + dayComboBox.SelectedItem + "/" + year);
var mostRecentMonth = months.Max();
if (mostRecentMonth.Length == 1)
{
mostRecentMonth = "0" + mostRecentMonth;
}
var selectedYearDates = dbReader.ReturnDateStringsLike(month + "/" + dayComboBox.SelectedItem + "/" + year);
for (var i = 0; i < selectedYearDates.Rows.Count; i++)
{
var trimmedDateString = (DateTime)selectedYearDates.Rows[i][0];
_gDateStringCollection.Add(trimmedDateString.ToString("MM/dd/yyyy"));
}
//Clear the month and day combo boxes and unregister their event handlers.
dayComboBox.Items.Clear();
monthComboBox.Items.Clear();
monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation;
for (var i = 0; i < _gDateStringCollection.Count; i++)
{
var dateArray = _gDateStringCollection[i].Split('/');
month = dateArray[0];
//Declare the patterns to look for when enumerating the combo boxes.
var dayBasedOnMonthAndYeaRegex = new Regex(@"^(" + mostRecentMonth + @"\/\d{2}\/" + year + ")"); //Only allows days that are actually part of the month and year.
var day = dateArray[1];
if (dayBasedOnMonthAndYeaRegex.IsMatch(_gDateStringCollection[i]))
{
dayComboBox.Items.Add(day);
}
if (!monthComboBox.Items.Contains(month))
{
monthComboBox.Items.Add(month);
}
}
if (dayComboBox.Items.Count > 0)
{
dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1;
}
if (monthComboBox.Items.Count > 0)
{
monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1;
}
//Now re-register the event handlers
monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation;
BuildAndFillDataGridViews(monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + year);
}
private void DELETE_Click(object sender, EventArgs e)
{
var databaseReader = new RetrieveFromDatabase();
var databaseTracker = new DatabaseTracker();
var databaseWriter = new DatabaseWriter(databaseTracker.DatabaseConnectionString);
var result = MessageBox.Show("Are you sure you wish to delete all records for the date selected date (" + monthComboBox.Text +"/" + dayComboBox.Text + "/" + yearComboBox.Text + ")?\nThis cannot be undone.", "Purge Selected Year", MessageBoxButtons.YesNo)
;
if (result == DialogResult.Yes)
{
var dateId =
databaseReader.RetrieveDateIdByDateString(monthComboBox.Text + "/" + dayComboBox.Text + "/" +
yearComboBox.Text);
var recordsAffected = databaseWriter.RemoveAllEntriesAndYearById(dateId);
if (recordsAffected > 0)
{
informationLabel.Text = "Successfully removed " + recordsAffected.ToString() +
" entries clearing all records of\n" + monthComboBox.Text + "/" + dayComboBox.Text +
"/" + yearComboBox.Text + " from the database.";
}
}
else
{
return;
}
FillDateSuggestionComboBoxes();
BuildAndFillDataGridViews();
}
}
}
File diff suppressed because it is too large Load Diff
+590 -125
View File
@@ -28,37 +28,79 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.mainMenu = new System.Windows.Forms.MenuStrip();
this.fileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.exitFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.recordsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addRecordsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteRecordsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.adSpecialKeyWordsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.helpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.showHideConsoleHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.commentMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.commentMainGroupBox = new System.Windows.Forms.GroupBox();
this.commentsMainLabel = new System.Windows.Forms.Label();
this.commentsTextBox = new System.Windows.Forms.TextBox();
this.profitAnalysisMainGroupBox = new System.Windows.Forms.GroupBox();
this.changeShrinkLinkLabel = new System.Windows.Forms.LinkLabel();
this.shrinkLabel = new System.Windows.Forms.Label();
this.totalProfitReturnLabel = new System.Windows.Forms.Label();
this.totalProfitReturnFromRemaingLabel = new System.Windows.Forms.Label();
this.totalProfitFromAdItemsLabel = new System.Windows.Forms.Label();
this.remainingSalesLabel = new System.Windows.Forms.Label();
this.salesProducedLabel = new System.Windows.Forms.Label();
this.departmentSalesLabel = new System.Windows.Forms.Label();
this.costOfSalesMainGroupBox = new System.Windows.Forms.GroupBox();
this.costOfSalesLabel = new System.Windows.Forms.Label();
this.lessInventoryEndOfWeekAtCostLabel = new System.Windows.Forms.Label();
this.totalLabel = new System.Windows.Forms.Label();
this.plusTotalPurchases = new System.Windows.Forms.Label();
this.inventoryBeginingOfWeekAtCostLabel = new System.Windows.Forms.Label();
this.grossProfitGroupBox = new System.Windows.Forms.GroupBox();
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label();
this.perfectGrossProfitLabel = new System.Windows.Forms.Label();
this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label();
this.grossProfitLessCostOfSales = new System.Windows.Forms.Label();
this.grossProfitTotalSales = new System.Windows.Forms.Label();
this.dateSelectorPanel = new System.Windows.Forms.Panel();
this.yearComboBox = new System.Windows.Forms.ComboBox();
this.dayComboBox = new System.Windows.Forms.ComboBox();
this.monthComboBox = new System.Windows.Forms.ComboBox();
this.dateSelectLabel = new System.Windows.Forms.Label();
this.mainViewTabControl = new System.Windows.Forms.TabControl();
this.projectionTab = new System.Windows.Forms.TabPage();
this.projectedSalesMainDataGrid = new System.Windows.Forms.DataGridView();
this.actualSalesInvTab = new System.Windows.Forms.TabPage();
this.inventoryTabPage = new System.Windows.Forms.TabPage();
this.inventoryDataGridView = new System.Windows.Forms.DataGridView();
this.actualSalesTab = new System.Windows.Forms.TabPage();
this.actualSalesMainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.actualSalesInvMainDataGidView = new System.Windows.Forms.DataGridView();
this.weeklyInventoryControlTab = new System.Windows.Forms.TabPage();
this.weeklyInventoryMainDataGrid = new System.Windows.Forms.DataGridView();
this.actualSalesMainDataGidView = new System.Windows.Forms.DataGridView();
this.suppliersTabPage = new System.Windows.Forms.TabPage();
this.suppliersDataGridView = new System.Windows.Forms.DataGridView();
this.WeeklySalesTabPage = new System.Windows.Forms.TabPage();
this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView();
this.mainTableLayoutPanel.SuspendLayout();
this.mainMenu.SuspendLayout();
this.commentMainTableLayoutPanel.SuspendLayout();
this.commentMainGroupBox.SuspendLayout();
this.profitAnalysisMainGroupBox.SuspendLayout();
this.costOfSalesMainGroupBox.SuspendLayout();
this.grossProfitGroupBox.SuspendLayout();
this.dateSelectorPanel.SuspendLayout();
this.mainViewTabControl.SuspendLayout();
this.projectionTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.projectedSalesMainDataGrid)).BeginInit();
this.actualSalesInvTab.SuspendLayout();
this.inventoryTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.inventoryDataGridView)).BeginInit();
this.actualSalesTab.SuspendLayout();
this.actualSalesMainLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.actualSalesInvMainDataGidView)).BeginInit();
this.weeklyInventoryControlTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklyInventoryMainDataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.actualSalesMainDataGidView)).BeginInit();
this.suppliersTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).BeginInit();
this.WeeklySalesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).BeginInit();
this.SuspendLayout();
//
// mainTableLayoutPanel
@@ -70,12 +112,13 @@
this.mainTableLayoutPanel.Controls.Add(this.mainViewTabControl, 0, 1);
this.mainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.mainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.mainTableLayoutPanel.Name = "mainTableLayoutPanel";
this.mainTableLayoutPanel.RowCount = 3;
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.mainTableLayoutPanel.Size = new System.Drawing.Size(934, 512);
this.mainTableLayoutPanel.Size = new System.Drawing.Size(1478, 794);
this.mainTableLayoutPanel.TabIndex = 0;
//
// mainMenu
@@ -83,10 +126,13 @@
this.mainMenu.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMainMenu,
this.editToolStripMenuItem});
this.recordsToolStripMenuItem,
this.toolsMainMenu,
this.helpMainMenu});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Size = new System.Drawing.Size(934, 25);
this.mainMenu.Padding = new System.Windows.Forms.Padding(9, 3, 0, 3);
this.mainMenu.Size = new System.Drawing.Size(1478, 35);
this.mainMenu.TabIndex = 1;
this.mainMenu.Text = "menuStrip1";
//
@@ -95,110 +141,416 @@
this.fileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitFileMainMenu});
this.fileMainMenu.Name = "fileMainMenu";
this.fileMainMenu.Size = new System.Drawing.Size(37, 21);
this.fileMainMenu.Size = new System.Drawing.Size(50, 29);
this.fileMainMenu.Text = "&File";
//
// exitFileMainMenu
//
this.exitFileMainMenu.Name = "exitFileMainMenu";
this.exitFileMainMenu.Size = new System.Drawing.Size(152, 22);
this.exitFileMainMenu.Size = new System.Drawing.Size(111, 30);
this.exitFileMainMenu.Text = "E&xit";
//
// editToolStripMenuItem
// recordsToolStripMenuItem
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addRecordToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 21);
this.editToolStripMenuItem.Text = "E&dit";
this.recordsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addRecordsToolStripMenuItem,
this.deleteRecordsMainMenu});
this.recordsToolStripMenuItem.Name = "recordsToolStripMenuItem";
this.recordsToolStripMenuItem.Size = new System.Drawing.Size(87, 29);
this.recordsToolStripMenuItem.Text = "&Records";
//
// addRecordToolStripMenuItem
// addRecordsToolStripMenuItem
//
this.addRecordToolStripMenuItem.Name = "addRecordToolStripMenuItem";
this.addRecordToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
this.addRecordToolStripMenuItem.Text = "Add &Record";
this.addRecordToolStripMenuItem.Click += new System.EventHandler(this.addRecordToolStripMenuItem_Click);
this.addRecordsToolStripMenuItem.Name = "addRecordsToolStripMenuItem";
this.addRecordsToolStripMenuItem.Size = new System.Drawing.Size(134, 30);
this.addRecordsToolStripMenuItem.Text = "&Add";
this.addRecordsToolStripMenuItem.Click += new System.EventHandler(this.addRecordToolStripMenuItem_Click);
//
// deleteRecordsMainMenu
//
this.deleteRecordsMainMenu.Name = "deleteRecordsMainMenu";
this.deleteRecordsMainMenu.Size = new System.Drawing.Size(134, 30);
this.deleteRecordsMainMenu.Text = "&Delete";
this.deleteRecordsMainMenu.Click += new System.EventHandler(this.deleteRecordsMainMenu_Click);
//
// toolsMainMenu
//
this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.adSpecialKeyWordsToolsMainMenu});
this.toolsMainMenu.Name = "toolsMainMenu";
this.toolsMainMenu.Size = new System.Drawing.Size(65, 29);
this.toolsMainMenu.Text = "&Tools";
//
// adSpecialKeyWordsToolsMainMenu
//
this.adSpecialKeyWordsToolsMainMenu.Name = "adSpecialKeyWordsToolsMainMenu";
this.adSpecialKeyWordsToolsMainMenu.Size = new System.Drawing.Size(235, 30);
this.adSpecialKeyWordsToolsMainMenu.Text = "&Register Ad Special";
this.adSpecialKeyWordsToolsMainMenu.Click += new System.EventHandler(this.adSpecialKeyWordsToolsMainMenu_Click);
//
// helpMainMenu
//
this.helpMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showHideConsoleHelpMainMenu});
this.helpMainMenu.Name = "helpMainMenu";
this.helpMainMenu.Size = new System.Drawing.Size(61, 29);
this.helpMainMenu.Text = "&Help";
//
// showHideConsoleHelpMainMenu
//
this.showHideConsoleHelpMainMenu.Name = "showHideConsoleHelpMainMenu";
this.showHideConsoleHelpMainMenu.Size = new System.Drawing.Size(241, 30);
this.showHideConsoleHelpMainMenu.Text = "&Show/Hide Console";
this.showHideConsoleHelpMainMenu.Click += new System.EventHandler(this.showHideConsoleHelpMainMenu_Click);
//
// commentMainTableLayoutPanel
//
this.commentMainTableLayoutPanel.ColumnCount = 3;
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 37.5F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 37.5F));
this.commentMainTableLayoutPanel.ColumnCount = 4;
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 28F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26F));
this.commentMainTableLayoutPanel.Controls.Add(this.commentMainGroupBox, 0, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.profitAnalysisMainGroupBox, 1, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.costOfSalesMainGroupBox, 2, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.grossProfitGroupBox, 3, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.dateSelectorPanel, 2, 1);
this.commentMainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(3, 344);
this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(4, 533);
this.commentMainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainTableLayoutPanel.Name = "commentMainTableLayoutPanel";
this.commentMainTableLayoutPanel.RowCount = 1;
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(928, 165);
this.commentMainTableLayoutPanel.RowCount = 2;
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1470, 256);
this.commentMainTableLayoutPanel.TabIndex = 2;
//
// commentMainGroupBox
//
this.commentMainGroupBox.Controls.Add(this.commentsMainLabel);
this.commentMainGroupBox.Controls.Add(this.commentsTextBox);
this.commentMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentMainGroupBox.Location = new System.Drawing.Point(3, 3);
this.commentMainGroupBox.Location = new System.Drawing.Point(4, 5);
this.commentMainGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainGroupBox.Name = "commentMainGroupBox";
this.commentMainGroupBox.Size = new System.Drawing.Size(226, 159);
this.commentMainGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainTableLayoutPanel.SetRowSpan(this.commentMainGroupBox, 2);
this.commentMainGroupBox.Size = new System.Drawing.Size(286, 246);
this.commentMainGroupBox.TabIndex = 0;
this.commentMainGroupBox.TabStop = false;
this.commentMainGroupBox.Text = "Comments";
//
// commentsMainLabel
// commentsTextBox
//
this.commentsMainLabel.AutoEllipsis = true;
this.commentsMainLabel.AutoSize = true;
this.commentsMainLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsMainLabel.Location = new System.Drawing.Point(3, 16);
this.commentsMainLabel.MaximumSize = new System.Drawing.Size(220, 0);
this.commentsMainLabel.Name = "commentsMainLabel";
this.commentsMainLabel.Size = new System.Drawing.Size(0, 13);
this.commentsMainLabel.TabIndex = 0;
this.commentsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsTextBox.Enabled = false;
this.commentsTextBox.Location = new System.Drawing.Point(4, 24);
this.commentsTextBox.Multiline = true;
this.commentsTextBox.Name = "commentsTextBox";
this.commentsTextBox.ReadOnly = true;
this.commentsTextBox.Size = new System.Drawing.Size(278, 217);
this.commentsTextBox.TabIndex = 0;
//
// profitAnalysisMainGroupBox
//
this.profitAnalysisMainGroupBox.Controls.Add(this.changeShrinkLinkLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.shrinkLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitReturnLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitReturnFromRemaingLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitFromAdItemsLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.remainingSalesLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.salesProducedLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.departmentSalesLabel);
this.profitAnalysisMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(235, 3);
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(298, 5);
this.profitAnalysisMainGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.profitAnalysisMainGroupBox.Name = "profitAnalysisMainGroupBox";
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(342, 159);
this.profitAnalysisMainGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainTableLayoutPanel.SetRowSpan(this.profitAnalysisMainGroupBox, 2);
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(403, 246);
this.profitAnalysisMainGroupBox.TabIndex = 1;
this.profitAnalysisMainGroupBox.TabStop = false;
this.profitAnalysisMainGroupBox.Text = "Profit Analysis";
//
// changeShrinkLinkLabel
//
this.changeShrinkLinkLabel.AutoSize = true;
this.changeShrinkLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.changeShrinkLinkLabel.Location = new System.Drawing.Point(181, 31);
this.changeShrinkLinkLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.changeShrinkLinkLabel.Name = "changeShrinkLinkLabel";
this.changeShrinkLinkLabel.Size = new System.Drawing.Size(57, 17);
this.changeShrinkLinkLabel.TabIndex = 7;
this.changeShrinkLinkLabel.TabStop = true;
this.changeShrinkLinkLabel.Text = "Change";
this.changeShrinkLinkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// shrinkLabel
//
this.shrinkLabel.AutoSize = true;
this.shrinkLabel.Location = new System.Drawing.Point(9, 31);
this.shrinkLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.shrinkLabel.Name = "shrinkLabel";
this.shrinkLabel.Size = new System.Drawing.Size(164, 20);
this.shrinkLabel.TabIndex = 6;
this.shrinkLabel.Text = "Assuming 30% Shrink";
//
// totalProfitReturnLabel
//
this.totalProfitReturnLabel.AutoSize = true;
this.totalProfitReturnLabel.Location = new System.Drawing.Point(9, 215);
this.totalProfitReturnLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.totalProfitReturnLabel.Name = "totalProfitReturnLabel";
this.totalProfitReturnLabel.Size = new System.Drawing.Size(146, 20);
this.totalProfitReturnLabel.TabIndex = 5;
this.totalProfitReturnLabel.Text = "Total Profit Return: ";
//
// totalProfitReturnFromRemaingLabel
//
this.totalProfitReturnFromRemaingLabel.AutoSize = true;
this.totalProfitReturnFromRemaingLabel.Location = new System.Drawing.Point(9, 185);
this.totalProfitReturnFromRemaingLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.totalProfitReturnFromRemaingLabel.Name = "totalProfitReturnFromRemaingLabel";
this.totalProfitReturnFromRemaingLabel.Size = new System.Drawing.Size(311, 20);
this.totalProfitReturnFromRemaingLabel.TabIndex = 4;
this.totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: ";
//
// totalProfitFromAdItemsLabel
//
this.totalProfitFromAdItemsLabel.AutoSize = true;
this.totalProfitFromAdItemsLabel.Location = new System.Drawing.Point(9, 154);
this.totalProfitFromAdItemsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.totalProfitFromAdItemsLabel.Name = "totalProfitFromAdItemsLabel";
this.totalProfitFromAdItemsLabel.Size = new System.Drawing.Size(280, 20);
this.totalProfitFromAdItemsLabel.TabIndex = 3;
this.totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): ";
//
// remainingSalesLabel
//
this.remainingSalesLabel.AutoSize = true;
this.remainingSalesLabel.Location = new System.Drawing.Point(9, 123);
this.remainingSalesLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.remainingSalesLabel.Name = "remainingSalesLabel";
this.remainingSalesLabel.Size = new System.Drawing.Size(125, 20);
this.remainingSalesLabel.TabIndex = 2;
this.remainingSalesLabel.Text = "Remaing Sales: ";
//
// salesProducedLabel
//
this.salesProducedLabel.AutoSize = true;
this.salesProducedLabel.Location = new System.Drawing.Point(9, 92);
this.salesProducedLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.salesProducedLabel.Name = "salesProducedLabel";
this.salesProducedLabel.Size = new System.Drawing.Size(240, 20);
this.salesProducedLabel.TabIndex = 1;
this.salesProducedLabel.Text = "Sales Produced By Ad Items (A):";
//
// departmentSalesLabel
//
this.departmentSalesLabel.AutoSize = true;
this.departmentSalesLabel.Location = new System.Drawing.Point(9, 62);
this.departmentSalesLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.departmentSalesLabel.Name = "departmentSalesLabel";
this.departmentSalesLabel.Size = new System.Drawing.Size(146, 20);
this.departmentSalesLabel.TabIndex = 0;
this.departmentSalesLabel.Text = "Department Sales: ";
//
// costOfSalesMainGroupBox
//
this.costOfSalesMainGroupBox.Controls.Add(this.costOfSalesLabel);
this.costOfSalesMainGroupBox.Controls.Add(this.lessInventoryEndOfWeekAtCostLabel);
this.costOfSalesMainGroupBox.Controls.Add(this.totalLabel);
this.costOfSalesMainGroupBox.Controls.Add(this.plusTotalPurchases);
this.costOfSalesMainGroupBox.Controls.Add(this.inventoryBeginingOfWeekAtCostLabel);
this.costOfSalesMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.costOfSalesMainGroupBox.Location = new System.Drawing.Point(583, 3);
this.costOfSalesMainGroupBox.Location = new System.Drawing.Point(709, 5);
this.costOfSalesMainGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.costOfSalesMainGroupBox.Name = "costOfSalesMainGroupBox";
this.costOfSalesMainGroupBox.Size = new System.Drawing.Size(342, 159);
this.costOfSalesMainGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.costOfSalesMainGroupBox.Size = new System.Drawing.Size(374, 194);
this.costOfSalesMainGroupBox.TabIndex = 2;
this.costOfSalesMainGroupBox.TabStop = false;
this.costOfSalesMainGroupBox.Text = "Cost of Sales";
//
// costOfSalesLabel
//
this.costOfSalesLabel.AutoSize = true;
this.costOfSalesLabel.Location = new System.Drawing.Point(8, 154);
this.costOfSalesLabel.Name = "costOfSalesLabel";
this.costOfSalesLabel.Size = new System.Drawing.Size(112, 20);
this.costOfSalesLabel.TabIndex = 4;
this.costOfSalesLabel.Text = "Cost of Sales: ";
//
// lessInventoryEndOfWeekAtCostLabel
//
this.lessInventoryEndOfWeekAtCostLabel.AutoSize = true;
this.lessInventoryEndOfWeekAtCostLabel.Location = new System.Drawing.Point(8, 123);
this.lessInventoryEndOfWeekAtCostLabel.Name = "lessInventoryEndOfWeekAtCostLabel";
this.lessInventoryEndOfWeekAtCostLabel.Size = new System.Drawing.Size(267, 20);
this.lessInventoryEndOfWeekAtCostLabel.TabIndex = 3;
this.lessInventoryEndOfWeekAtCostLabel.Text = "Less Inventory End of Week at Cost:";
//
// totalLabel
//
this.totalLabel.AutoSize = true;
this.totalLabel.Location = new System.Drawing.Point(8, 92);
this.totalLabel.Name = "totalLabel";
this.totalLabel.Size = new System.Drawing.Size(52, 20);
this.totalLabel.TabIndex = 2;
this.totalLabel.Text = "Total: ";
//
// plusTotalPurchases
//
this.plusTotalPurchases.AutoSize = true;
this.plusTotalPurchases.Location = new System.Drawing.Point(8, 61);
this.plusTotalPurchases.Name = "plusTotalPurchases";
this.plusTotalPurchases.Size = new System.Drawing.Size(165, 20);
this.plusTotalPurchases.TabIndex = 1;
this.plusTotalPurchases.Text = "Plus Total Purchases: ";
//
// inventoryBeginingOfWeekAtCostLabel
//
this.inventoryBeginingOfWeekAtCostLabel.AutoSize = true;
this.inventoryBeginingOfWeekAtCostLabel.Location = new System.Drawing.Point(8, 30);
this.inventoryBeginingOfWeekAtCostLabel.Name = "inventoryBeginingOfWeekAtCostLabel";
this.inventoryBeginingOfWeekAtCostLabel.Size = new System.Drawing.Size(266, 20);
this.inventoryBeginingOfWeekAtCostLabel.TabIndex = 0;
this.inventoryBeginingOfWeekAtCostLabel.Text = "Inventory Begining of Week at Cost: ";
//
// grossProfitGroupBox
//
this.grossProfitGroupBox.Controls.Add(this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel);
this.grossProfitGroupBox.Controls.Add(this.perfectGrossProfitLabel);
this.grossProfitGroupBox.Controls.Add(this.grossProfitDollarGrossProfitLabel);
this.grossProfitGroupBox.Controls.Add(this.grossProfitLessCostOfSales);
this.grossProfitGroupBox.Controls.Add(this.grossProfitTotalSales);
this.grossProfitGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.grossProfitGroupBox.Location = new System.Drawing.Point(1090, 3);
this.grossProfitGroupBox.Name = "grossProfitGroupBox";
this.grossProfitGroupBox.Size = new System.Drawing.Size(377, 198);
this.grossProfitGroupBox.TabIndex = 3;
this.grossProfitGroupBox.TabStop = false;
this.grossProfitGroupBox.Text = "Gross Profit";
//
// grossProfitEstimatedWeeklyDeptmartmentExpenseLabel
//
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.AutoSize = true;
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Location = new System.Drawing.Point(11, 152);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Name = "grossProfitEstimatedWeeklyDeptmartmentExpenseLabel";
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Size = new System.Drawing.Size(299, 20);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.TabIndex = 4;
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = "Estimated Weekly Department Expense: ";
//
// perfectGrossProfitLabel
//
this.perfectGrossProfitLabel.AutoSize = true;
this.perfectGrossProfitLabel.Location = new System.Drawing.Point(11, 122);
this.perfectGrossProfitLabel.Name = "perfectGrossProfitLabel";
this.perfectGrossProfitLabel.Size = new System.Drawing.Size(160, 20);
this.perfectGrossProfitLabel.TabIndex = 3;
this.perfectGrossProfitLabel.Text = "Percent Gross Profit: ";
//
// grossProfitDollarGrossProfitLabel
//
this.grossProfitDollarGrossProfitLabel.AutoSize = true;
this.grossProfitDollarGrossProfitLabel.Location = new System.Drawing.Point(11, 92);
this.grossProfitDollarGrossProfitLabel.Name = "grossProfitDollarGrossProfitLabel";
this.grossProfitDollarGrossProfitLabel.Size = new System.Drawing.Size(146, 20);
this.grossProfitDollarGrossProfitLabel.TabIndex = 2;
this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: ";
//
// grossProfitLessCostOfSales
//
this.grossProfitLessCostOfSales.AutoSize = true;
this.grossProfitLessCostOfSales.Location = new System.Drawing.Point(11, 62);
this.grossProfitLessCostOfSales.Name = "grossProfitLessCostOfSales";
this.grossProfitLessCostOfSales.Size = new System.Drawing.Size(150, 20);
this.grossProfitLessCostOfSales.TabIndex = 1;
this.grossProfitLessCostOfSales.Text = "Less Cost of Sales: ";
//
// grossProfitTotalSales
//
this.grossProfitTotalSales.AutoSize = true;
this.grossProfitTotalSales.Location = new System.Drawing.Point(11, 32);
this.grossProfitTotalSales.Name = "grossProfitTotalSales";
this.grossProfitTotalSales.Size = new System.Drawing.Size(96, 20);
this.grossProfitTotalSales.TabIndex = 0;
this.grossProfitTotalSales.Text = "Total Sales: ";
//
// dateSelectorPanel
//
this.commentMainTableLayoutPanel.SetColumnSpan(this.dateSelectorPanel, 2);
this.dateSelectorPanel.Controls.Add(this.yearComboBox);
this.dateSelectorPanel.Controls.Add(this.dayComboBox);
this.dateSelectorPanel.Controls.Add(this.monthComboBox);
this.dateSelectorPanel.Controls.Add(this.dateSelectLabel);
this.dateSelectorPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.dateSelectorPanel.Location = new System.Drawing.Point(708, 207);
this.dateSelectorPanel.Name = "dateSelectorPanel";
this.dateSelectorPanel.Size = new System.Drawing.Size(759, 46);
this.dateSelectorPanel.TabIndex = 4;
//
// yearComboBox
//
this.yearComboBox.FormattingEnabled = true;
this.yearComboBox.Location = new System.Drawing.Point(532, 12);
this.yearComboBox.Name = "yearComboBox";
this.yearComboBox.Size = new System.Drawing.Size(96, 28);
this.yearComboBox.Sorted = true;
this.yearComboBox.TabIndex = 3;
//
// dayComboBox
//
this.dayComboBox.FormattingEnabled = true;
this.dayComboBox.Location = new System.Drawing.Point(430, 12);
this.dayComboBox.Name = "dayComboBox";
this.dayComboBox.Size = new System.Drawing.Size(96, 28);
this.dayComboBox.Sorted = true;
this.dayComboBox.TabIndex = 2;
//
// monthComboBox
//
this.monthComboBox.FormattingEnabled = true;
this.monthComboBox.Location = new System.Drawing.Point(328, 12);
this.monthComboBox.Name = "monthComboBox";
this.monthComboBox.Size = new System.Drawing.Size(96, 28);
this.monthComboBox.Sorted = true;
this.monthComboBox.TabIndex = 1;
//
// dateSelectLabel
//
this.dateSelectLabel.AutoSize = true;
this.dateSelectLabel.Location = new System.Drawing.Point(156, 14);
this.dateSelectLabel.Name = "dateSelectLabel";
this.dateSelectLabel.Size = new System.Drawing.Size(166, 20);
this.dateSelectLabel.TabIndex = 0;
this.dateSelectLabel.Text = "Select a Date to View:";
//
// mainViewTabControl
//
this.mainViewTabControl.Controls.Add(this.projectionTab);
this.mainViewTabControl.Controls.Add(this.actualSalesInvTab);
this.mainViewTabControl.Controls.Add(this.weeklyInventoryControlTab);
this.mainViewTabControl.Controls.Add(this.inventoryTabPage);
this.mainViewTabControl.Controls.Add(this.actualSalesTab);
this.mainViewTabControl.Controls.Add(this.suppliersTabPage);
this.mainViewTabControl.Controls.Add(this.WeeklySalesTabPage);
this.mainViewTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainViewTabControl.Location = new System.Drawing.Point(3, 28);
this.mainViewTabControl.Location = new System.Drawing.Point(4, 40);
this.mainViewTabControl.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.mainViewTabControl.Name = "mainViewTabControl";
this.mainViewTabControl.SelectedIndex = 0;
this.mainViewTabControl.Size = new System.Drawing.Size(928, 310);
this.mainViewTabControl.Size = new System.Drawing.Size(1470, 483);
this.mainViewTabControl.TabIndex = 3;
//
// projectionTab
//
this.projectionTab.Controls.Add(this.projectedSalesMainDataGrid);
this.projectionTab.Location = new System.Drawing.Point(4, 22);
this.projectionTab.Location = new System.Drawing.Point(4, 29);
this.projectionTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionTab.Name = "projectionTab";
this.projectionTab.Padding = new System.Windows.Forms.Padding(3);
this.projectionTab.Size = new System.Drawing.Size(920, 284);
this.projectionTab.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionTab.Size = new System.Drawing.Size(1462, 450);
this.projectionTab.TabIndex = 0;
this.projectionTab.Text = "Projection";
this.projectionTab.Text = "Projections";
this.projectionTab.UseVisualStyleBackColor = true;
//
// projectedSalesMainDataGrid
@@ -210,93 +562,161 @@
this.projectedSalesMainDataGrid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.projectedSalesMainDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.projectedSalesMainDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.projectedSalesMainDataGrid.Location = new System.Drawing.Point(3, 3);
this.projectedSalesMainDataGrid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke;
this.projectedSalesMainDataGrid.Location = new System.Drawing.Point(4, 5);
this.projectedSalesMainDataGrid.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectedSalesMainDataGrid.Name = "projectedSalesMainDataGrid";
this.projectedSalesMainDataGrid.ReadOnly = true;
this.projectedSalesMainDataGrid.RowHeadersVisible = false;
this.projectedSalesMainDataGrid.ShowCellErrors = false;
this.projectedSalesMainDataGrid.ShowRowErrors = false;
this.projectedSalesMainDataGrid.Size = new System.Drawing.Size(914, 278);
this.projectedSalesMainDataGrid.Size = new System.Drawing.Size(1454, 440);
this.projectedSalesMainDataGrid.TabIndex = 0;
//
// actualSalesInvTab
// inventoryTabPage
//
this.actualSalesInvTab.Controls.Add(this.actualSalesMainLayoutPanel);
this.actualSalesInvTab.Location = new System.Drawing.Point(4, 22);
this.actualSalesInvTab.Name = "actualSalesInvTab";
this.actualSalesInvTab.Size = new System.Drawing.Size(920, 284);
this.actualSalesInvTab.TabIndex = 2;
this.actualSalesInvTab.Text = "Actual Sales / Inventory";
this.actualSalesInvTab.UseVisualStyleBackColor = true;
this.inventoryTabPage.Controls.Add(this.inventoryDataGridView);
this.inventoryTabPage.Location = new System.Drawing.Point(4, 29);
this.inventoryTabPage.Name = "inventoryTabPage";
this.inventoryTabPage.Padding = new System.Windows.Forms.Padding(3);
this.inventoryTabPage.Size = new System.Drawing.Size(1462, 450);
this.inventoryTabPage.TabIndex = 4;
this.inventoryTabPage.Text = "Inventory";
this.inventoryTabPage.UseVisualStyleBackColor = true;
//
// inventoryDataGridView
//
this.inventoryDataGridView.AllowUserToAddRows = false;
this.inventoryDataGridView.AllowUserToDeleteRows = false;
this.inventoryDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.inventoryDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.inventoryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.inventoryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.inventoryDataGridView.Location = new System.Drawing.Point(3, 3);
this.inventoryDataGridView.Name = "inventoryDataGridView";
this.inventoryDataGridView.ReadOnly = true;
this.inventoryDataGridView.RowHeadersVisible = false;
this.inventoryDataGridView.RowTemplate.Height = 28;
this.inventoryDataGridView.Size = new System.Drawing.Size(1456, 444);
this.inventoryDataGridView.TabIndex = 0;
//
// actualSalesTab
//
this.actualSalesTab.Controls.Add(this.actualSalesMainLayoutPanel);
this.actualSalesTab.Location = new System.Drawing.Point(4, 29);
this.actualSalesTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.actualSalesTab.Name = "actualSalesTab";
this.actualSalesTab.Size = new System.Drawing.Size(1462, 450);
this.actualSalesTab.TabIndex = 2;
this.actualSalesTab.Text = "Actual Sales";
this.actualSalesTab.UseVisualStyleBackColor = true;
//
// actualSalesMainLayoutPanel
//
this.actualSalesMainLayoutPanel.ColumnCount = 1;
this.actualSalesMainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.actualSalesMainLayoutPanel.Controls.Add(this.actualSalesInvMainDataGidView, 0, 0);
this.actualSalesMainLayoutPanel.Controls.Add(this.actualSalesMainDataGidView, 0, 0);
this.actualSalesMainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.actualSalesMainLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.actualSalesMainLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.actualSalesMainLayoutPanel.Name = "actualSalesMainLayoutPanel";
this.actualSalesMainLayoutPanel.RowCount = 1;
this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 284F));
this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(920, 284);
this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 450F));
this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1462, 450);
this.actualSalesMainLayoutPanel.TabIndex = 0;
//
// actualSalesInvMainDataGidView
// actualSalesMainDataGidView
//
this.actualSalesInvMainDataGidView.AllowUserToAddRows = false;
this.actualSalesInvMainDataGidView.AllowUserToDeleteRows = false;
this.actualSalesInvMainDataGidView.AllowUserToResizeRows = false;
this.actualSalesInvMainDataGidView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.actualSalesInvMainDataGidView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.actualSalesInvMainDataGidView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.actualSalesInvMainDataGidView.Dock = System.Windows.Forms.DockStyle.Fill;
this.actualSalesInvMainDataGidView.Location = new System.Drawing.Point(3, 3);
this.actualSalesInvMainDataGidView.Name = "actualSalesInvMainDataGidView";
this.actualSalesInvMainDataGidView.ReadOnly = true;
this.actualSalesInvMainDataGidView.RowHeadersVisible = false;
this.actualSalesInvMainDataGidView.ShowCellErrors = false;
this.actualSalesInvMainDataGidView.ShowRowErrors = false;
this.actualSalesInvMainDataGidView.Size = new System.Drawing.Size(914, 278);
this.actualSalesInvMainDataGidView.TabIndex = 1;
this.actualSalesMainDataGidView.AllowUserToAddRows = false;
this.actualSalesMainDataGidView.AllowUserToDeleteRows = false;
this.actualSalesMainDataGidView.AllowUserToResizeRows = false;
this.actualSalesMainDataGidView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.actualSalesMainDataGidView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.actualSalesMainDataGidView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.actualSalesMainDataGidView.Dock = System.Windows.Forms.DockStyle.Fill;
this.actualSalesMainDataGidView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke;
this.actualSalesMainDataGidView.Location = new System.Drawing.Point(4, 5);
this.actualSalesMainDataGidView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.actualSalesMainDataGidView.Name = "actualSalesMainDataGidView";
this.actualSalesMainDataGidView.ReadOnly = true;
this.actualSalesMainDataGidView.RowHeadersVisible = false;
this.actualSalesMainDataGidView.ShowCellErrors = false;
this.actualSalesMainDataGidView.ShowRowErrors = false;
this.actualSalesMainDataGidView.Size = new System.Drawing.Size(1454, 440);
this.actualSalesMainDataGidView.TabIndex = 1;
//
// weeklyInventoryControlTab
// suppliersTabPage
//
this.weeklyInventoryControlTab.Controls.Add(this.weeklyInventoryMainDataGrid);
this.weeklyInventoryControlTab.Location = new System.Drawing.Point(4, 22);
this.weeklyInventoryControlTab.Name = "weeklyInventoryControlTab";
this.weeklyInventoryControlTab.Padding = new System.Windows.Forms.Padding(3);
this.weeklyInventoryControlTab.Size = new System.Drawing.Size(920, 284);
this.weeklyInventoryControlTab.TabIndex = 1;
this.weeklyInventoryControlTab.Text = "Weekly Inventory Control";
this.weeklyInventoryControlTab.UseVisualStyleBackColor = true;
this.suppliersTabPage.Controls.Add(this.suppliersDataGridView);
this.suppliersTabPage.Location = new System.Drawing.Point(4, 29);
this.suppliersTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersTabPage.Name = "suppliersTabPage";
this.suppliersTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersTabPage.Size = new System.Drawing.Size(1462, 450);
this.suppliersTabPage.TabIndex = 1;
this.suppliersTabPage.Text = "Suppliers";
this.suppliersTabPage.UseVisualStyleBackColor = true;
//
// weeklyInventoryMainDataGrid
// suppliersDataGridView
//
this.weeklyInventoryMainDataGrid.AllowUserToAddRows = false;
this.weeklyInventoryMainDataGrid.AllowUserToDeleteRows = false;
this.weeklyInventoryMainDataGrid.AllowUserToResizeRows = false;
this.weeklyInventoryMainDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weeklyInventoryMainDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklyInventoryMainDataGrid.Location = new System.Drawing.Point(3, 3);
this.weeklyInventoryMainDataGrid.Name = "weeklyInventoryMainDataGrid";
this.weeklyInventoryMainDataGrid.ReadOnly = true;
this.weeklyInventoryMainDataGrid.RowHeadersVisible = false;
this.weeklyInventoryMainDataGrid.Size = new System.Drawing.Size(914, 278);
this.weeklyInventoryMainDataGrid.TabIndex = 0;
this.suppliersDataGridView.AllowUserToAddRows = false;
this.suppliersDataGridView.AllowUserToDeleteRows = false;
this.suppliersDataGridView.AllowUserToResizeRows = false;
this.suppliersDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.suppliersDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.suppliersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.suppliersDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.suppliersDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke;
this.suppliersDataGridView.Location = new System.Drawing.Point(4, 5);
this.suppliersDataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersDataGridView.Name = "suppliersDataGridView";
this.suppliersDataGridView.ReadOnly = true;
this.suppliersDataGridView.RowHeadersVisible = false;
this.suppliersDataGridView.Size = new System.Drawing.Size(1454, 440);
this.suppliersDataGridView.TabIndex = 0;
//
// WeeklySalesTabPage
//
this.WeeklySalesTabPage.Controls.Add(this.weeklySalesDataGridView);
this.WeeklySalesTabPage.Location = new System.Drawing.Point(4, 29);
this.WeeklySalesTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.WeeklySalesTabPage.Name = "WeeklySalesTabPage";
this.WeeklySalesTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.WeeklySalesTabPage.Size = new System.Drawing.Size(1462, 450);
this.WeeklySalesTabPage.TabIndex = 3;
this.WeeklySalesTabPage.Text = "Weekly Sales";
this.WeeklySalesTabPage.UseVisualStyleBackColor = true;
//
// weeklySalesDataGridView
//
this.weeklySalesDataGridView.AllowUserToAddRows = false;
this.weeklySalesDataGridView.AllowUserToDeleteRows = false;
this.weeklySalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.weeklySalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.weeklySalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weeklySalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklySalesDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke;
this.weeklySalesDataGridView.Location = new System.Drawing.Point(4, 5);
this.weeklySalesDataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.weeklySalesDataGridView.Name = "weeklySalesDataGridView";
this.weeklySalesDataGridView.ReadOnly = true;
this.weeklySalesDataGridView.RowHeadersVisible = false;
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1454, 440);
this.weeklySalesDataGridView.TabIndex = 0;
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(934, 512);
this.ClientSize = new System.Drawing.Size(1478, 794);
this.Controls.Add(this.mainTableLayoutPanel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.Name = "frmMain";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Advertising Profit Control - Main";
this.Text = "Advertising Profit Control";
this.Load += new System.EventHandler(this.frmMain_Load);
this.mainTableLayoutPanel.ResumeLayout(false);
this.mainTableLayoutPanel.PerformLayout();
@@ -305,14 +725,26 @@
this.commentMainTableLayoutPanel.ResumeLayout(false);
this.commentMainGroupBox.ResumeLayout(false);
this.commentMainGroupBox.PerformLayout();
this.profitAnalysisMainGroupBox.ResumeLayout(false);
this.profitAnalysisMainGroupBox.PerformLayout();
this.costOfSalesMainGroupBox.ResumeLayout(false);
this.costOfSalesMainGroupBox.PerformLayout();
this.grossProfitGroupBox.ResumeLayout(false);
this.grossProfitGroupBox.PerformLayout();
this.dateSelectorPanel.ResumeLayout(false);
this.dateSelectorPanel.PerformLayout();
this.mainViewTabControl.ResumeLayout(false);
this.projectionTab.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.projectedSalesMainDataGrid)).EndInit();
this.actualSalesInvTab.ResumeLayout(false);
this.inventoryTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.inventoryDataGridView)).EndInit();
this.actualSalesTab.ResumeLayout(false);
this.actualSalesMainLayoutPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.actualSalesInvMainDataGidView)).EndInit();
this.weeklyInventoryControlTab.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.weeklyInventoryMainDataGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.actualSalesMainDataGidView)).EndInit();
this.suppliersTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).EndInit();
this.WeeklySalesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).EndInit();
this.ResumeLayout(false);
}
@@ -329,15 +761,48 @@
private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu;
private System.Windows.Forms.TabControl mainViewTabControl;
private System.Windows.Forms.TabPage projectionTab;
private System.Windows.Forms.TabPage weeklyInventoryControlTab;
private System.Windows.Forms.DataGridView weeklyInventoryMainDataGrid;
private System.Windows.Forms.Label commentsMainLabel;
private System.Windows.Forms.TabPage actualSalesInvTab;
private System.Windows.Forms.TabPage suppliersTabPage;
private System.Windows.Forms.DataGridView suppliersDataGridView;
private System.Windows.Forms.TabPage actualSalesTab;
private System.Windows.Forms.TableLayoutPanel actualSalesMainLayoutPanel;
private System.Windows.Forms.DataGridView actualSalesInvMainDataGidView;
private System.Windows.Forms.DataGridView actualSalesMainDataGidView;
private System.Windows.Forms.DataGridView projectedSalesMainDataGrid;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addRecordToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem recordsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addRecordsToolStripMenuItem;
private System.Windows.Forms.Label totalProfitReturnLabel;
private System.Windows.Forms.Label totalProfitReturnFromRemaingLabel;
private System.Windows.Forms.Label totalProfitFromAdItemsLabel;
private System.Windows.Forms.Label remainingSalesLabel;
private System.Windows.Forms.Label salesProducedLabel;
private System.Windows.Forms.Label departmentSalesLabel;
private System.Windows.Forms.TabPage WeeklySalesTabPage;
private System.Windows.Forms.DataGridView weeklySalesDataGridView;
private System.Windows.Forms.LinkLabel changeShrinkLinkLabel;
private System.Windows.Forms.Label shrinkLabel;
private System.Windows.Forms.ToolStripMenuItem helpMainMenu;
private System.Windows.Forms.ToolStripMenuItem showHideConsoleHelpMainMenu;
private System.Windows.Forms.Label costOfSalesLabel;
private System.Windows.Forms.Label lessInventoryEndOfWeekAtCostLabel;
private System.Windows.Forms.Label totalLabel;
private System.Windows.Forms.Label plusTotalPurchases;
private System.Windows.Forms.Label inventoryBeginingOfWeekAtCostLabel;
private System.Windows.Forms.GroupBox grossProfitGroupBox;
private System.Windows.Forms.Label grossProfitEstimatedWeeklyDeptmartmentExpenseLabel;
private System.Windows.Forms.Label perfectGrossProfitLabel;
private System.Windows.Forms.Label grossProfitDollarGrossProfitLabel;
private System.Windows.Forms.Label grossProfitLessCostOfSales;
private System.Windows.Forms.Label grossProfitTotalSales;
private System.Windows.Forms.Panel dateSelectorPanel;
private System.Windows.Forms.ComboBox yearComboBox;
private System.Windows.Forms.ComboBox dayComboBox;
private System.Windows.Forms.ComboBox monthComboBox;
private System.Windows.Forms.Label dateSelectLabel;
private System.Windows.Forms.TabPage inventoryTabPage;
private System.Windows.Forms.DataGridView inventoryDataGridView;
private System.Windows.Forms.ToolStripMenuItem toolsMainMenu;
private System.Windows.Forms.ToolStripMenuItem adSpecialKeyWordsToolsMainMenu;
private System.Windows.Forms.ToolStripMenuItem deleteRecordsMainMenu;
private System.Windows.Forms.TextBox commentsTextBox;
}
}
+632 -127
View File
@@ -1,169 +1,674 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.OleDb;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
public partial class frmMain : Form
{
private AutoCompleteStringCollection dateSuggestions = new AutoCompleteStringCollection();
//private string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=apcDatabase.accdb;Persist Security Info=False";
private double _gActualTotaSalesCalculatedTotal = 0;
private double _gActualTotalProfitReturnCalculatedTotal = 0;
private double _gCostOfSalesCalculatedTotal = 0;
private List<string> _gDateStringCollection = new List<string>();
readonly LogConsole _console = LogConsole.GetStaticInstance;
public frmMain()
{
InitializeComponent();
//Set the maximum and minimum sizes for the form.
MaximumSize = new Size(1200, 650);
MinimumSize = new Size(1000, 550);
}
private void frmMain_Load(object sender, EventArgs e)
{
//connect to the database on form load | eh?
BuildUITables();
addRecordToolStripMenuItem.PerformClick();
FillDateSuggestionComboBoxes();
BuildAndFillDataGridTables();
CalculateProfitAnalysis();
CalculateGrossProfit();
_console.Show();
}
private void UpdateDataGridViewInformation(object sender, EventArgs e)
{
string dateString = monthComboBox.Text + "/" + dayComboBox.Text + "/" + yearComboBox.Text;
BuildAndFillDataGridTables(dateString);
CalculateProfitAnalysis();
CalculateGrossProfit();
}
/// <summary>
/// This function re-orders the DataGridView to fit the
/// column scheme of the Advertising Profit Control sheet,
/// because SQL doesn't appear to return the columns in
/// the desired order.
/// Builds and fills the DataGridView tables on the main form
/// from the either the most recent date or the date specified in the parameter.
/// </summary>
/// <param name="dataGrid"></param>
private void ReorderDataGridView(DataGridView dataGrid)
/// <param name="dateString">The date of records to display to the user, if no date is specified then the most recent date is used.</param>
private void BuildAndFillDataGridTables(string dateString = "")
{
foreach (DataGridViewColumn column in dataGrid.Columns)
//Deprecated
var dataBaseReader = new RetrieveFromDatabase();
//
var dateId = "";
//Check to see if a parameter has been passed.
if (dateString == "")
{
if (!column.Name.Contains("ID"))
//IF non were, then grab the most recent date ID from the database and use that.
dateId = dataBaseReader.RetrieveMostRecentDateId();
_console.WriteToLog(LogConsole.Level.Info, dateId != "-1" ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable.");
}
else
{
//ELSE IF one was passed, then use it's ID to build the tables.
dateId = dataBaseReader.RetrieveDateIdByDateString(dateString);
_console.WriteToLog(LogConsole.Level.Info, dateId != "-1" ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database.");
if (dateId == "-1")
{
switch (column.Name.ToLower())
_gDateStringCollection.Remove(dateString);
}
}
//Now check to make sure there were no errors grabbing the ID, IF there were return.
if (dateId == "-1") return;
//Clear the class global variables to prevents calculation mishaps.
_gActualTotaSalesCalculatedTotal = 0;
_gActualTotalProfitReturnCalculatedTotal = 0;
_gCostOfSalesCalculatedTotal = 0;
//Clear all DataGridViews since the date supplied is valid and in the database.
projectedSalesMainDataGrid.DataSource = null;
inventoryDataGridView.DataSource = null;
actualSalesMainDataGidView.DataSource = null;
suppliersDataGridView.DataSource = null;
weeklySalesDataGridView.DataSource = null;
var indexOfAdSpecialRow = -1;
var regexGroupCategoryparser = new Regex(@"^(\d)?\|\d");
//Begin by grabbing the Projections table
var tempTable = dataBaseReader.ReturnProjectionsTable(dateId);
if (tempTable.Rows.Count > 0)
{
projectedSalesMainDataGrid.DataSource = SumSalesTable(tempTable);
string adCategory = "";
for (var i = 0; i < projectedSalesMainDataGrid.Rows.Count; i++)
{
int castedValue = 0;
if ((string)projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue == "1")
{
//---Begin AdItem Table check-------------------
case "aditem":
column.DisplayIndex = 0;
column.HeaderText = "Ad Item";
break;
//---End AdItem Table check---------------------
//---Begin Projected Sales Table check----------
case "prsold":
column.DisplayIndex = 1;
column.HeaderText = "Sold";
break;
case "prsaleprice":
column.DisplayIndex = 2;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Sale Price";
break;
case "prtotalsales":
column.DisplayIndex = 3;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Total Sales";
break;
case "prcost":
column.DisplayIndex = 4;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Cost";
break;
case "prprofitreturn":
column.DisplayIndex = 5;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Profit Return";
break;
case "prtotalprofitreturn":
column.DisplayIndex = 6;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Total Profit Return";
break;
//---End Projected Sales Table check------------
//---Begin Inventory Table check----------------
case "invbegininginventory":
column.DisplayIndex = 1;
column.HeaderText = "Beginning inventory";
break;
case "invrecieved":
column.DisplayIndex = 2;
column.HeaderText = "Received";
break;
case "invtotal":
column.DisplayIndex = 3;
column.HeaderText = "Total";
break;
case "invending":
column.DisplayIndex = 4;
column.HeaderText = "Ending Inventory";
break;
//---End Inventory Table check------------------
//---Begin Actual Sales Table check-------------
case "acsold":
column.DisplayIndex = 8;
column.HeaderText = "Sold";
break;
case "acsaleprice":
column.DisplayIndex = 9;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Sale Price";
break;
case "actotalsales":
column.DisplayIndex = 10;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Total Sales";
break;
case "accost":
column.DisplayIndex = 11;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Cost";
break;
case "acprofitreturn":
column.DisplayIndex = 12;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Profit Return";
break;
case "actotalprofitreturn":
column.DisplayIndex = 13;
column.DefaultCellStyle.Format = "c";
column.HeaderText = "Total Profit Return";
break;
//---End Actual Table check---------------------
default:
MessageBox.Show("This message box should never appear but if it does record this information:\n" + "Column Name: " + column.Name + "\nColumn Type: " + column.ValueType, "Unknown Column Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}else if ((string) projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue == "2")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (
regexGroupCategoryparser.IsMatch(
(string) projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue))
{
string[] spam = new string[2];
spam = ParseAdSpecialRows(projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue.ToString());
if (spam.Length > 1)
{
adCategory = spam[1];
}
else
{
adCategory = spam[0];
}
if (indexOfAdSpecialRow == -1)
{
indexOfAdSpecialRow = i;
}
if (spam[0] == "1")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}else if (spam[0] == "2")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
}
else
{
//The column was an ID field therefore we won't bother showing it to the user.
column.Visible = false;
}
var dataGridViewColumn = projectedSalesMainDataGrid.Columns["FK_GroupID"];
if (dataGridViewColumn != null)
dataGridViewColumn.Visible = false;
}
}//End of ReorderDataGridView() function
private void BuildUITables()
{
RetrieveTables tableData = new RetrieveTables();
DataGridView finalWICTable = new DataGridView();
string[] comments;
projectedSalesMainDataGrid.DataSource = tableData.APCProjectionSaleTable();
ReorderDataGridView(projectedSalesMainDataGrid);
actualSalesInvMainDataGidView.DataSource = tableData.APCActualSalesTable();
ReorderDataGridView(actualSalesInvMainDataGidView);
finalWICTable.DataSource = tableData.WICTable();
comments = tableData.Comment();
foreach (string comment in comments)
//Grabbing the Inventory table
tempTable = dataBaseReader.ReturnInventoryTable(dateId);
if (tempTable.Rows.Count > 0)
{
commentsMainLabel.Text = comment + "\n";
inventoryDataGridView.DataSource = tempTable;
string adCategory = "";
for (var i = 0; i < inventoryDataGridView.Rows.Count; i++)
{
int castedValue = 0;
if ((string)inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue == "1")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if ((string)inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue == "2")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (
regexGroupCategoryparser.IsMatch(
(string)inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue))
{
string[] spam = new string[2];
spam = ParseAdSpecialRows(inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue.ToString());
if (spam.Length > 1)
{
adCategory = spam[1];
}
else
{
adCategory = spam[0];
}
if (spam[0] == "1")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if (spam[0] == "2")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
}
var dataGridViewColumn = inventoryDataGridView.Columns["FK_GroupID"];
if (dataGridViewColumn != null)
dataGridViewColumn.Visible = false;
}
//And the Actual Sales table
tempTable = dataBaseReader.ReturnActualSales(dateId);
if (tempTable.Rows.Count > 0)
{
actualSalesMainDataGidView.DataSource = SumSalesTable(tempTable);
string adCategory = "";
for (var i = 0; i < actualSalesMainDataGidView.Rows.Count; i++)
{
int castedValue = 0;
if ((string)actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue == "1")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if ((string)actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue == "2")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (
regexGroupCategoryparser.IsMatch(
(string)actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue))
{
string[] spam = new string[2];
spam = ParseAdSpecialRows(actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue.ToString());
if (spam.Length > 1)
{
adCategory = spam[1];
}
else
{
adCategory = spam[0];
}
if (spam[0] == "1")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if (spam[0] == "2")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
}
var year = actualSalesMainDataGidView.Columns["FK_GroupID"];
if (year != null)
year.Visible = false;
}
//Next the Invoices table
tempTable = dataBaseReader.ReturnInvoiceTable(dateId);
if (tempTable.Rows.Count > 0)
{
suppliersDataGridView.DataSource = SumCostOfSales(tempTable);
}
//And finally the weekly sales
tempTable = dataBaseReader.ReturnWeeklySalesFromDateID(dateId);
if (tempTable.Rows.Count > 0)
{
weeklySalesDataGridView.DataSource = tempTable;
}
commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId);
}
private void CalculateProfitAnalysis(double shrink = 0.30)
{
if (Math.Abs(_gActualTotaSalesCalculatedTotal) < 1 || Math.Abs(_gActualTotalProfitReturnCalculatedTotal) < 1)
{
//Clear the labels...
if (weeklySalesDataGridView.Rows.Count == 0 || weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString() == "0.0000")
{
departmentSalesLabel.Text = "Department Sales: No Weekly Sales Found.";
departmentSalesLabel.ForeColor = Color.Red;
}
if (_gActualTotaSalesCalculatedTotal == 0)
{
salesProducedLabel.Text = "Sales Produced By Ad Items (A): No Values to Total.";
salesProducedLabel.ForeColor = Color.Red;
}
remainingSalesLabel.Text = "Remaining Sales: ";
if (_gActualTotalProfitReturnCalculatedTotal == 0)
{
totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): No Values to Total.";
totalProfitFromAdItemsLabel.ForeColor = Color.Red;
}
totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: ";
totalProfitReturnLabel.Text = "Total Profit Return: ";
return;
}
double departmentSales = 0;
Double.TryParse(weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString(), out departmentSales);
//Since there are department sales, change the label's color to make sure it doesn't appear as an error.
departmentSalesLabel.ForeColor = Color.Black;
departmentSalesLabel.Text = "Department Sales: " + departmentSales.ToString("C");
//Assume that the sales produced is larger then zero (0).
salesProducedLabel.ForeColor = Color.Black;
salesProducedLabel.Text = "Sales Produced By Ad Items (A): " + _gActualTotaSalesCalculatedTotal.ToString("C");
double remainingSales = departmentSales - _gActualTotaSalesCalculatedTotal;
remainingSalesLabel.Text = "Remaining Sales: " + remainingSales.ToString("C");
//Again assume the total profit return is larger then zero (0).
totalProfitFromAdItemsLabel.ForeColor = Color.Black;
totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): " + _gActualTotalProfitReturnCalculatedTotal.ToString("C");
//Shrink is being used as a place holder for Cross Profit % which is obtained by dividing gActualTotalProfitReturnCalculatedTotal by the department weekly retail sales.
double totalProfitReturnFromRemainingSales = shrink * remainingSales;
//
totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: " + totalProfitReturnFromRemainingSales.ToString("C");
double totalProfitReturn = _gActualTotalProfitReturnCalculatedTotal + totalProfitReturnFromRemainingSales;
totalProfitReturnLabel.Text = "Total Profit Return: " + totalProfitReturn.ToString("C");
}
private void CalculateCostOfSales()
{
//?
}
private void CalculateGrossProfit()
{
if (Math.Abs(_gCostOfSalesCalculatedTotal) < 1)
{
//IF Cost of Sales hasn't been calculated, then clear labels and return.
if (weeklySalesDataGridView.Rows.Count == 0 || weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString() == "0.0000")
{
grossProfitTotalSales.Text = "Total Sales: No Weekly Sales Found.";
grossProfitTotalSales.ForeColor = Color.Red;
}
grossProfitLessCostOfSales.Text = "Less Cost of Sales: ";
grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: ";
perfectGrossProfitLabel.Text = "Percent Gross Profit: ";
return;
}
double totalSales = Convert.ToDouble(weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString());
grossProfitTotalSales.ForeColor = Color.Black;
grossProfitTotalSales.Text = "Total Sales: " + totalSales.ToString("C");
grossProfitLessCostOfSales.Text = "Less Cost of Sales: " + _gCostOfSalesCalculatedTotal.ToString("C");
double dollarGrossProfit = totalSales - _gCostOfSalesCalculatedTotal;
grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: " + dollarGrossProfit.ToString("C");
double grossProfitPercent = dollarGrossProfit / totalSales;
perfectGrossProfitLabel.Text = "Percent Gross Profit: " + grossProfitPercent.ToString("P");
}
private void addRecordToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAddRecord recordForm = new frmAddRecord();
recordForm.ShowDialog();
BuildUITables();
FillDateSuggestionComboBoxes();
BuildAndFillDataGridTables();
CalculateProfitAnalysis();
CalculateGrossProfit();
}
/// <summary>
/// Appends a new "Totals" row to the end of the DataTable that is passed in
/// and sums up the Total Sales and Total Profit Return columns as well as
/// storing the Total Sales and Total Profit Return in their respective
/// class wide variables for use with other functions.
/// </summary>
/// <param name="table">The sales table to be summed up.</param>
/// <returns></returns>
private DataTable SumSalesTable(DataTable table)
{
//IF the table is null OR has an invalid column count then return.
if (table == null || table.Columns.Count < 7) return table;
//Both Projections and Actual tables have the Total Sales and Total Profit Return columns in the same position,
//indexes three (3) and six (6) respectively.
double totalSalesSum = 0;
double totalProfitReturnSum = 0;
for (var i = 0; i < table.Rows.Count; i++)
{
totalSalesSum += Convert.ToDouble(table.Rows[i][3]);
totalProfitReturnSum += Convert.ToDouble(table.Rows[i][6]);
}
//Once the totals have been calculated store them in the class wide variables so other methods can use them.
_gActualTotaSalesCalculatedTotal = totalSalesSum;
_gActualTotalProfitReturnCalculatedTotal = totalProfitReturnSum;
//Create an object array to store the summed values and add them at the end to the table before returning it.
object[] rowContents = new object[table.Columns.Count];
rowContents[0] = "Total";
rowContents[3] = totalSalesSum;
rowContents[6] = totalProfitReturnSum;
table.Rows.Add(rowContents);
return table;
}
/// <summary>
/// Appends a new "Totals" row to the end of the Invoice table that is passed in
/// and sums up the Net Cost of Invoices column as well as storing the total Costs of Sales
/// into the class wide variable for use with other functions.
/// </summary>
/// <param name="invoiceTable">The Invoice table to summed.</param>
/// <returns></returns>
private DataTable SumCostOfSales(DataTable invoiceTable)
{
//Check for a null parameter OR if the column count is less then six (6) as any less means the database isn't returning correctly.
if(invoiceTable == null || invoiceTable.Columns.Count < 6) return invoiceTable;
double costOfSalesSum = 0;
for (var i = 0; i < invoiceTable.Rows.Count; i++)
{
costOfSalesSum += Convert.ToDouble(invoiceTable.Rows[i][4]);
}
_gCostOfSalesCalculatedTotal = costOfSalesSum;
object[] invoiceTotalRow = new object[invoiceTable.Columns.Count];
invoiceTotalRow[0] = "Total Purchases";
invoiceTotalRow[4] = costOfSalesSum;
invoiceTable.Rows.Add(invoiceTotalRow);
return invoiceTable;
}
private void showHideConsoleHelpMainMenu_Click(object sender, EventArgs e)
{
if (_console.IsVisable)
{
_console.Hide();
}
else
{
_console.Show();
}
}
/// <summary>
/// Grabs all dates from the database and splits the returned strings
/// into months, days, and years and stores them in their respective
/// combo boxes to display to the user. Also stores the list of dates
/// inside a class wide variable.
/// </summary>
private void FillDateSuggestionComboBoxes()
{
//Create a connection to the database retrieval class.
var dbReader = new RetrieveFromDatabase();
//Grab the most recent date in the database.
var mostRecentDateTime = dbReader.ReturnMostRecentDateString();
var mostRecentDateString = mostRecentDateTime.ToString("MM/dd/yyyy");
//Check to see if the return value is null and IF so log the error and return.
if(mostRecentDateString == ""){ _console.WriteToLog(LogConsole.Level.Error, "No dates could be found in the database."); return;}
//Otherwise, if there was a return date, split it into a array.
var mostRecentDateParts = mostRecentDateString.Split('/');
//Grab only the most recent years in the database (only say 2015) and fill a table with the dates. Indexes are as follows: [0] is Month, [1] is Day and [2] is Year.
DataTable oneYearDatesTable = dbReader.ReturnDateStringsLike(mostRecentDateParts[0] + "/" + mostRecentDateParts[1] + "/" + mostRecentDateParts[2]);
//Suspend the control's drawing so the user doesn't see any ugly enumeration and index changing.
DrawingControl.SuspendDrawing(dateSelectorPanel);
//Considering there was a return value for the most recent date, its safe to assume there is at least one date in the database, so clear the class's date collection.
_gDateStringCollection.Clear();
monthComboBox.Items.Clear();
dayComboBox.Items.Clear();
yearComboBox.Items.Clear();
monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation;
yearComboBox.SelectedIndexChanged -= UpdateDaysOfMonthByYear;
//Now spin through the oneYearDatesTable and fill the class wide object with all the dates for the most recent year.
for (var i = 0; i < oneYearDatesTable.Rows.Count; i ++)
{
var fullDateTime = (DateTime) oneYearDatesTable.Rows[i][0];
var fullDateString = fullDateTime.ToString("MM/dd/yyyy");
//Check for nulls just to be paranoid.
if (fullDateString == "")
{
return;
}
//IF the date string collection already contains the date, then continue to the next iteration.
if (_gDateStringCollection.Contains(fullDateString))
{
continue;
}
_gDateStringCollection.Add(fullDateString);
}
var dayBasedOnMonthAndYeaRegex = new Regex("^0?" + mostRecentDateParts[0] + @"/\d{2}/" + mostRecentDateParts[2]);
var monthBasedOnYearRegex = new Regex(@"^\d{2}/\d{2}/" + mostRecentDateParts[2]);
for (var i = 0; i < _gDateStringCollection.Count; i++)
{
string[] dateArray = _gDateStringCollection[i].Split('/');
var month = dateArray[0];
var day =dateArray[1];
if (dayBasedOnMonthAndYeaRegex.IsMatch(_gDateStringCollection[i]))
{
dayComboBox.Items.Add(day);
}
if (monthBasedOnYearRegex.IsMatch(_gDateStringCollection[i]))
{
if (!monthComboBox.Items.Contains(month))
{
monthComboBox.Items.Add(month);
}
}
}
var yearsInDatabase = dbReader.ReturnUniqueYearsList();
foreach (var year in yearsInDatabase)
{
yearComboBox.Items.Add(year);
}
if (dayComboBox.Items.Count >= 1 && yearComboBox.Items.Count >= 1 && monthComboBox.Items.Count >= 1)
{
monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1;
dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1;
yearComboBox.SelectedIndex = yearComboBox.Items.Count - 1;
monthComboBox.Enabled = true;
dayComboBox.Enabled = true;
yearComboBox.Enabled = true;
}
else
{
monthComboBox.Enabled = false;
dayComboBox.Enabled = false;
yearComboBox.Enabled = false;
}
monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation;
yearComboBox.SelectedIndexChanged += UpdateDaysOfMonthByYear;
DrawingControl.ResumeDrawing(dateSelectorPanel);
}
private void UpdateDaysOfMonth(object sender, EventArgs e)
{
if (yearComboBox.SelectedIndex == -1) return;
var year = yearComboBox.SelectedItem.ToString();
var month = monthComboBox.SelectedItem.ToString();
var dateParserPattern = new Regex("^" + month + @"\/\d{2}\/" + year);
dayComboBox.Items.Clear();
for (var i = 0; i < _gDateStringCollection.Count; i++)
{
if (dateParserPattern.IsMatch(_gDateStringCollection[i]))
{
var dateArray = _gDateStringCollection[i].Split('/');
var day = dateArray[1];
dayComboBox.Items.Add(day);
}
}
if (dayComboBox.Items.Count > 0)
{
dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1;
}
CalculateProfitAnalysis();
CalculateGrossProfit();
}
/// <summary>
/// Fires when the Year combo box's index changes.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateDaysOfMonthByYear(object sender, EventArgs e)
{
//Obligatory database retrieval call...
var dbReader = new RetrieveFromDatabase();
//First, grab the year and the month from their respective combo boxes.
var year = yearComboBox.SelectedItem.ToString();
var month = monthComboBox.SelectedItem.ToString();
//Since we can more or less be certain that nothing is null, clear the current date collection.
_gDateStringCollection.Clear();
var months = dbReader.ReturnUniqueMonthsList(month + "/" + dayComboBox.SelectedItem + "/" + year);
var mostRecentMonth = months.Max();
if (mostRecentMonth.Length == 1)
{
mostRecentMonth = "0" + mostRecentMonth;
}
var selectedYearDates = dbReader.ReturnDateStringsLike(month + "/" + dayComboBox.SelectedItem + "/" + year);
for (var i = 0; i < selectedYearDates.Rows.Count; i++)
{
var trimmedDateString = (DateTime) selectedYearDates.Rows[i][0];
_gDateStringCollection.Add(trimmedDateString.ToString("MM/dd/yyyy"));
}
//Clear the month and day combo boxes and unregister their event handlers.
dayComboBox.Items.Clear();
monthComboBox.Items.Clear();
monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation;
for (var i = 0; i < _gDateStringCollection.Count; i ++)
{
var dateArray = _gDateStringCollection[i].Split('/');
month = dateArray[0];
//Declare the patterns to look for when enumerating the combo boxes.
var dayBasedOnMonthAndYeaRegex = new Regex(@"^(" + mostRecentMonth + @"\/\d{2}\/" + year + ")"); //Only allows days that are actually part of the month and year.
var day = dateArray[1];
if (dayBasedOnMonthAndYeaRegex.IsMatch(_gDateStringCollection[i]))
{
dayComboBox.Items.Add(day);
}
if (!monthComboBox.Items.Contains(month))
{
monthComboBox.Items.Add(month);
}
}
if (dayComboBox.Items.Count > 0)
{
dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1;
}
if (monthComboBox.Items.Count > 0)
{
monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1;
}
//Now re-register the event handlers
monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth;
dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation;
BuildAndFillDataGridTables(monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + year);
CalculateProfitAnalysis();
CalculateGrossProfit();
}
private string[] ParseAdSpecialRows(string groupIdentifier)
{
var groupCategory = new string[2];
var dbReader = new RetrieveFromDatabase();
var patternForOnlyPipeAndAdSpecial = new Regex(@"^\|\d{1}");
var patternForBothNumbersOnPipe = new Regex(@"^\d{1}\|\d{1}");
if (patternForOnlyPipeAndAdSpecial.IsMatch(groupIdentifier))
{
groupCategory[0] = groupIdentifier;
if (groupIdentifier[0].ToString() != "")
{
groupCategory[0] = groupCategory[0].Replace("|", "");
groupCategory[0] = dbReader.ReturnGroupNameFromGroupId(groupCategory[0]);
}
}else if (patternForBothNumbersOnPipe.IsMatch(groupIdentifier))
{
string[] temp = groupIdentifier.Split('|');
groupCategory[0] = temp[0];
groupCategory[1] = temp[1];
groupCategory[1] = dbReader.ReturnGroupNameFromGroupId(groupCategory[1]);
}
return groupCategory;
}
private void adSpecialKeyWordsToolsMainMenu_Click(object sender, EventArgs e)
{
var keyWordRegister = new frmAdSpecialRegister();
keyWordRegister.ShowDialog();
}
private void deleteRecordsMainMenu_Click(object sender, EventArgs e)
{
var frmDeleteRecord = new frmDeleteRecord();
frmDeleteRecord.ShowDialog();
FillDateSuggestionComboBoxes();
BuildAndFillDataGridTables();
CalculateProfitAnalysis();
CalculateGrossProfit();
}
}
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
class DrawingControl
{
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
private const int WM_SETREDRAW = 11;
public static void SuspendDrawing(Control parent)
{
SendMessage(parent.Handle, WM_SETREDRAW, false, 0);
}
public static void ResumeDrawing(Control parent)
{
SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
parent.Refresh();
}
}
}
File diff suppressed because it is too large Load Diff
+112
View File
@@ -0,0 +1,112 @@
namespace AdvertsingProfitControl
{
partial class frmShrink
{
/// <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.shrinkNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.realTimeShrinkLabel = new System.Windows.Forms.Label();
this.shrinkSetTitleLabel = new System.Windows.Forms.Label();
this.submitButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.shrinkNumericUpDown)).BeginInit();
this.SuspendLayout();
//
// shrinkNumericUpDown
//
this.shrinkNumericUpDown.Location = new System.Drawing.Point(99, 41);
this.shrinkNumericUpDown.Name = "shrinkNumericUpDown";
this.shrinkNumericUpDown.Size = new System.Drawing.Size(120, 26);
this.shrinkNumericUpDown.TabIndex = 0;
this.shrinkNumericUpDown.Value = new decimal(new int[] {
30,
0,
0,
0});
this.shrinkNumericUpDown.ValueChanged += new System.EventHandler(this.shrinkNumericUpDown_ValueChanged);
//
// realTimeShrinkLabel
//
this.realTimeShrinkLabel.AutoSize = true;
this.realTimeShrinkLabel.Location = new System.Drawing.Point(33, 70);
this.realTimeShrinkLabel.Name = "realTimeShrinkLabel";
this.realTimeShrinkLabel.Size = new System.Drawing.Size(253, 20);
this.realTimeShrinkLabel.TabIndex = 1;
this.realTimeShrinkLabel.Text = "Current shrink assumed to be 30%";
//
// shrinkSetTitleLabel
//
this.shrinkSetTitleLabel.AutoSize = true;
this.shrinkSetTitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.shrinkSetTitleLabel.Location = new System.Drawing.Point(12, 9);
this.shrinkSetTitleLabel.Name = "shrinkSetTitleLabel";
this.shrinkSetTitleLabel.Size = new System.Drawing.Size(303, 29);
this.shrinkSetTitleLabel.TabIndex = 2;
this.shrinkSetTitleLabel.Text = "Set Estimated Shrink Value";
//
// submitButton
//
this.submitButton.Location = new System.Drawing.Point(99, 105);
this.submitButton.Name = "submitButton";
this.submitButton.Size = new System.Drawing.Size(120, 27);
this.submitButton.TabIndex = 3;
this.submitButton.Text = "Submit";
this.submitButton.UseVisualStyleBackColor = true;
//
// frmShrink
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(328, 144);
this.Controls.Add(this.submitButton);
this.Controls.Add(this.shrinkSetTitleLabel);
this.Controls.Add(this.realTimeShrinkLabel);
this.Controls.Add(this.shrinkNumericUpDown);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(350, 200);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(350, 200);
this.Name = "frmShrink";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Set Shrink";
((System.ComponentModel.ISupportInitialize)(this.shrinkNumericUpDown)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.NumericUpDown shrinkNumericUpDown;
private System.Windows.Forms.Label realTimeShrinkLabel;
private System.Windows.Forms.Label shrinkSetTitleLabel;
private System.Windows.Forms.Button submitButton;
}
}
+25
View File
@@ -0,0 +1,25 @@
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 AdvertsingProfitControl
{
public partial class frmShrink : Form
{
public frmShrink()
{
InitializeComponent();
}
private void shrinkNumericUpDown_ValueChanged(object sender, EventArgs e)
{
realTimeShrinkLabel.Text = "Current shrink assumed to be " + shrinkNumericUpDown.Value.ToString("P");
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?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>