First version of the Main form that is able to pull all the required data from the SQL database. Holiday detection is disabled for this build. Fixed some bugs with the debug database conversion code. Still missing Ad Special data in the conversion code.

This commit is contained in:
2017-03-27 14:39:42 -05:00
parent 36fe75d761
commit 9da9540969
39 changed files with 104913 additions and 871 deletions
Binary file not shown.
Binary file not shown.
+41
View File
@@ -0,0 +1,41 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class ActualSale
{
public int Id { get; set; }
[StringLength(128)]
public string Sold { get; set; }
[StringLength(128)]
public string SalePrice { get; set; }
public decimal? TotalSales { get; set; }
public decimal? Cost { get; set; }
public decimal? ProfitReturn { get; set; }
public decimal? TotalProfitReturn { get; set; }
public int RowPosition { get; set; }
public int RowAttribute { get; set; }
public int FkAdItemId { get; set; }
public int FkAdSpecialId { get; set; }
public int FkDateId { get; set; }
public virtual AdItem AdItem { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+37
View File
@@ -0,0 +1,37 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class AdItem
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public AdItem()
{
ActualSales = new HashSet<ActualSale>();
Inventories = new HashSet<Inventory>();
Projections = new HashSet<Projection>();
}
public int Id { get; set; }
[Required]
[StringLength(256)]
public string Name { get; set; }
[StringLength(256)]
public string Description { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<ActualSale> ActualSales { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Inventory> Inventories { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Projection> Projections { get; set; }
}
}
+20
View File
@@ -0,0 +1,20 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class AdSpecial
{
public int Id { get; set; }
[Required]
[StringLength(256)]
public string Name { get; set; }
[StringLength(256)]
public string Description { get; set; }
}
}
@@ -0,0 +1,292 @@
namespace AdvertsingProfitControl
{
using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
public partial class AdvertisingProfitControlModel : DbContext
{
public AdvertisingProfitControlModel()
: base("name=AdvertisingProfitControlContext")
{
}
public virtual DbSet<ActualSale> ActualSales { get; set; }
public virtual DbSet<AdItem> AdItems { get; set; }
public virtual DbSet<AdSpecial> AdSpecials { get; set; }
public virtual DbSet<CostAnalysi> CostAnalysis { get; set; }
public virtual DbSet<Inventory> Inventories { get; set; }
public virtual DbSet<Invoice> Invoices { get; set; }
public virtual DbSet<Note> Notes { get; set; }
public virtual DbSet<Projection> Projections { get; set; }
public virtual DbSet<Supplier> Suppliers { get; set; }
public virtual DbSet<Taxable> Taxables { get; set; }
public virtual DbSet<Version> Versions { get; set; }
public virtual DbSet<WeekEndingDate> WeekEndingDates { get; set; }
public virtual DbSet<WeeklySale> WeeklySales { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<ActualSale>()
.Property(e => e.Sold)
.IsUnicode(false);
modelBuilder.Entity<ActualSale>()
.Property(e => e.SalePrice)
.IsUnicode(false);
modelBuilder.Entity<ActualSale>()
.Property(e => e.TotalSales)
.HasPrecision(19, 2);
modelBuilder.Entity<ActualSale>()
.Property(e => e.Cost)
.HasPrecision(19, 2);
modelBuilder.Entity<ActualSale>()
.Property(e => e.ProfitReturn)
.HasPrecision(19, 2);
modelBuilder.Entity<ActualSale>()
.Property(e => e.TotalProfitReturn)
.HasPrecision(19, 2);
modelBuilder.Entity<AdItem>()
.Property(e => e.Name)
.IsUnicode(false);
modelBuilder.Entity<AdItem>()
.Property(e => e.Description)
.IsUnicode(false);
modelBuilder.Entity<AdItem>()
.HasMany(e => e.ActualSales)
.WithRequired(e => e.AdItem)
.HasForeignKey(e => e.FkAdItemId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<AdItem>()
.HasMany(e => e.Inventories)
.WithRequired(e => e.AdItem)
.HasForeignKey(e => e.FkAdItemId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<AdItem>()
.HasMany(e => e.Projections)
.WithRequired(e => e.AdItem)
.HasForeignKey(e => e.FkAdItemId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<AdSpecial>()
.Property(e => e.Name)
.IsUnicode(false);
modelBuilder.Entity<AdSpecial>()
.Property(e => e.Description)
.IsUnicode(false);
modelBuilder.Entity<CostAnalysi>()
.Property(e => e.SalesPerManHour)
.HasPrecision(19, 2);
modelBuilder.Entity<CostAnalysi>()
.Property(e => e.SalaryPercentage)
.HasPrecision(19, 2);
modelBuilder.Entity<CostAnalysi>()
.Property(e => e.SalaryDollar)
.HasPrecision(19, 2);
modelBuilder.Entity<CostAnalysi>()
.Property(e => e.Supplies)
.HasPrecision(19, 2);
modelBuilder.Entity<Inventory>()
.Property(e => e.BeginningInventory)
.IsUnicode(false);
modelBuilder.Entity<Inventory>()
.Property(e => e.Recieved)
.IsUnicode(false);
modelBuilder.Entity<Inventory>()
.Property(e => e.TotalInventory)
.IsUnicode(false);
modelBuilder.Entity<Inventory>()
.Property(e => e.EndingInventory)
.IsUnicode(false);
modelBuilder.Entity<Invoice>()
.Property(e => e.InvoiceNetAmountAtCost)
.HasPrecision(19, 2);
modelBuilder.Entity<Invoice>()
.Property(e => e.InvoiceNetAmount)
.HasPrecision(19, 2);
modelBuilder.Entity<Invoice>()
.Property(e => e.InvoiceNote)
.IsUnicode(false);
modelBuilder.Entity<Note>()
.Property(e => e.Remark)
.IsUnicode(false);
modelBuilder.Entity<Projection>()
.Property(e => e.Sold)
.IsUnicode(false);
modelBuilder.Entity<Projection>()
.Property(e => e.SalePrice)
.IsUnicode(false);
modelBuilder.Entity<Projection>()
.Property(e => e.TotalSales)
.HasPrecision(19, 2);
modelBuilder.Entity<Projection>()
.Property(e => e.Cost)
.HasPrecision(19, 2);
modelBuilder.Entity<Projection>()
.Property(e => e.ProfitReturn)
.HasPrecision(19, 2);
modelBuilder.Entity<Projection>()
.Property(e => e.TotalProfitReturn)
.HasPrecision(19, 2);
modelBuilder.Entity<Supplier>()
.Property(e => e.Name)
.IsUnicode(false);
modelBuilder.Entity<Supplier>()
.Property(e => e.Description)
.IsUnicode(false);
modelBuilder.Entity<Supplier>()
.HasMany(e => e.Invoices)
.WithRequired(e => e.Supplier)
.HasForeignKey(e => e.FkSupplierId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<Taxable>()
.Property(e => e.Sunday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Monday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Tuesday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Wednesday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Thursday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Friday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Saturday)
.HasPrecision(19, 2);
modelBuilder.Entity<Taxable>()
.Property(e => e.Total)
.HasPrecision(19, 2);
modelBuilder.Entity<Version>()
.Property(e => e.VersionNumber)
.IsUnicode(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.ActualSales)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.CostAnalysis)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.Inventories)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.Invoices)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.Notes)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.Projections)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.Taxables)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeekEndingDate>()
.HasMany(e => e.WeeklySales)
.WithRequired(e => e.WeekEndingDate)
.HasForeignKey(e => e.FkDateId)
.WillCascadeOnDelete(false);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Sunday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Monday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Tuesday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Wednesday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Thursday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Friday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.Saturday)
.HasPrecision(19, 2);
modelBuilder.Entity<WeeklySale>()
.Property(e => e.TotalSales)
.HasPrecision(19, 2);
}
}
}
@@ -54,7 +54,7 @@
<TargetZone>LocalIntranet</TargetZone> <TargetZone>LocalIntranet</TargetZone>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<GenerateManifests>true</GenerateManifests> <GenerateManifests>false</GenerateManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup /> <PropertyGroup />
<PropertyGroup> <PropertyGroup>
@@ -82,6 +82,14 @@
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlRenderer, Version=1.5.0.6, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="HtmlRenderer, Version=1.5.0.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.Core.1.5.0.6\lib\net45\HtmlRenderer.dll</HintPath> <HintPath>..\packages\HtmlRenderer.Core.1.5.0.6\lib\net45\HtmlRenderer.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@@ -92,11 +100,14 @@
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Deployment" /> <Reference Include="System.Deployment" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Transactions" /> <Reference Include="System.Transactions" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
@@ -104,9 +115,13 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AdItemCollectionModel.cs" /> <Compile Include="ActualSale.cs" />
<Compile Include="AdItem.cs" />
<Compile Include="AdSpecial.cs" />
<Compile Include="AdvertisingProfitControlModel.cs" />
<Compile Include="AdvertisingProfitControlTableHelper.cs" /> <Compile Include="AdvertisingProfitControlTableHelper.cs" />
<Compile Include="ApplicationColors.cs" /> <Compile Include="ApplicationColors.cs" />
<Compile Include="CostAnalysi.cs" />
<Compile Include="DbTableWriterStatus.cs" /> <Compile Include="DbTableWriterStatus.cs" />
<Compile Include="DbWriterStatus.cs" /> <Compile Include="DbWriterStatus.cs" />
<Compile Include="DebugDatabaseConverter.cs"> <Compile Include="DebugDatabaseConverter.cs">
@@ -116,12 +131,18 @@
<DependentUpon>DebugDatabaseConverter.cs</DependentUpon> <DependentUpon>DebugDatabaseConverter.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Holiday.cs" /> <Compile Include="Holiday.cs" />
<Compile Include="Inventory.cs" />
<Compile Include="Invoice.cs" />
<Compile Include="NewModifyRecord.cs"> <Compile Include="NewModifyRecord.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="NewModifyRecord.Designer.cs"> <Compile Include="NewModifyRecord.Designer.cs">
<DependentUpon>NewModifyRecord.cs</DependentUpon> <DependentUpon>NewModifyRecord.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Note.cs" />
<Compile Include="Projection.cs" />
<Compile Include="Supplier.cs" />
<Compile Include="Taxable.cs" />
<Compile Include="TextFormat.cs" /> <Compile Include="TextFormat.cs" />
<Compile Include="BackPageGenerator.cs" /> <Compile Include="BackPageGenerator.cs" />
<Compile Include="DatabaseReader.cs" /> <Compile Include="DatabaseReader.cs" />
@@ -163,6 +184,9 @@
<Compile Include="RowParsing.cs" /> <Compile Include="RowParsing.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Version.cs" />
<Compile Include="WeekEndingDate.cs" />
<Compile Include="WeeklySale.cs" />
<EmbeddedResource Include="DebugDatabaseConverter.resx"> <EmbeddedResource Include="DebugDatabaseConverter.resx">
<DependentUpon>DebugDatabaseConverter.cs</DependentUpon> <DependentUpon>DebugDatabaseConverter.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@@ -195,6 +219,7 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="AdvertsingProfitControl_TemporaryKey.pfx" /> <None Include="AdvertsingProfitControl_TemporaryKey.pfx" />
<None Include="App.config" />
<None Include="app.manifest" /> <None Include="app.manifest" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="AdvertisingProfitControlContext" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=AdvertisingProfitControl;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /></connectionStrings>
</configuration>
+25
View File
@@ -0,0 +1,25 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class CostAnalysi
{
public int Id { get; set; }
public decimal? SalesPerManHour { get; set; }
public decimal? SalaryPercentage { get; set; }
public decimal? SalaryDollar { get; set; }
public decimal? Supplies { get; set; }
public int FkDateId { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+2 -1
View File
@@ -41,6 +41,7 @@
this.existingDatesListBox.ItemHeight = 24; this.existingDatesListBox.ItemHeight = 24;
this.existingDatesListBox.Location = new System.Drawing.Point(59, 84); this.existingDatesListBox.Location = new System.Drawing.Point(59, 84);
this.existingDatesListBox.Name = "existingDatesListBox"; this.existingDatesListBox.Name = "existingDatesListBox";
this.existingDatesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.existingDatesListBox.Size = new System.Drawing.Size(254, 316); this.existingDatesListBox.Size = new System.Drawing.Size(254, 316);
this.existingDatesListBox.TabIndex = 0; this.existingDatesListBox.TabIndex = 0;
// //
@@ -62,7 +63,7 @@
this.moveOverButton.TabIndex = 2; this.moveOverButton.TabIndex = 2;
this.moveOverButton.Text = "Move Selected"; this.moveOverButton.Text = "Move Selected";
this.moveOverButton.UseVisualStyleBackColor = true; this.moveOverButton.UseVisualStyleBackColor = true;
this.moveOverButton.Click += new System.EventHandler(this.moveOverButton_Click); this.moveOverButton.Click += new System.EventHandler(this.MoveOverButton_Click);
// //
// openFileDialog1 // openFileDialog1
// //
@@ -77,14 +77,15 @@ namespace AdvertsingProfitControl
} }
} }
private void moveOverButton_Click(object sender, EventArgs e) private void MoveOverButton_Click(object sender, EventArgs e)
{ {
if (existingDatesListBox.SelectedIndex != -1) if (existingDatesListBox.SelectedIndex == -1) return;
foreach (var index in existingDatesListBox.SelectedItems)
{ {
datesToConvertListBox.Items.Add(existingDatesListBox.SelectedItem); datesToConvertListBox.Items.Add(index);
existingDatesListBox.Items.Remove(existingDatesListBox.SelectedItem); //existingDatesListBox.Items.Remove(index);
moveOverButton.Enabled = false;
} }
moveOverButton.Enabled = false;
} }
private void convertButton_Click(object sender, EventArgs e) private void convertButton_Click(object sender, EventArgs e)
@@ -93,6 +94,25 @@ namespace AdvertsingProfitControl
{ {
return; return;
} }
//Start by bringing in all the ad items then the suppliers.
var adItems = GetAdItems();
foreach (var adItem in adItems)
{
var db = new AdvertisingProfitControlModel();
if (db.AdItems.Any(x => x.Name == adItem)) continue;
var temp = new AdItem { Name = TextFormat.FormatAdItemText(adItem) };
db.AdItems.Add(temp);
db.SaveChanges();
}
var suppliers = GetSuppliers();
foreach (var supplier in suppliers)
{
var db = new AdvertisingProfitControlModel();
if (db.Suppliers.Any(x => x.Name == supplier)) continue;
var temp = new Supplier { Name = supplier };
db.Suppliers.Add(temp);
db.SaveChanges();
}
foreach (var date in datesToConvertListBox.Items) foreach (var date in datesToConvertListBox.Items)
{ {
var oldDateId = GetDateIdByDateString(date.ToString()); var oldDateId = GetDateIdByDateString(date.ToString());
@@ -112,13 +132,6 @@ namespace AdvertsingProfitControl
private void MassiveWriteFunction(string dateString, DataTable projections, DataTable inventory, DataTable actualSales, DataTable invoice, DataTable weeklySales, DataTable taxableTable, DataTable costOfSales, string comments) private void MassiveWriteFunction(string dateString, DataTable projections, DataTable inventory, DataTable actualSales, DataTable invoice, DataTable weeklySales, DataTable taxableTable, DataTable costOfSales, string comments)
{ {
//var dbT = new DatabaseTracker();
////Get a new ID number for the date supplied.
//var oleDbConnection = new OleDbConnection(dbT.DatabaseConnectionString);
//var oleDbCommand = new OleDbCommand
//{
// Connection = oleDbConnection
//};
try try
{ {
using (var transaction = new TransactionScope()) using (var transaction = new TransactionScope())
@@ -163,7 +176,7 @@ namespace AdvertsingProfitControl
var adItem = new AdItem(); var adItem = new AdItem();
var adItemId = 0; var adItemId = 0;
//var id = int.Parse(projections.Rows[rowIndex][0].ToString()); //var id = int.Parse(projections.Rows[rowIndex][0].ToString());
var spam = projections.Rows[rowIndex][0].ToString(); var spam = TextFormat.FormatAdItemText(projections.Rows[rowIndex][0].ToString());
if (db.AdItems.Any(x => x.Name == spam)) if (db.AdItems.Any(x => x.Name == spam))
{ {
//Exists //Exists
@@ -176,7 +189,6 @@ namespace AdvertsingProfitControl
adItem.Name = projections.Rows[rowIndex][0].ToString(); adItem.Name = projections.Rows[rowIndex][0].ToString();
db.AdItems.Add(adItem); db.AdItems.Add(adItem);
adItemId = adItem.Id; adItemId = adItem.Id;
} }
projectionedSale.Sold = projections.Rows[rowIndex][1].ToString(); projectionedSale.Sold = projections.Rows[rowIndex][1].ToString();
projectionedSale.SalePrice = projections.Rows[rowIndex][2].ToString(); projectionedSale.SalePrice = projections.Rows[rowIndex][2].ToString();
@@ -219,7 +231,7 @@ namespace AdvertsingProfitControl
var inventoryObject = new Inventory(); var inventoryObject = new Inventory();
AdItem adItem; AdItem adItem;
var adItemId = 0; var adItemId = 0;
var spam = actualSales.Rows[i][0].ToString(); var spam = TextFormat.FormatAdItemText(inventory.Rows[i][0].ToString());
if (db.AdItems.Any(x => x.Name == spam)) if (db.AdItems.Any(x => x.Name == spam))
{ {
//Exists //Exists
@@ -261,7 +273,7 @@ namespace AdvertsingProfitControl
//Get the ID number of the ad item. //Get the ID number of the ad item.
AdItem adItem; AdItem adItem;
var adItemId = 0; var adItemId = 0;
var spam = actualSales.Rows[rowIndex][0].ToString(); var spam = TextFormat.FormatAdItemText(actualSales.Rows[rowIndex][0].ToString());
if (db.AdItems.Any(x => x.Name == spam)) if (db.AdItems.Any(x => x.Name == spam))
{ {
//Exists //Exists
@@ -339,6 +351,8 @@ namespace AdvertsingProfitControl
// oleDbCommand.ExecuteNonQuery(); // oleDbCommand.ExecuteNonQuery();
// oleDbCommand.Parameters.Clear(); // oleDbCommand.Parameters.Clear();
} }
if (weeklySales.Rows.Count == 1)
{
var weeklySale = new WeeklySale var weeklySale = new WeeklySale
{ {
Sunday = decimal.Parse(weeklySales.Rows[0][0].ToString()), Sunday = decimal.Parse(weeklySales.Rows[0][0].ToString()),
@@ -352,6 +366,10 @@ namespace AdvertsingProfitControl
FkDateId = date.Id FkDateId = date.Id
}; };
db.WeeklySales.Add(weeklySale); db.WeeklySales.Add(weeklySale);
}
if (taxableTable.Rows.Count == 1)
{
//Comes from DatabaseReader class, so offset by one because zero is the ID number. //Comes from DatabaseReader class, so offset by one because zero is the ID number.
var taxable = new Taxable var taxable = new Taxable
{ {
@@ -366,7 +384,10 @@ namespace AdvertsingProfitControl
FkDateId = date.Id FkDateId = date.Id
}; };
db.Taxables.Add(taxable); db.Taxables.Add(taxable);
}
//SELECT CostOfSalesAnalysis.ID, CostOfSalesAnalysis.SalesPerManHour, CostOfSalesAnalysis.SalaryPercentage, CostOfSalesAnalysis.SalaryDollars, CostOfSalesAnalysis.Supplies FROM CostOfSalesAnalysis WHERE FK_DateID = ? //SELECT CostOfSalesAnalysis.ID, CostOfSalesAnalysis.SalesPerManHour, CostOfSalesAnalysis.SalaryPercentage, CostOfSalesAnalysis.SalaryDollars, CostOfSalesAnalysis.Supplies FROM CostOfSalesAnalysis WHERE FK_DateID = ?
if (costOfSales.Rows.Count == 1)
{
var cost = new CostAnalysi var cost = new CostAnalysi
{ {
SalesPerManHour = decimal.Parse(costOfSales.Rows[0][1].ToString()), SalesPerManHour = decimal.Parse(costOfSales.Rows[0][1].ToString()),
@@ -376,6 +397,8 @@ namespace AdvertsingProfitControl
FkDateId = date.Id FkDateId = date.Id
}; };
db.CostAnalysis.Add(cost); db.CostAnalysis.Add(cost);
}
if (!string.IsNullOrEmpty(comments)) if (!string.IsNullOrEmpty(comments))
{ {
var comment = new Note var comment = new Note
@@ -400,10 +423,54 @@ namespace AdvertsingProfitControl
MessageBox.Show(e.Message); MessageBox.Show(e.Message);
//oleDbTransaction?.Rollback(); //oleDbTransaction?.Rollback();
} }
finally
{
//oleDbConnection.Close();
} }
public List<string> GetAdItems()
{
var adItems = new List<string>();
var oleDbCommand = new OleDbCommand
{
CommandText = "SELECT AdItem.AdItem FROM AdItem ORDER BY AdItem.AdItem ASC"
};
var connection = new OleDbConnection(_connectionString);
oleDbCommand.Connection = connection;
using (connection)
{
using (oleDbCommand)
{
connection.Open();
var reader = oleDbCommand.ExecuteReader();
while (reader != null && reader.Read())
{
adItems.Add(reader[0].ToString());
}
}
}
return adItems;
}
public List<string> GetSuppliers()
{
var adItems = new List<string>();
var oleDbCommand = new OleDbCommand
{
CommandText = "SELECT Supplier.SupplierName FROM Supplier ORDER BY Supplier.SupplierName ASC"
};
var connection = new OleDbConnection(_connectionString);
oleDbCommand.Connection = connection;
using (connection)
{
using (oleDbCommand)
{
connection.Open();
var reader = oleDbCommand.ExecuteReader();
while (reader != null && reader.Read())
{
adItems.Add(reader[0].ToString());
}
}
}
return adItems;
} }
public int GetSupplierId(string supplierName) public int GetSupplierId(string supplierName)
+170 -657
View File
@@ -1,5 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.Entity;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.IO; using System.IO;
@@ -18,27 +21,41 @@ namespace AdvertsingProfitControl
private DateTime _currentActiveDate; private DateTime _currentActiveDate;
private readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance; private readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
private int _LazyPageCounter; private int _LazyPageCounter;
private bool isDebug;
public FrmMain() public FrmMain(bool isDebug)
{ {
InitializeComponent(); InitializeComponent();
this.isDebug = isDebug;
isDebug = true;
debugToolStripMenuItem.Visible = isDebug;
var db = new AdvertisingProfitControlModel();
db.Versions.Count();
} }
private void frmMain_Load(object sender, EventArgs e) private void frmMain_Load(object sender, EventArgs e)
{ {
var databaseTracker = new DatabaseTracker(); var db = new AdvertisingProfitControlModel();
var databaseReader = new DatabaseReader(); monthCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
ConstructApcDataGridViews(); ConstructApcDataGridViews();
ConstructInvoicesDataGridView(); ConstructInvoicesDataGridView();
RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString)); //RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString); //Select the most recent date from the database.
_currentActiveDate = date; var recentDate = db.WeekEndingDates.OrderByDescending(x => x.EndingDate).FirstOrDefault();
LoadDate(date); if (recentDate != null)
{
_currentActiveDate = recentDate.EndingDate;
LoadDate(recentDate.EndingDate);
}
monthCalendar.DateChanged += ValidateDateChanged; monthCalendar.DateChanged += ValidateDateChanged;
//projectionsDataGridView.KeyDown += FrmMain_KeyDown; //projectionsDataGridView.KeyDown += FrmMain_KeyDown;
//var margin = new Margins(50, 50, 0, 0); //var margin = new Margins(50, 50, 0, 0);
//_printDoc.DefaultPageSettings.Margins = margin; //_printDoc.DefaultPageSettings.Margins = margin;
//var adItem = new AdItem {Name = "Celery"};
//var db = new AdvertisingProfitControlContext();
//db.AdItems.Add(adItem);
//db.SaveChanges();
} }
private void CalculateProfitAnalysis(double shrink = 0.30) private void CalculateProfitAnalysis(double shrink = 0.30)
@@ -337,8 +354,7 @@ namespace AdvertsingProfitControl
private void LoadDate(DateTime date) private void LoadDate(DateTime date)
{ {
var databaseTracker = new DatabaseTracker(); var db = new AdvertisingProfitControlModel();
var databaseReader = new DatabaseReader();
if (monthCalendar.BoldedDates.Length == 0) if (monthCalendar.BoldedDates.Length == 0)
{ {
//The database is most likely empty so halt everything. //The database is most likely empty so halt everything.
@@ -349,210 +365,62 @@ namespace AdvertsingProfitControl
} }
modifyRecordMainMenu.Enabled = true; modifyRecordMainMenu.Enabled = true;
modifyRecordMainMenu.ToolTipText = @""; modifyRecordMainMenu.ToolTipText = @"";
var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"), var dateRecord = db.WeekEndingDates.Single(x => x.EndingDate == date);
databaseTracker.DatabaseConnectionString);
if (dateId == 0)
{
errorLabel.Text = @"Failed to get the date ID number, aborting load operation." + Environment.NewLine;
return;
}
ClearForm(); ClearForm();
var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString); LoadProjectionsTable(dateRecord);
var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString); LoadInventoryTable(dateRecord);
var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString); LoadActualSalesTable(dateRecord);
LoadProjectionsTable(projections); LoadInvoices(dateRecord);
LoadInventoryTable(inventory); var note = db.Notes.Single(x => x.FkDateId == dateRecord.Id);
LoadActualSalesTable(actualSales); commentsTextBox.Text = note.Remark;
var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString); LoadWeeklySales(dateRecord);
LoadInvoices(invoices); LoadTaxable(dateRecord);
var comments = databaseReader.RetrieveComments(int.Parse(dateId.ToString()), LoadCostAnalysis(dateRecord);
databaseTracker.DatabaseConnectionString);
if (comments.Count == 2)
{
commentsTextBox.Text = comments[1];
}
else
{
commentMainGroupBox.Text = @"Comments (None to Display)";
}
var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId,
databaseTracker.DatabaseConnectionString);
if (weeklySales.Rows.Count == 1)
{
LoadWeeklySales(weeklySales);
}
else
{
weeklySalesGroupBox.Text = @"Weekly Sales (Nothing to Display)";
}
var taxable = databaseReader.ReturnTaxableFromDateId(dateId, databaseTracker.DatabaseConnectionString);
if (taxable.Rows.Count == 1)
{
LoadTaxable(taxable);
}
else
{
taxableGroupBox.Text = @"Taxable (Nothing to Display)";
}
var costAnalysis = databaseReader.ReturnCostAnalysis(dateId,
databaseTracker.DatabaseConnectionString);
if (costAnalysis.Rows.Count == 1)
{
LoadCostAnalysis(costAnalysis);
}
else
{
costAnalysisGroupBox.Text = @"Cost Analysis (Nothing to Display)";
}
CalculateProfitAnalysis(); CalculateProfitAnalysis();
CalculateGrossProfit(); CalculateGrossProfit();
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray(); monthCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
monthCalendar.SelectionStart = date; monthCalendar.SelectionStart = date;
dateTimeGroupBox.Text = @"Loaded " + date.ToString("d"); dateTimeGroupBox.Text = @"Loaded " + date.ToString("d");
} }
private void LoadProjectionsTable(DataTable projections) private void LoadProjectionsTable(WeekEndingDate dateRecord)
{ {
if (projections.Rows.Count == 0) return; var db = new AdvertisingProfitControlModel();
var adSpecialIndex = -1; var adSpecialIndex = -1;
double totalSales = 0; decimal totalSales = 0;
double totalProfitReturn = 0; decimal totalProfitReturn = 0;
for (var rowIndex = 0; rowIndex < projections.Rows.Count; rowIndex++) var projections = db.Projections.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
foreach (var p in projections)
{ {
var newRow = new DataGridViewRow(); projectionsDataGridView.Rows.Add();
for (var cellIndex = 1; cellIndex < projections.Rows[rowIndex].ItemArray.Length; cellIndex++) var index = projectionsDataGridView.RowCount - 1;
projectionsDataGridView.Rows[index].Cells[0].Value = p.AdItem.Name;
projectionsDataGridView.Rows[index].Cells[1].Value = p.Sold;
projectionsDataGridView.Rows[index].Cells[2].Value = p.SalePrice;
projectionsDataGridView.Rows[index].Cells[3].Value = $@"{p.TotalSales:N2}";
if (p.TotalSales != null) totalSales += (decimal)p.TotalSales;
projectionsDataGridView.Rows[index].Cells[4].Value = $@"{p.Cost:N2}";
projectionsDataGridView.Rows[index].Cells[5].Value = $@"{p.ProfitReturn:N2}";
projectionsDataGridView.Rows[index].Cells[6].Value = $@"{p.TotalProfitReturn:N2}";
if (p.TotalProfitReturn != null) totalProfitReturn += (decimal)p.TotalProfitReturn;
if (p.RowAttribute == 1)
{ {
//ID and Ad Item. projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
if (cellIndex == 1)
{
var cell = new DataGridViewTextBoxCell
{
Value = projections.Rows[rowIndex].ItemArray[cellIndex].ToString()
};
newRow.Cells.Add(cell);
continue;
} }
//String allowed columns else if (p.RowAttribute == 2)
if (cellIndex > 1 && cellIndex <= 3)
{ {
if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty) projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
{
var cell = new DataGridViewTextBoxCell
{
Value = projections.Rows[rowIndex].ItemArray[cellIndex].ToString()
};
newRow.Cells.Add(cell);
} }
else
if (p.FkAdSpecialId != 0 && adSpecialIndex == -1)
{ {
var cell = new DataGridViewTextBoxCell {Value = string.Empty}; //TODO: Fix null reference when no object is found.
newRow.Cells.Add(cell); adSpecialIndex = index;
projectionsDataGridView.Rows.Insert(index, 1);
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
projectionsDataGridView.Rows[index].Cells[3].Value = db.AdSpecials.Single(x => x.Id == p.FkAdSpecialId).Name;
} }
continue;
}
//If the cell is meant to be summed into a totals roll add its contents to the total.
//If the cell is the total sales cell..
if (cellIndex == 4)
{
if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty &&
Math.Abs(double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0)
{
totalSales += double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString());
var cell = new DataGridViewTextBoxCell
{
Value =
double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())
.ToString("N2")
};
newRow.Cells.Add(cell);
}
else
{
var cell = new DataGridViewTextBoxCell {Value = string.Empty};
newRow.Cells.Add(cell);
}
continue;
}
//or the total profit return cell.
if (cellIndex == 7)
{
if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty &&
Math.Abs(double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0)
{
totalProfitReturn += double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString());
var cell = new DataGridViewTextBoxCell
{
Value =
double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())
.ToString("N2")
};
newRow.Cells.Add(cell);
}
else
{
var cell = new DataGridViewTextBoxCell {Value = string.Empty};
newRow.Cells.Add(cell);
}
continue;
}
//Everything in between the ad item cell and the row attribute cells.
if (cellIndex > 3 && cellIndex < 8)
{
if (Math.Abs(double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0)
{
var cell = new DataGridViewTextBoxCell
{
Value =
double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())
.ToString("N2")
};
newRow.Cells.Add(cell);
}
else
{
var cell = new DataGridViewTextBoxCell {Value = string.Empty};
newRow.Cells.Add(cell);
}
continue;
}
//Check the attribute cell.
if (cellIndex == 8)
{
var rowAttribute = int.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString());
switch (rowAttribute)
{
case 1:
//Header row
newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
break;
case 2:
//Member Row
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
break;
}
continue;
}
//Check the group it is part of if any.
if (cellIndex != 9) continue;
//Check to see if this row belongs to an ad special group.
if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") continue;
//If the ad special index is not set, then create the ad special row with the human friendly group name.
if (adSpecialIndex != -1) continue;
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var groupName =
databaseReader.ReturnGroupNameFromGroupId(
projections.Rows[rowIndex].ItemArray[cellIndex].ToString(),
databaseTracker.DatabaseConnectionString);
var adSpecialRow = new DataGridViewRow();
projectionsDataGridView.Rows.Add(adSpecialRow);
projectionsDataGridView.Rows[rowIndex].Cells[3].Value = groupName;
projectionsDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor =
ApplicationColors.AdSpecial;
adSpecialIndex = rowIndex;
}
projectionsDataGridView.Rows.Add(newRow);
} }
//Now add the totals row. //Now add the totals row.
var totalsRow = new DataGridViewRow(); var totalsRow = new DataGridViewRow();
@@ -576,214 +444,77 @@ namespace AdvertsingProfitControl
} }
} }
private void LoadInventoryTable(DataTable inventory) private void LoadInventoryTable(WeekEndingDate dateRecord)
{ {
if (inventory.Rows.Count == 0) return; var db = new AdvertisingProfitControlModel();
var adSpecialIndex = -1; var adSpecialIndex = -1;
for (var rowIndex = 0; rowIndex < inventory.Rows.Count; rowIndex++) var inventories = db.Inventories.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
foreach (var i in inventories)
{ {
var newRow = new DataGridViewRow(); inventoryDataGridView.Rows.Add();
for (var cellIndex = 1; cellIndex < inventory.Rows[rowIndex].ItemArray.Length; cellIndex++) var index = inventoryDataGridView.RowCount - 1;
inventoryDataGridView.Rows[index].Cells[0].Value = i.AdItem.Name;
inventoryDataGridView.Rows[index].Cells[1].Value = i.BeginningInventory;
inventoryDataGridView.Rows[index].Cells[2].Value = i.Recieved;
inventoryDataGridView.Rows[index].Cells[3].Value = i.TotalInventory;
inventoryDataGridView.Rows[index].Cells[4].Value = i.EndingInventory;
if (i.RowAttribute == 1)
{ {
//String allowed columns inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
if (cellIndex < 6)
{
if (inventory.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty)
{
var cell = new DataGridViewTextBoxCell
{
Value = inventory.Rows[rowIndex].ItemArray[cellIndex].ToString()
};
newRow.Cells.Add(cell);
} }
else else if (i.RowAttribute == 2)
{ {
var cell = new DataGridViewTextBoxCell {Value = string.Empty}; inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
newRow.Cells.Add(cell);
} }
continue;
} if (i.FkAdSpecialId != 0 && adSpecialIndex == -1)
//Check the attribute cell.
if (cellIndex == 6)
{ {
var rowAttribute = int.Parse(inventory.Rows[rowIndex].ItemArray[cellIndex].ToString()); adSpecialIndex = index;
switch (rowAttribute) inventoryDataGridView.Rows.Insert(index, 1);
{ inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
case 1: inventoryDataGridView.Rows[index].Cells[2].Value = db.AdSpecials.Single(x => x.Id == i.FkAdSpecialId).Name;
//Header row
newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
break;
case 2:
//Member Row
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
break;
} }
continue;
}
//Check the group it is part of if any.
if (cellIndex != 7) continue;
//Check to see if this row belongs to an ad special group.
if (inventory.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") continue;
//If the ad special index is not set, then create the ad special row with the human friendly group name.
if (adSpecialIndex != -1) continue;
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var groupName =
databaseReader.ReturnGroupNameFromGroupId(
inventory.Rows[rowIndex].ItemArray[cellIndex].ToString(),
databaseTracker.DatabaseConnectionString);
var adSpecialRow = new DataGridViewRow();
inventoryDataGridView.Rows.Add(adSpecialRow);
inventoryDataGridView.Rows[rowIndex].Cells[2].Value = groupName;
inventoryDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor =
ApplicationColors.AdSpecial;
adSpecialIndex = rowIndex;
}
inventoryDataGridView.Rows.Add(newRow);
} }
} }
private void LoadActualSalesTable(DataTable actualSales) private void LoadActualSalesTable(WeekEndingDate dateRecord)
{ {
if (actualSales.Rows.Count == 0) return; var db = new AdvertisingProfitControlModel();
var adSpecialIndex = -1; var adSpecialIndex = -1;
double totalSales = 0; decimal totalSales = 0;
double totalProfitReturn = 0; decimal totalProfitReturn = 0;
for (var rowIndex = 0; rowIndex < actualSales.Rows.Count; rowIndex++) var actualSales = db.ActualSales.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
foreach (var a in actualSales)
{ {
var newRow = new DataGridViewRow(); actualSalesDataGridView.Rows.Add();
for (var cellIndex = 1; cellIndex < actualSales.Rows[rowIndex].ItemArray.Length; cellIndex++) var index = actualSalesDataGridView.RowCount - 1;
actualSalesDataGridView.Rows[index].Cells[0].Value = a.AdItem.Name;
actualSalesDataGridView.Rows[index].Cells[1].Value = a.Sold;
actualSalesDataGridView.Rows[index].Cells[2].Value = a.SalePrice;
actualSalesDataGridView.Rows[index].Cells[3].Value = $@"{a.TotalSales:N2}";
if (a.TotalSales != null) totalSales += (decimal)a.TotalSales;
actualSalesDataGridView.Rows[index].Cells[4].Value = $@"{a.Cost:N2}";
actualSalesDataGridView.Rows[index].Cells[5].Value = $@"{a.ProfitReturn:N2}";
actualSalesDataGridView.Rows[index].Cells[6].Value = $@"{a.TotalProfitReturn:N2}";
if (a.TotalProfitReturn != null) totalProfitReturn += (decimal)a.TotalProfitReturn;
if (a.RowAttribute == 1)
{ {
//ID and Ad Item. actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
if (cellIndex == 1)
{
var cell = new DataGridViewTextBoxCell
{
Value = actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()
};
newRow.Cells.Add(cell);
continue;
} }
//String allowed columns else if (a.RowAttribute == 2)
if (cellIndex > 1 && cellIndex <= 3)
{ {
if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty) actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
{
var cell = new DataGridViewTextBoxCell
{
Value = actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()
};
newRow.Cells.Add(cell);
} }
else
if (a.FkAdSpecialId != 0 && adSpecialIndex == -1)
{ {
var cell = new DataGridViewTextBoxCell {Value = string.Empty}; adSpecialIndex = index;
newRow.Cells.Add(cell); actualSalesDataGridView.Rows.Insert(index, 1);
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
actualSalesDataGridView.Rows[index].Cells[3].Value = db.AdSpecials.Single(x => x.Id == a.FkAdSpecialId).Name;
} }
continue;
}
//If the cell is meant to be summed into a totals roll add its contents to the total.
//If the cell is the total sales cell..
if (cellIndex == 4)
{
if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty &&
Math.Abs(double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0)
{
totalSales += double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString());
var cell = new DataGridViewTextBoxCell
{
Value =
double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())
.ToString("N2")
};
newRow.Cells.Add(cell);
}
else
{
var cell = new DataGridViewTextBoxCell {Value = string.Empty};
newRow.Cells.Add(cell);
}
continue;
}
//or the total profit return cell.
if (cellIndex == 7)
{
if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty &&
Math.Abs(double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0)
{
totalProfitReturn += double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString());
var cell = new DataGridViewTextBoxCell
{
Value =
double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())
.ToString("N2")
};
newRow.Cells.Add(cell);
}
else
{
var cell = new DataGridViewTextBoxCell {Value = string.Empty};
newRow.Cells.Add(cell);
}
continue;
}
//Everything in between the ad item cell and the row attribute cells.
if (cellIndex > 3 && cellIndex < 8)
{
if (Math.Abs(double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0)
{
var cell = new DataGridViewTextBoxCell
{
Value =
double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())
.ToString("N2")
};
newRow.Cells.Add(cell);
}
else
{
var cell = new DataGridViewTextBoxCell {Value = string.Empty};
newRow.Cells.Add(cell);
}
continue;
}
//Check the attribute cell.
if (cellIndex == 8)
{
var rowAttribute = int.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString());
switch (rowAttribute)
{
case 1:
//Header row
newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
break;
case 2:
//Member Row
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
break;
}
continue;
}
//Check the group it is part of if any.
if (cellIndex != 9) continue;
//Check to see if this row belongs to an ad special group.
if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") continue;
//If the ad special index is not set, then create the ad special row with the human friendly group name.
if (adSpecialIndex != -1) continue;
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var groupName =
databaseReader.ReturnGroupNameFromGroupId(
actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString(),
databaseTracker.DatabaseConnectionString);
var adSpecialRow = new DataGridViewRow();
actualSalesDataGridView.Rows.Add(adSpecialRow);
actualSalesDataGridView.Rows[rowIndex].Cells[3].Value = groupName;
actualSalesDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor =
ApplicationColors.AdSpecial;
adSpecialIndex = rowIndex;
}
actualSalesDataGridView.Rows.Add(newRow);
} }
//Now add the totals row. //Now add the totals row.
var totalsRow = new DataGridViewRow(); var totalsRow = new DataGridViewRow();
@@ -807,50 +538,23 @@ namespace AdvertsingProfitControl
} }
} }
private void LoadInvoices(DataTable invoices) private void LoadInvoices(WeekEndingDate dateRecord)
{ {
if (invoices.Rows.Count == 0) return;
_totalInvoicePurchases = 0; _totalInvoicePurchases = 0;
for (var rowIndex = 0; rowIndex < invoices.Rows.Count; rowIndex++) var db = new AdvertisingProfitControlModel();
var invoices = db.Invoices.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
foreach (var invoice in invoices)
{ {
var row = new DataGridViewRow(); invoicesDataGridView.Rows.Add();
for (var cellIndex = 1; cellIndex < invoices.Rows[rowIndex].ItemArray.Length; cellIndex++) var index = invoicesDataGridView.RowCount - 1;
{ invoicesDataGridView.Rows[index].Cells[0].Value = invoice.InvoiceDate.ToString("d");
var cell = new DataGridViewTextBoxCell(); invoicesDataGridView.Rows[index].Cells[1].Value = invoice.Supplier.Name;
switch (cellIndex) invoicesDataGridView.Rows[index].Cells[2].Value = invoice.InvoiceNumber;
{ invoicesDataGridView.Rows[index].Cells[3].Value = $@"{invoice.InvoiceNetAmountAtCost:N2}";
//Apply formatting to the invoice date to trim the 12:00:00 time stamp. invoicesDataGridView.Rows[index].Cells[4].Value = $@"{invoice.InvoiceNetAmount:N2}";
case 1: if (invoice.InvoiceNetAmount != null) _totalInvoicePurchases += (double)invoice.InvoiceNetAmount;
var date = DateTime.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()); invoicesDataGridView.Rows[index].Cells[5].Value = invoice.InvoiceNote;
cell.Value = date.ToString("d");
row.Cells.Add(cell);
continue;
//Apply formatting to the only cells that will have currency values in them.
case 4:
var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
if (netAmountAtCost.ToString("N2") != "0.00")
{
cell.Value = netAmountAtCost.ToString("N2");
}
row.Cells.Add(cell);
break;
case 5:
var netAmoundExtendedRetail = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
if (netAmoundExtendedRetail.ToString("N2") != "0.00")
{
_totalInvoicePurchases += netAmoundExtendedRetail;
cell.Value = netAmoundExtendedRetail.ToString("N2");
}
row.Cells.Add(cell);
break;
default:
//No special formatting rules here so just put the value in and move on.
cell.Value = invoices.Rows[rowIndex].ItemArray[cellIndex].ToString();
row.Cells.Add(cell);
break;
}
}
invoicesDataGridView.Rows.Add(row);
} }
//Add the total purchases row to the invoice table. //Add the total purchases row to the invoice table.
var totalPurchaesRow = new DataGridViewRow(); var totalPurchaesRow = new DataGridViewRow();
@@ -862,251 +566,60 @@ namespace AdvertsingProfitControl
} }
} }
private void LoadWeeklySales(DataTable weeklySales) private void LoadWeeklySales(WeekEndingDate dateRecord)
{ {
//Clear the department sales and prepare to add up a total. //Clear the department sales and prepare to add up a total.
_departmentSales = 0; _departmentSales = 0;
//Spin through the only row in the weekly sales table. Item in item var db = new AdvertisingProfitControlModel();
//array index zero (0) is the ID number of the weekly sales. var weeklySales = db.WeeklySales.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
for (var cellIndex = 1; cellIndex < weeklySales.Rows[0].ItemArray.Length; cellIndex++) foreach (var sale in weeklySales)
{ {
double dollarAmount; if (sale.Sunday != null) _departmentSales += (double)sale.Sunday;
switch (cellIndex) sundayWeeklySalesLabel.Text = @"Sunday: " + $@"{sale.Sunday:c}";
{ if (sale.Monday != null) _departmentSales += (double)sale.Monday;
case 1: //Sunday mondayWeeklySalesLabel.Text = @"Monday: " + $@"{sale.Monday:c}";
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); if (sale.Tuesday != null) _departmentSales += (double)sale.Tuesday;
if (dollarAmount.ToString("N2") != "0.00") tuesadayWeeklySalesLabel.Text = @"Tuesday: " + $@"{sale.Tuesday:c}";
{ if (sale.Wednesday != null) _departmentSales += (double)sale.Wednesday;
_departmentSales += dollarAmount; wednesdayWeeklySalesLabel.Text = @"Wednesday: " + $@"{sale.Wednesday:c}";
sundayWeeklySalesLabel.Text = @"Sunday: $" + dollarAmount.ToString("N2"); if (sale.Thursday != null) _departmentSales += (double)sale.Thursday;
} thursdayWeeklySalesLabel.Text = @"Thursday: " + $@"{sale.Thursday:c}";
else if (sale.Friday != null) _departmentSales += (double)sale.Friday;
{ fridayWeeklySalesLabel.Text = @"Friday: " + $@"{sale.Friday:c}";
sundayWeeklySalesLabel.Text = @"Sunday: " + CheckForHoliday(DayOfWeek.Sunday); if (sale.Saturday != null) _departmentSales += (double)sale.Saturday;
} saturdayWeeklySalesLabel.Text = @"Saturday: " + $@"{sale.Saturday:c}";
break; totalWeeklySalesLabel.Text = @"Total Sales: " + $@"{sale.TotalSales:c}";
case 2: //Monday
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
mondayWeeklySalesLabel.Text = @"Monday: $" + dollarAmount.ToString("N2");
}
else
{
mondayWeeklySalesLabel.Text = @"Monday: " + CheckForHoliday(DayOfWeek.Monday);
}
break;
case 3: //Tuesday
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
tuesadayWeeklySalesLabel.Text = @"Tuesday: $" + dollarAmount.ToString("N2");
}
else
{
tuesadayWeeklySalesLabel.Text = @"Tuesday: " + CheckForHoliday(DayOfWeek.Tuesday);
}
break;
case 4: //Wednesday
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
wednesdayWeeklySalesLabel.Text = @"Wednesday: $" + dollarAmount.ToString("N2");
}
else
{
wednesdayWeeklySalesLabel.Text = @"Wednesday: " + CheckForHoliday(DayOfWeek.Wednesday);
}
break;
case 5: //Thursday
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
thursdayWeeklySalesLabel.Text = @"Thursday: $" + dollarAmount.ToString("N2");
}
else
{
thursdayWeeklySalesLabel.Text = @"Thursday: " + CheckForHoliday(DayOfWeek.Thursday);
}
break;
case 6: //Friday
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
fridayWeeklySalesLabel.Text = @"Friday: $" + dollarAmount.ToString("N2");
}
else
{
fridayWeeklySalesLabel.Text = @"Friday: " + CheckForHoliday(DayOfWeek.Friday);
}
break;
case 7: //Saturday
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
saturdayWeeklySalesLabel.Text = @"Saturday: $" + dollarAmount.ToString("N2");
}
else
{
saturdayWeeklySalesLabel.Text = @"Saturday: " + CheckForHoliday(DayOfWeek.Saturday);
}
break;
case 8: //Total Sales
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
totalWeeklySalesLabel.Text = @"Total Sales: $" + dollarAmount.ToString("N2");
}
else
{
totalWeeklySalesLabel.Text = @"Total Sales: ";
}
break;
}
} }
} }
private void LoadTaxable(DataTable taxable) private void LoadTaxable(WeekEndingDate dateRecord)
{ {
//Spin through the only row in the taxable table. Item in item //TODO: Check for holidays
//array index zero (0) is the ID number of the weekly sales. var db = new AdvertisingProfitControlModel();
for (var cellIndex = 1; cellIndex < taxable.Rows[0].ItemArray.Length; cellIndex++) var taxables = db.Taxables.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
foreach (var taxable in taxables)
{ {
string formattedNumber; sundayTaxableLabel.Text = @"Sunday: " + $@"{taxable.Sunday:c}";
switch (cellIndex) mondayTaxableLabel.Text = @"Monday: " + $@"{taxable.Monday:c}";
{ tuesdayTaxableLabel.Text = @"Tuesday: " + $@"{taxable.Tuesday:c}";
case 1: //Sunday wednesdayTaxableLabel.Text = @"Wednesday: " + $@"{taxable.Wednesday:c}";
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); thursdayTaxableLabel.Text = @"Thursday: " + $@"{taxable.Thursday:c}";
if (formattedNumber != "0.00") fridayTaxableLabel.Text = @"Friday: " + $@"{taxable.Friday:c}";
{ saturdayTaxableLabel.Text = @"Saturday: " + $@"{taxable.Saturday:c}";
sundayTaxableLabel.Text = @"Sunday: $" + formattedNumber; totalTaxableLabel.Text = @"Total: " + $@"{taxable.Total:c}";
}
else
{
sundayTaxableLabel.Text = @"Sunday: " + CheckForHoliday(DayOfWeek.Sunday);
}
break;
case 2: //Monday
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
mondayTaxableLabel.Text = @"Monday: $" + formattedNumber;
}
else
{
mondayTaxableLabel.Text = @"Monday: " + CheckForHoliday(DayOfWeek.Monday);
}
break;
case 3: //Tuesday
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
tuesdayTaxableLabel.Text = @"Tuesday: $" + formattedNumber;
}
else
{
tuesdayTaxableLabel.Text = @"Tuesday: " + CheckForHoliday(DayOfWeek.Tuesday);
}
break;
case 4: //Wednesday
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
wednesdayTaxableLabel.Text = @"Wednesday: $" + formattedNumber;
}
else
{
wednesdayTaxableLabel.Text = @"Wednesday: " + CheckForHoliday(DayOfWeek.Wednesday);
}
break;
case 5: //Thursday
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
thursdayTaxableLabel.Text = @"Thursday: $" + formattedNumber;
}
else
{
thursdayTaxableLabel.Text = @"Thursday: " + CheckForHoliday(DayOfWeek.Thursday);
}
break;
case 6: //Friday
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
fridayTaxableLabel.Text = @"Friday: $" + formattedNumber;
}
else
{
fridayTaxableLabel.Text = @"Friday: " + CheckForHoliday(DayOfWeek.Friday);
}
break;
case 7: //Saturday
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
saturdayTaxableLabel.Text = @"Saturday: $" + formattedNumber;
}
else
{
saturdayTaxableLabel.Text = @"Saturday: " + CheckForHoliday(DayOfWeek.Saturday);
}
break;
case 8: //Total Taxable
formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
totalTaxableLabel.Text = @"Total Taxable: $" + formattedNumber;
}
break;
}
} }
} }
private void LoadCostAnalysis(DataTable costAnalysis) private void LoadCostAnalysis(WeekEndingDate dateRecord)
{ {
//Spin through the only row in the taxable table. Item in item var db = new AdvertisingProfitControlModel();
//array index zero (0) is the ID number of the weekly sales. var analysis = db.CostAnalysis.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x);
for (var cellIndex = 1; cellIndex < costAnalysis.Rows[0].ItemArray.Length; cellIndex++) foreach (var a in analysis)
{ {
string formattedNumber; salesPerManHourLabel.Text = @"Sales Per Man Hour: " + $@"{a.SalesPerManHour:c}";
switch (cellIndex) salaryPercentageLabel.Text = @"Salary Percentage: " + $@"{a.SalaryPercentage:p}";
{ salaryDollarsLabel.Text = @"Salary Dollars: " + $@"{a.SalaryDollar:c}";
case 1: //Sales per man hour suppliesLabel.Text = @"Supplies: " + $@"{a.Supplies}";
formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
salesPerManHourLabel.Text = @"Sales Per Man Hour: $" + formattedNumber;
}
break;
case 2: //Salary Percentage
formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("P2");
if (formattedNumber != "0.00")
{
salaryPercentageLabel.Text = @"Salary Percentage: " + formattedNumber;
}
break;
case 3: //Salary Dollars
formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
salaryDollarsLabel.Text = @"Salary Dollars: $" + formattedNumber;
}
break;
case 4: //Supplies
formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2");
if (formattedNumber != "0.00")
{
suppliesLabel.Text = @"Supplies: $" + formattedNumber;
}
break;
}
} }
} }
+40
View File
@@ -0,0 +1,40 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("Inventory")]
public partial class Inventory
{
public int Id { get; set; }
[StringLength(256)]
public string BeginningInventory { get; set; }
[StringLength(256)]
public string Recieved { get; set; }
[StringLength(256)]
public string TotalInventory { get; set; }
[StringLength(256)]
public string EndingInventory { get; set; }
public int RowPosition { get; set; }
public int RowAttribute { get; set; }
public int FkAdItemId { get; set; }
public int FkAdSpecialId { get; set; }
public int FkDateId { get; set; }
public virtual AdItem AdItem { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+33
View File
@@ -0,0 +1,33 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class Invoice
{
public int Id { get; set; }
[Column(TypeName = "date")]
public DateTime InvoiceDate { get; set; }
public int InvoiceNumber { get; set; }
public decimal? InvoiceNetAmountAtCost { get; set; }
public decimal? InvoiceNetAmount { get; set; }
[StringLength(256)]
public string InvoiceNote { get; set; }
public int FkSupplierId { get; set; }
public int FkDateId { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
[Required]
public virtual Supplier Supplier { get; set; }
}
}
+21
View File
@@ -0,0 +1,21 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class Note
{
public int Id { get; set; }
[Required]
[StringLength(256)]
public string Remark { get; set; }
public int FkDateId { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+9 -2
View File
@@ -9,7 +9,7 @@ namespace AdvertsingProfitControl
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
private static void Main() private static void Main(string[] args)
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
@@ -19,7 +19,14 @@ namespace AdvertsingProfitControl
//var errorConsoleThread = new Thread(console.Show); //var errorConsoleThread = new Thread(console.Show);
//errorConsoleThread.IsBackground = true; //errorConsoleThread.IsBackground = true;
//errorConsoleThread.Start(); //errorConsoleThread.Start();
Application.Run(new FrmMain()); if (args.Length == 1 && args[0] == "/debug")
{
Application.Run(new FrmMain(true));
}
else
{
Application.Run(new FrmMain(false));
}
} }
} }
} }
+41
View File
@@ -0,0 +1,41 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class Projection
{
public int Id { get; set; }
[StringLength(128)]
public string Sold { get; set; }
[StringLength(128)]
public string SalePrice { get; set; }
public decimal? TotalSales { get; set; }
public decimal? Cost { get; set; }
public decimal? ProfitReturn { get; set; }
public decimal? TotalProfitReturn { get; set; }
public int RowPosition { get; set; }
public int RowAttribute { get; set; }
public int FkAdItemId { get; set; }
public int FkAdSpecialId { get; set; }
public int FkDateId { get; set; }
public virtual AdItem AdItem { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+28
View File
@@ -0,0 +1,28 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class Supplier
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Supplier()
{
Invoices = new HashSet<Invoice>();
}
public int Id { get; set; }
[StringLength(256)]
public string Name { get; set; }
[StringLength(256)]
public string Description { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Invoice> Invoices { get; set; }
}
}
+34
View File
@@ -0,0 +1,34 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("Taxable")]
public partial class Taxable
{
public int Id { get; set; }
public decimal? Sunday { get; set; }
public decimal? Monday { get; set; }
public decimal? Tuesday { get; set; }
public decimal? Wednesday { get; set; }
public decimal? Thursday { get; set; }
public decimal? Friday { get; set; }
public decimal? Saturday { get; set; }
public decimal? Total { get; set; }
public int FkDateId { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+17
View File
@@ -0,0 +1,17 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("Version")]
public partial class Version
{
public int Id { get; set; }
[StringLength(32)]
public string VersionNumber { get; set; }
}
}
+53
View File
@@ -0,0 +1,53 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class WeekEndingDate
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public WeekEndingDate()
{
ActualSales = new HashSet<ActualSale>();
CostAnalysis = new HashSet<CostAnalysi>();
Inventories = new HashSet<Inventory>();
Invoices = new HashSet<Invoice>();
Notes = new HashSet<Note>();
Projections = new HashSet<Projection>();
Taxables = new HashSet<Taxable>();
WeeklySales = new HashSet<WeeklySale>();
}
public int Id { get; set; }
[Column(TypeName = "date")]
public DateTime EndingDate { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<ActualSale> ActualSales { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<CostAnalysi> CostAnalysis { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Inventory> Inventories { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Invoice> Invoices { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Note> Notes { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Projection> Projections { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Taxable> Taxables { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<WeeklySale> WeeklySales { get; set; }
}
}
+33
View File
@@ -0,0 +1,33 @@
namespace AdvertsingProfitControl
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
public partial class WeeklySale
{
public int Id { get; set; }
public decimal? Sunday { get; set; }
public decimal? Monday { get; set; }
public decimal? Tuesday { get; set; }
public decimal? Wednesday { get; set; }
public decimal? Thursday { get; set; }
public decimal? Friday { get; set; }
public decimal? Saturday { get; set; }
public decimal? TotalSales { get; set; }
public int FkDateId { get; set; }
public virtual WeekEndingDate WeekEndingDate { get; set; }
}
}
+4 -12
View File
@@ -18,45 +18,38 @@
--> -->
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> <requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges> </requestedPrivileges>
<applicationRequestMinimum>
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
</security> </security>
</trustInfo> </trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application> <application>
<!-- A list of the Windows versions that this application has been tested on and is <!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. --> automatically selected the most compatible environment. -->
<!-- Windows Vista --> <!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 --> <!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 --> <!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />--> <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 --> <!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />--> <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 --> <!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application> </application>
</compatibility> </compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. --> also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings> <windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
</windowsSettings> </windowsSettings>
</application> </application>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) --> <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!-- <!--
<dependency> <dependency>
@@ -72,5 +65,4 @@
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>
--> -->
</assembly> </assembly>
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="AdvertsingProfitControl.application" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="amd64" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="AdvertsingProfitControl" asmv2:product="AdvertsingProfitControl" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" mapFileExtensions="true" />
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.5" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="AdvertsingProfitControl.exe.manifest" size="7492">
<assemblyIdentity name="AdvertsingProfitControl.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="amd64" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>3ChUsEqNUMAjVaBGqxbdYDY0WFTlgEm8k8f2eCP9a18=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
</asmv1:assembly>
@@ -1,18 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2"> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<asmv1:assemblyIdentity name="AdvertsingProfitControl.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="amd64" type="win32" /> <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<description asmv2:iconFile="Stretched Logo Collection.ico" xmlns="urn:schemas-microsoft-com:asm.v1" /> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<application />
<entryPoint>
<assemblyIdentity name="AdvertsingProfitControl" version="1.9.3.0" language="neutral" processorArchitecture="amd64" />
<commandLine file="AdvertsingProfitControl.exe" parameters="" />
</entryPoint>
<trustInfo>
<security> <security>
<applicationRequestMinimum>
<PermissionSet version="1" class="System.Security.NamedPermissionSet" Name="LocalIntranet" Description="Default rights given to applications on the local intranet" Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options <!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the If you want to change the Windows User Account Control level replace the
@@ -28,92 +18,12 @@
--> -->
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> <requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges> </requestedPrivileges>
<applicationRequestMinimum>
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
</security> </security>
</trustInfo> </trustInfo>
<dependency>
<dependentOS>
<osVersionInfo>
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
</osVersionInfo>
</dependentOS>
</dependency>
<dependency>
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="2435072">
<assemblyIdentity name="AdvertsingProfitControl" version="1.9.3.0" language="neutral" processorArchitecture="amd64" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>mupCCLiyPu/EYkKY9Sc0jm2Z0deNl6wThi2EYMz/tAI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="HtmlRenderer.dll" size="222208">
<assemblyIdentity name="HtmlRenderer" version="1.5.0.6" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>VGr+ZzYUr4vMefSbFien3axjDZd7ylgpjfrMKI12ink=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="HtmlRenderer.WinForms.dll" size="60416">
<assemblyIdentity name="HtmlRenderer.WinForms" version="1.5.0.6" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>WF/zxFwKgeKM8FANZnlU0EY/IhL18w1Px1iKE75KJWM=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<file name="APCDatabase Template Script.sql" size="6200">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>hrCGS0Sn5+IzPQDdJqcLf/Le8W/IzTyGRSduCe/L7Yo=</dsig:DigestValue>
</hash>
</file>
<file name="APCDatabase.accdb" size="864256">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>u8KjFRismEEKveuk50umuN3UTCd1w3Uh6n8Nk4q8yoo=</dsig:DigestValue>
</hash>
</file>
<file name="APCTemplate.accdb" size="819200">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>HWMXjUaEQtZd0vBm2k4ValXtZwmVzcqV0rERViSzOOc=</dsig:DigestValue>
</hash>
</file>
<file name="Stretched Logo Collection.ico" size="370070">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>EhpcVkhatavmpmzYIlqLL5P0WB1QFP8mU66foV/5u+c=</dsig:DigestValue>
</hash>
</file>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application> <application>
<!-- A list of the Windows versions that this application has been tested on and is <!-- A list of the Windows versions that this application has been tested on and is
@@ -131,9 +41,28 @@
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application> </application>
</compatibility> </compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings> <windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
</windowsSettings> </windowsSettings>
</application> </application>
</asmv1:assembly> <!-- 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>
-->
</assembly>
+1
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="HtmlRenderer.Core" version="1.5.0.6" targetFramework="net45" /> <package id="HtmlRenderer.Core" version="1.5.0.6" targetFramework="net45" />
<package id="HtmlRenderer.WinForms" version="1.5.0.6" targetFramework="net45" /> <package id="HtmlRenderer.WinForms" version="1.5.0.6" targetFramework="net45" />
</packages> </packages>
@@ -0,0 +1,5 @@
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
</configuration>
@@ -0,0 +1,5 @@
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
</configuration>
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,48 @@
TOPIC
about_EntityFramework
SHORT DESCRIPTION
Provides information about Entity Framework commands.
LONG DESCRIPTION
This topic describes the Entity Framework commands. Entity Framework is
Microsoft's recommended data access technology for new applications.
The following Entity Framework cmdlets are used with Entity Framework
Migrations.
Cmdlet Description
----------------- ---------------------------------------------------
Enable-Migrations Enables Code First Migrations in a project.
Add-Migration Scaffolds a migration script for any pending model
changes.
Update-Database Applies any pending migrations to the database.
Get-Migrations Displays the migrations that have been applied to
the target database.
The following Entity Framework cmdlets are used by NuGet packages that
install Entity Framework providers. These commands are not usually used as
part of normal application development.
Cmdlet Description
------------------------------ ---------------------------------------
Add-EFProvider Adds or updates an Entity Framework
provider entry in the project config
file.
Add-EFDefaultConnectionFactory Adds or updates an Entity Framework
default connection factory in the
project config file.
Initialize-EFConfiguration Initializes the Entity Framework
section in the project config file and
sets defaults.
SEE ALSO
Enable-Migrations
Add-Migration
Update-Database
Get-Migrations
+155
View File
@@ -0,0 +1,155 @@
param($installPath, $toolsPath, $package, $project)
if (Get-Module | ?{ $_.Name -eq 'EntityFramework' })
{
Remove-Module EntityFramework
}
Import-Module (Join-Path $toolsPath EntityFramework.psd1)
# SIG # Begin signature block
# MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUjXj4E03IfImYfKMB4CA3DfY0
# KZmgghWCMIIEwzCCA6ugAwIBAgITMwAAAGJBL8dNiq4TJgAAAAAAYjANBgkqhkiG
# 9w0BAQUFADB3MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSEw
# HwYDVQQDExhNaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EwHhcNMTUwMjEwMTgzMzM3
# WhcNMTYwNTEwMTgz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Ib3DQEJ
# AzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE1MDMwMjE3Mjk1OFowIwYJ
# KoZIhvcNAQkEMRYEFKxtHfNR1GPWPqo0yuBPiJ3WZNX2MA0GCSqGSIb3DQEBBQUA
# BIIBAAwIulYLc715s8FIBZzA3zKD9IKqlhrzpTNBY014mi1pwl2sMpKyA/xAH4Gj
# eyo4wzSR7PT2BsYEHElYh7tx/eC45rI2mYIFqfsyqbRBxRfWQCb3pb42kix/RUJ+
# ElTkwy7SG6c04KA8Yi/Z3uOxxlBCWfXWupHQMpIsdVI1s/v65Tn3TNyBLtPu507q
# CNcYfok3IIhcvQCd7vCUK2fnJsuLxbFFqqKoMft10iqAROREkXEhfcyLOUt4BrMh
# KN2ygSFPCIbFAGvmS84oq8p4FzJAFUL9rE8qzxzXrbEA4UglDj72mW6nXmXaHiOZ
# J+2fE3M9xcMV3gKEuSL/DiQhPaI=
# SIG # End signature block
+154
View File
@@ -0,0 +1,154 @@
param($installPath, $toolsPath, $package, $project)
Initialize-EFConfiguration $project
Add-EFProvider $project 'System.Data.SqlClient' 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
Write-Host
Write-Host "Type 'get-help EntityFramework' to see all available Entity Framework commands."
# SIG # Begin signature block
# MIIa4AYJKoZIhvcNAQcCoIIa0TCCGs0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUt8mwpdjiFmu2B4KBh+vEeQ+V
# VnSgghWCMIIEwzCCA6ugAwIBAgITMwAAAGJBL8dNiq4TJgAAAAAAYjANBgkqhkiG
# 9w0BAQUFADB3MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljc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