What I believe is the olderest, marked as 'AdvertsingProfitControl Alpha' by the folder. Only had a simple 'Add Records' form, quite incomplete.

This commit is contained in:
2021-01-28 19:53:08 -06:00
commit 58501fec36
27 changed files with 14033 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
AdvertsingProfitControl/bin
AdvertsingProfitControl/obj
+20
View File
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvertsingProfitControl", "AdvertsingProfitControl\AdvertsingProfitControl.csproj", "{4A45C665-5D02-4724-9CC5-C0C50CA44760}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4A45C665-5D02-4724-9CC5-C0C50CA44760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A45C665-5D02-4724-9CC5-C0C50CA44760}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A45C665-5D02-4724-9CC5-C0C50CA44760}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A45C665-5D02-4724-9CC5-C0C50CA44760}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file not shown.
+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
class AddRecord
{
private static string gConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=apcDatabase.accdb;Persist Security Info=False";
public AddRecord()
{
//Get database location from DBLocation class
}
public int ExecuteQuery(string query)
{
int rowsAffected = -1;
using (OleDbConnection conn = new OleDbConnection(gConnectionString))
{
try
{
OleDbCommand queryCommand = new OleDbCommand(query, conn);
conn.Open();
rowsAffected = queryCommand.ExecuteNonQuery();
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error Writing to Database");
}
}
return rowsAffected;
}
}
}
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4A45C665-5D02-4724-9CC5-C0C50CA44760}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AdvertsingProfitControl</RootNamespace>
<AssemblyName>AdvertsingProfitControl</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<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="frmAddRecord.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmAddRecord.Designer.cs">
<DependentUpon>frmAddRecord.cs</DependentUpon>
</Compile>
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.Designer.cs">
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RetrieveTables.cs" />
<Compile Include="WriteToDatabase.cs" />
<EmbeddedResource Include="frmAddRecord.resx">
<DependentUpon>frmAddRecord.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="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="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="apcDatabase.accdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AdvertsingProfitControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdvertsingProfitControl")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ddd8ea52-f3a1-4e6f-8b7e-8d9c1c19179d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+71
View File
@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AdvertsingProfitControl.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("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
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+70
View File
@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AdvertsingProfitControl.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[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"]));
}
}
}
}
@@ -0,0 +1,38 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="AdvertsingProfitControl.Properties" GeneratedClassName="Settings">
<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>
</SettingsFile>
+103
View File
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
class RetrieveTables
{
private string MostRecentDate;
public RetrieveTables()
{
if (MostRecentDate == null)
{
apcDatabaseTableAdapters.WeekEndingDateTableAdapter date = new apcDatabaseTableAdapters.WeekEndingDateTableAdapter();
MostRecentDate = date.GetMostRecentDate().ToString();
}
MostRecentDate = "1";
}
public DataTable APCProjectionSaleTable()
{
DataTable APCProjectionSaleTable = new DataTable();
apcDatabaseTableAdapters.ProjectedSalesTableAdapter APCProjectionSaleTableAdapter = new apcDatabaseTableAdapters.ProjectedSalesTableAdapter();
APCProjectionSaleTable = APCProjectionSaleTableAdapter.GetDataByProjections(MostRecentDate);
return APCProjectionSaleTable;
}
public DataTable APCActualSalesTable()
{
DataTable APCActualSalesTable = new DataTable();
apcDatabaseTableAdapters.ActualSalesTableAdapter APCActualSalesTableAdapter = new apcDatabaseTableAdapters.ActualSalesTableAdapter();
APCActualSalesTable = APCActualSalesTableAdapter.ReturnInventoryAndActualSales(MostRecentDate);
return APCActualSalesTable;
}
public string GetAdItemID(string adItemString)
{
string adItemID;
apcDatabaseTableAdapters.AdItemTableAdapter adItemTableAdapter = new apcDatabaseTableAdapters.AdItemTableAdapter();
adItemID = adItemTableAdapter.ReturnAddItemIDByItemString(adItemString).Rows[0][0].ToString();
return adItemID;
}
public DataGridView WICTable()
{
DataGridView wicTable = new DataGridView();
apcDatabaseTableAdapters.WeekEndingDateTableAdapter weekEndingTableAdapter = new apcDatabaseTableAdapters.WeekEndingDateTableAdapter();
wicTable.DataSource = weekEndingTableAdapter.ReturnWICTable("1");
return wicTable;
}
public string[] Comment()
{
DataGridView commentTable = new DataGridView();
List<String> comments = new List<string>();
apcDatabaseTableAdapters.CommentTableAdapter commentsTableAdapter = new apcDatabaseTableAdapters.CommentTableAdapter();
commentTable.DataSource = commentsTableAdapter.GetDataByDateID(MostRecentDate);
if (commentTable.Rows.Count > 0)
{
string[] finalCommentArray = new String[commentTable.Rows.Count];
for (int i = 0; i < commentTable.Rows.Count; i++)
{
finalCommentArray[i] = Convert.ToString(commentTable.Rows[i].Cells[0].Value);
comments.Add(finalCommentArray[i]);
}
return finalCommentArray;
}
else
{
comments.Add("No comments to display for the week ending on " + Date());
return comments.ToArray();
}
}
public string Date()
{
string dateString;
apcDatabaseTableAdapters.WeekEndingDateTableAdapter weekEnding = new apcDatabaseTableAdapters.WeekEndingDateTableAdapter();
DateTime dateTime = new DateTime();
dateTime = (DateTime)weekEnding.ReturnDate(MostRecentDate).Rows[0][1];
dateString = dateTime.ToLongDateString();
return dateString;
}
public string DateID(string dateString)
{
apcDatabaseTableAdapters.WeekEndingDateTableAdapter weekEnding = new apcDatabaseTableAdapters.WeekEndingDateTableAdapter();
string dateID;
dateID = weekEnding.ReturnDateIDByDateString(dateString).Rows[0][0].ToString();
return dateID;
}
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
namespace AdvertsingProfitControl
{
class WriteToDatabase
{
public void InsertIntoActualSales(string[] parameters, string conn)
{
using (OleDbConnection connection = new OleDbConnection(conn))
{
string sqlInsert = "INSERT INTO ActualSales(AcSold, AcSalePrice, AcTotalSales, AcCost, AcProfitReturn, AcTotalProfitReturn, FK_AdItemID, FK_DateID) VALUES (@sold, @salesPrice, @totalSales, @cost, @profitReturn, @toalProfitReturn, @adItemID, @dateID)";
OleDbCommand command = new OleDbCommand(sqlInsert, connection);
command.Parameters.AddWithValue("@sold", parameters[0]);
command.Parameters.AddWithValue("@salesPrice", parameters[1]);
command.Parameters.AddWithValue("@totalSales", parameters[2]);
command.Parameters.AddWithValue("@cost", parameters[3]);
command.Parameters.AddWithValue("@profitReturn", parameters[4]);
command.Parameters.AddWithValue("@totalProfitReturn", parameters[5]);
command.Parameters.AddWithValue("@adItemID", parameters[6]);
command.Parameters.AddWithValue("@dateID", parameters[7]);
try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error Writing to Database");
}
}
}
public void InsertIntoAdItems(string[] parameters, string conn)
{
}
public void InsertIntoComment(string[] parameters, string conn)
{
}
public void InsertIntoInventory(string[] parameters, string conn)
{
using (OleDbConnection connection = new OleDbConnection(conn))
{
string sql = "INSERT INTO Inventory(InvBeginingInventory, InvRecieved, InvTotal, InvEnding, Fk_AditemID, Fk_DateID) VALUES (@begining, @recieved, @total, @ending, @adItem, @dateID)";
OleDbCommand command = new OleDbCommand(sql, connection);
command.Parameters.AddWithValue("@begining", parameters[0]);
command.Parameters.AddWithValue("@recieved", parameters[1]);
command.Parameters.AddWithValue("@total", parameters[2]);
command.Parameters.AddWithValue("@ending", parameters[3]);
command.Parameters.AddWithValue("@adItem", parameters[4]);
command.Parameters.AddWithValue("@dateID", parameters[5]);
try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error Writing to Database");
}
}
}
public void InsertIntoInvoice(string[] parameters, string conn)
{
}
public void InsertIntoProjectedSales(string[] parameters, string conn)
{
}
public void InsertIntoSupplier(string[] parameters, string conn)
{
}
public void InsertIntoWeekEndingDate(string[] parameters, string conn)
{
}
public void InsertIntoWeeklySales(string[] parameters, string conn)
{
}
}
}
File diff suppressed because it is too large Load Diff
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
namespace AdvertsingProfitControl {
public partial class apcDatabase {
}
}
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TableUISettings />
</DataSetUISetting>
File diff suppressed because it is too large Load Diff
+105
View File
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool to store the dataset designer's layout information.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-22" ViewPortY="52" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:ActualSales" ZOrder="2" X="385" Y="62" Height="305" Width="275" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
<Shape ID="DesignTable:AdItem" ZOrder="15" X="783" Y="132" Height="153" Width="187" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:Comment" ZOrder="14" X="385" Y="986" Height="172" Width="201" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
<Shape ID="DesignTable:Inventory" ZOrder="1" X="389" Y="397" Height="267" Width="201" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="178" />
<Shape ID="DesignTable:Invoice" ZOrder="13" X="385" Y="1190" Height="229" Width="186" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="178" />
<Shape ID="DesignTable:ProjectedSales" ZOrder="3" X="369" Y="707" Height="267" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
<Shape ID="DesignTable:Supplier" ZOrder="12" X="641" Y="1190" Height="115" Width="193" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:WeekEndingDate" ZOrder="11" X="15" Y="73" Height="134" Width="295" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:WeeklySales" ZOrder="10" X="385" Y="1489" Height="305" Width="216" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="216" />
</Shapes>
<Connectors>
<Connector ID="DesignRelation:AdItemActualSales" ZOrder="9" LineWidth="11">
<RoutePoints>
<Point>
<X>783</X>
<Y>181</Y>
</Point>
<Point>
<X>660</X>
<Y>181</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:WeekEndingDateActualSales" ZOrder="8" LineWidth="11">
<RoutePoints>
<Point>
<X>310</X>
<Y>122</Y>
</Point>
<Point>
<X>385</X>
<Y>122</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:WeekEndingDateComment" ZOrder="7" LineWidth="11">
<RoutePoints>
<Point>
<X>227</X>
<Y>207</Y>
</Point>
<Point>
<X>227</X>
<Y>1003</Y>
</Point>
<Point>
<X>385</X>
<Y>1003</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:SupplierInvoice" ZOrder="6" LineWidth="11">
<RoutePoints>
<Point>
<X>641</X>
<Y>1247</Y>
</Point>
<Point>
<X>571</X>
<Y>1247</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:WeekEndingDateInvoice" ZOrder="5" LineWidth="11">
<RoutePoints>
<Point>
<X>219</X>
<Y>207</Y>
</Point>
<Point>
<X>219</X>
<Y>1207</Y>
</Point>
<Point>
<X>385</X>
<Y>1207</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:WeekEndingDateWeeklySales" ZOrder="4" LineWidth="11">
<RoutePoints>
<Point>
<X>211</X>
<Y>207</Y>
</Point>
<Point>
<X>211</X>
<Y>1506</Y>
</Point>
<Point>
<X>385</X>
<Y>1506</Y>
</Point>
</RoutePoints>
</Connector>
</Connectors>
</DiagramLayout>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<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>
+210
View File
@@ -0,0 +1,210 @@
namespace AdvertsingProfitControl
{
partial class frmAddRecord
{
/// <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.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();
this.SuspendLayout();
//
// addRecordMainTableLayoutPanel
//
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;
//
// addRecordMainTabControl
//
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;
//
// APCTabPage
//
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;
//
// addRecordAPCMainDataGridView
//
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;
//
// WICTabPage
//
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;
//
// addRecordWICMainDataGridView
//
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;
//
// addRecordMainMenu
//
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";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 21);
this.fileToolStripMenuItem.Text = "&File";
//
// editAddRecordMainMenu
//
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";
//
// addRecEditAddRecordMainMenu
//
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);
//
// textBoxMenu
//
this.textBoxMenu.Name = "textBoxMenu";
this.textBoxMenu.Size = new System.Drawing.Size(100, 21);
//
// dateMaskedTextBox
//
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);
//
// frmAddRecord
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
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.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.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;
}
}
+223
View File
@@ -0,0 +1,223 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace AdvertsingProfitControl
{
public partial class frmAddRecord : Form
{
public frmAddRecord()
{
InitializeComponent();
}
private void frmAddRecord_Load(object sender, EventArgs e)
{
ConstructForm();
//addRecordAPCMainDataGridView.UserAddedRow += CheckForGroupedItems;
addRecordAPCMainDataGridView.RowLeave += CheckForGroupedItems;
//addRecordAPCMainDataGridView.UserDeletedRow += CheckForGroupedItems;
}
void addRecordAPCMainDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
bool isGroupMember = false;
textBoxMenu.Text = e.RowIndex.ToString() + ", " + e.ColumnIndex.ToString();
foreach (DataGridViewCell cell in addRecordAPCMainDataGridView.Rows[e.RowIndex].Cells)
{
if (cell.ColumnIndex > 0 && cell.Value != null || cell.ColumnIndex > 0 && cell.EditedFormattedValue != null)
{
isGroupMember = false;
break;
}
else if (cell.ColumnIndex == 0 && cell.Value != null || cell.ColumnIndex > 0 && cell.EditedFormattedValue != null)
{
isGroupMember = true;
}
else
{
isGroupMember = true;
}
}
if (isGroupMember)
{
if (addRecordAPCMainDataGridView.Rows[e.RowIndex - 1].DefaultCellStyle.BackColor != Color.LightBlue)
{
addRecordAPCMainDataGridView.Rows[e.RowIndex - 1].DefaultCellStyle.BackColor = Color.LightBlue;
addRecordAPCMainDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightBlue;
}
else
{
addRecordAPCMainDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
else
{
addRecordAPCMainDataGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
}
}
private void CheckForGroupedItems(object sender, DataGridViewCellEventArgs e)
{
}
private void RowsRemovedEvent(object sender, DataGridViewRowsRemovedEventArgs e)
{
}
private void RowAddedEvent(object sender, DataGridViewRowsAddedEventArgs e)
{
}
private void ConstructForm()
{
string[] columnNames = { "AdItem", "PrSold", "PrSalePrice", "PrTotalSales", "PrCost", "PrProfitReturn", "PrTotalProfitReturn", "InvBeginingInventory", "InvReceived", "InvTotal", "InvEndingInventory", "AcSold", "AcSalePrice", "AcTotalSales", "AcCost", "AcProfitReturn", "AcTotalProfitReturn"};
string[] columnHeaderText = { "Ad Item", "Sold", "Sale Price", "Total Sales", "Cost", "Profit Return", "Total Profit Returned", "Beginning Inventory", "Received", "Total", "Ending Inventory", "Sold", "Sale Price", "Total Sales", "Cost", "Profit Return", "Total Profit Return" };
int i = 0;
foreach (string columnName in columnNames)
{
DataGridViewColumn column = new DataGridViewTextBoxColumn();
column.Name = columnName;
column.HeaderText = columnHeaderText[i];
addRecordAPCMainDataGridView.Columns.Add(column);
i++;
}
}
private void addRecEditAddRecordMainMenu_Click(object sender, EventArgs e)
{
if (dateMaskedTextBox.MaskCompleted)
{
AddRecordToDatabase();
}
else
{
MessageBox.Show("Please enter a date.");
}
}
private void AddRecordToDatabase()
{
RetrieveTables tableData = new RetrieveTables();
List<String> projectedTableData = new List<string>();
List<String> actualTableData = new List<string>();
List<String> inventoryTableData = new List<string>();
List<String> comments = new List<string>();
string adItemID = "";
int columnIndex = 0;
int rowIndex = 0;
string dateID = tableData.DateID(dateMaskedTextBox.Text);
foreach (DataGridViewRow row in addRecordAPCMainDataGridView.Rows)
{
columnIndex = 0;
foreach (DataGridViewColumn column in addRecordAPCMainDataGridView.Columns)
{
if (column.Name == "AdItem")
{
try
{
adItemID = tableData.GetAdItemID(addRecordAPCMainDataGridView[columnIndex, rowIndex].Value.ToString());
}
catch { MessageBox.Show("Please specify an ad item in row " + rowIndex.ToString() + ".", "No Ad Item"); return; }
}
else if (column.Name.StartsWith("Pr"))
{
try
{
projectedTableData.Add(addRecordAPCMainDataGridView[columnIndex, rowIndex].Value.ToString());
}
catch { projectedTableData.Add("0"); }
}
else if (column.Name.StartsWith("Inv"))
{
try
{
inventoryTableData.Add(addRecordAPCMainDataGridView[columnIndex, rowIndex].Value.ToString());
}
catch { inventoryTableData.Add("0"); }
}
else if (column.Name.StartsWith("Ac"))
{
try
{
actualTableData.Add(addRecordAPCMainDataGridView[columnIndex, rowIndex].Value.ToString());
}
catch { actualTableData.Add("0"); }
}
else if (column.Name == "comments")
{
try
{
comments.Add(addRecordAPCMainDataGridView[columnIndex, rowIndex].Value.ToString());
}
catch { comments.Add(""); }
}
columnIndex++;
}
AddToDataBase(projectedTableData, dateID, adItemID, "ProjectedSales");
AddToDataBase(actualTableData, dateID, adItemID, "ActualSales");
AddToDataBase(inventoryTableData, dateID, adItemID, "Inventory");
AddToDataBase(comments, dateID, adItemID, "Comment");
rowIndex++;
}
}
private void AddToDataBase(List<String> values, string dateID, string adItemID, string table)
{
int i = 0;
int length = values.Count;
AddRecord addRecord = new AddRecord();
string insertValues = "(";
foreach (string parameter in values)
{
if (length == 1 || length == 0)
{
if (length == 0)
{
return;
}
else
{
insertValues += "'" + parameter + "')";
}
}
else
{
if (i < length && i == 0)
{
insertValues += "'" + parameter + "'";
}
else if (i == length - 1)
{
insertValues += ", '" + parameter + "', '" + adItemID + "', '" + dateID + "')";
}
else if (i < length && i != 0)
{
insertValues += ", '" + parameter + "'";
}
}
i++;
}
MessageBox.Show(insertValues);
insertValues = @"INSERT INTO " + table + " VALUES " + insertValues;
addRecord.ExecuteQuery(insertValues);
}
}
}
+123
View File
@@ -0,0 +1,123 @@
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="addRecordMainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+344
View File
@@ -0,0 +1,344 @@
namespace AdvertsingProfitControl
{
partial class frmMain
{
/// <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.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.commentMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.commentMainGroupBox = new System.Windows.Forms.GroupBox();
this.commentsMainLabel = new System.Windows.Forms.Label();
this.profitAnalysisMainGroupBox = new System.Windows.Forms.GroupBox();
this.costOfSalesMainGroupBox = new System.Windows.Forms.GroupBox();
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.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.mainTableLayoutPanel.SuspendLayout();
this.mainMenu.SuspendLayout();
this.commentMainTableLayoutPanel.SuspendLayout();
this.commentMainGroupBox.SuspendLayout();
this.mainViewTabControl.SuspendLayout();
this.projectionTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.projectedSalesMainDataGrid)).BeginInit();
this.actualSalesInvTab.SuspendLayout();
this.actualSalesMainLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.actualSalesInvMainDataGidView)).BeginInit();
this.weeklyInventoryControlTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklyInventoryMainDataGrid)).BeginInit();
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.commentMainTableLayoutPanel, 0, 2);
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.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.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.TabIndex = 0;
//
// mainMenu
//
this.mainMenu.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMainMenu,
this.editToolStripMenuItem});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Size = new System.Drawing.Size(934, 25);
this.mainMenu.TabIndex = 1;
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(37, 21);
this.fileMainMenu.Text = "&File";
//
// exitFileMainMenu
//
this.exitFileMainMenu.Name = "exitFileMainMenu";
this.exitFileMainMenu.Size = new System.Drawing.Size(152, 22);
this.exitFileMainMenu.Text = "E&xit";
//
// editToolStripMenuItem
//
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";
//
// addRecordToolStripMenuItem
//
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);
//
// 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.Controls.Add(this.commentMainGroupBox, 0, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.profitAnalysisMainGroupBox, 1, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.costOfSalesMainGroupBox, 2, 0);
this.commentMainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(3, 344);
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.TabIndex = 2;
//
// commentMainGroupBox
//
this.commentMainGroupBox.Controls.Add(this.commentsMainLabel);
this.commentMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentMainGroupBox.Location = new System.Drawing.Point(3, 3);
this.commentMainGroupBox.Name = "commentMainGroupBox";
this.commentMainGroupBox.Size = new System.Drawing.Size(226, 159);
this.commentMainGroupBox.TabIndex = 0;
this.commentMainGroupBox.TabStop = false;
this.commentMainGroupBox.Text = "Comments";
//
// commentsMainLabel
//
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;
//
// profitAnalysisMainGroupBox
//
this.profitAnalysisMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(235, 3);
this.profitAnalysisMainGroupBox.Name = "profitAnalysisMainGroupBox";
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(342, 159);
this.profitAnalysisMainGroupBox.TabIndex = 1;
this.profitAnalysisMainGroupBox.TabStop = false;
this.profitAnalysisMainGroupBox.Text = "Profit Analysis";
//
// costOfSalesMainGroupBox
//
this.costOfSalesMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.costOfSalesMainGroupBox.Location = new System.Drawing.Point(583, 3);
this.costOfSalesMainGroupBox.Name = "costOfSalesMainGroupBox";
this.costOfSalesMainGroupBox.Size = new System.Drawing.Size(342, 159);
this.costOfSalesMainGroupBox.TabIndex = 2;
this.costOfSalesMainGroupBox.TabStop = false;
this.costOfSalesMainGroupBox.Text = "Cost of Sales";
//
// mainViewTabControl
//
this.mainViewTabControl.Controls.Add(this.projectionTab);
this.mainViewTabControl.Controls.Add(this.actualSalesInvTab);
this.mainViewTabControl.Controls.Add(this.weeklyInventoryControlTab);
this.mainViewTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainViewTabControl.Location = new System.Drawing.Point(3, 28);
this.mainViewTabControl.Name = "mainViewTabControl";
this.mainViewTabControl.SelectedIndex = 0;
this.mainViewTabControl.Size = new System.Drawing.Size(928, 310);
this.mainViewTabControl.TabIndex = 3;
//
// projectionTab
//
this.projectionTab.Controls.Add(this.projectedSalesMainDataGrid);
this.projectionTab.Location = new System.Drawing.Point(4, 22);
this.projectionTab.Name = "projectionTab";
this.projectionTab.Padding = new System.Windows.Forms.Padding(3);
this.projectionTab.Size = new System.Drawing.Size(920, 284);
this.projectionTab.TabIndex = 0;
this.projectionTab.Text = "Projection";
this.projectionTab.UseVisualStyleBackColor = true;
//
// projectedSalesMainDataGrid
//
this.projectedSalesMainDataGrid.AllowUserToAddRows = false;
this.projectedSalesMainDataGrid.AllowUserToDeleteRows = false;
this.projectedSalesMainDataGrid.AllowUserToResizeRows = false;
this.projectedSalesMainDataGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
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.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.TabIndex = 0;
//
// actualSalesInvTab
//
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;
//
// 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.Dock = System.Windows.Forms.DockStyle.Fill;
this.actualSalesMainLayoutPanel.Location = new System.Drawing.Point(0, 0);
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.TabIndex = 0;
//
// actualSalesInvMainDataGidView
//
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;
//
// weeklyInventoryControlTab
//
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;
//
// weeklyInventoryMainDataGrid
//
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;
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(934, 512);
this.Controls.Add(this.mainTableLayoutPanel);
this.MaximizeBox = false;
this.Name = "frmMain";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Advertising Profit Control - Main";
this.Load += new System.EventHandler(this.frmMain_Load);
this.mainTableLayoutPanel.ResumeLayout(false);
this.mainTableLayoutPanel.PerformLayout();
this.mainMenu.ResumeLayout(false);
this.mainMenu.PerformLayout();
this.commentMainTableLayoutPanel.ResumeLayout(false);
this.commentMainGroupBox.ResumeLayout(false);
this.commentMainGroupBox.PerformLayout();
this.mainViewTabControl.ResumeLayout(false);
this.projectionTab.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.projectedSalesMainDataGrid)).EndInit();
this.actualSalesInvTab.ResumeLayout(false);
this.actualSalesMainLayoutPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.actualSalesInvMainDataGidView)).EndInit();
this.weeklyInventoryControlTab.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.weeklyInventoryMainDataGrid)).EndInit();
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.TableLayoutPanel commentMainTableLayoutPanel;
private System.Windows.Forms.GroupBox commentMainGroupBox;
private System.Windows.Forms.GroupBox profitAnalysisMainGroupBox;
private System.Windows.Forms.GroupBox costOfSalesMainGroupBox;
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.TableLayoutPanel actualSalesMainLayoutPanel;
private System.Windows.Forms.DataGridView actualSalesInvMainDataGidView;
private System.Windows.Forms.DataGridView projectedSalesMainDataGrid;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addRecordToolStripMenuItem;
}
}
+169
View File
@@ -0,0 +1,169 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.OleDb;
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";
public frmMain()
{
InitializeComponent();
}
private void frmMain_Load(object sender, EventArgs e)
{
//connect to the database on form load | eh?
BuildUITables();
addRecordToolStripMenuItem.PerformClick();
}
/// <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.
/// </summary>
/// <param name="dataGrid"></param>
private void ReorderDataGridView(DataGridView dataGrid)
{
foreach (DataGridViewColumn column in dataGrid.Columns)
{
if (!column.Name.Contains("ID"))
{
switch (column.Name.ToLower())
{
//---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;
}
}
else
{
//The column was an ID field therefore we won't bother showing it to the user.
column.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)
{
commentsMainLabel.Text = comment + "\n";
}
}
private void addRecordToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAddRecord recordForm = new frmAddRecord();
recordForm.ShowDialog();
BuildUITables();
}
}
}
+123
View File
@@ -0,0 +1,123 @@
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+18
View File
@@ -0,0 +1,18 @@
This program is one I wrote when I was still working in the produce department in my free time. My boss at the time wanted a program
to archive the contents of a sheet that he would get every week to show how the department was doing. This sheet was called
the Advertising Profit Control. As you may guess, this would show how items that were in that week's ad were selling. However, this
program was not my idea, my dad, while hanging with my boss one day, actually mentioned that I'd be able to build such a program.
When I was asked if I could do it by my boss I said "Yeah sounds like it'd be a cool project." And a day or two later I grabbed
a blank Advertising Profit Control sheet, had hime explain how it all works, and got to work. This was purely a personal project
with no other compensation than what I learned along the way and also something to show potential employers. That said, I had a
lot of fun building this program out.
I've decided to archive the oldest version of the code. This was before I even knew what Git was so what's been saved is only
manual backups. I tried to piece them together in order as best I could, but I wanted to archive this.
This project is broken up into three parts:
1. This part (Pre-alpha as I'll call it)
2. advertisingprofitcontrol-alpha (which has more complete code, but is before my transition to Entity Framework)
3. advertisingprofitcontrol (which contains the final, and complete code)
I say "final" just because any left over bugs and planned features are never gonna happen. This project is quite abandoned.