Moved group table and row parsing into a separate DLL to clean up the main binary a bit. Added custom engine to detect for bin counts and updated the record form to total the bins for the user automatically. Updated the .gitignore file to include the necessary DLLs for the projects.

This commit is contained in:
2017-07-02 20:59:33 -05:00
parent 12a6b36370
commit fd47690224
22 changed files with 878 additions and 727 deletions
+14 -15
View File
@@ -6,6 +6,7 @@ using System.Linq;
using System.Transactions;
using System.Windows.Forms;
using AdvertisingProfitControlData;
using DataTableParsingEngine;
namespace AdvertsingProfitControl
{
@@ -27,11 +28,12 @@ namespace AdvertsingProfitControl
private void frmMain_Load(object sender, EventArgs e)
{
//Load the ad special groups into the row parser class.
RowParser.BuildAdSpecialListings();
var db = new AdvertisingProfitControlDbContext();
RefreshDateListing();
ConstructApcDataGridViews();
ConstructInvoicesDataGridView();
RowParsing.AdSpecialGroups.AddRange(db.AdSpecials.Select(x => x.Name));
//Select the most recent date from the database.
var recentDate = db.WeekEndingDates.OrderByDescending(x => x.EndingDate).FirstOrDefault();
if (recentDate != null)
@@ -265,6 +267,8 @@ namespace AdvertsingProfitControl
{
var form = new FrmRegisterAdSpecial();
form.ShowDialog();
//Load any changes to the ad special groups into the row parser class.
RowParser.BuildAdSpecialListings();
}
private void ShowHideLogConsole(object sender, EventArgs e)
@@ -511,18 +515,18 @@ namespace AdvertsingProfitControl
if (p.TotalProfitReturn != null) totalProfitReturn += (decimal)p.TotalProfitReturn;
if (p.RowAttribute == 1)
{
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.HeaderRow;
}
else if (p.RowAttribute == 2)
{
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.MemberRow;
}
if (p.FkAdSpecialId == null || adSpecialIndex != -1) continue;
//TODO: Fix null reference when no object is found.
adSpecialIndex = index;
projectionsDataGridView.Rows.Insert(index, 1);
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.AdSpecial;
projectionsDataGridView.Rows[index].Cells[3].Value = db.AdSpecials.Single(x => x.Id == p.FkAdSpecialId).Name;
}
//Now add the totals row.
@@ -565,17 +569,17 @@ namespace AdvertsingProfitControl
inventoryDataGridView.Rows[index].Cells[4].Value = i.EndingInventory;
if (i.RowAttribute == 1)
{
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.HeaderRow;
}
else if (i.RowAttribute == 2)
{
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.MemberRow;
}
if (i.FkAdSpecialId == null || adSpecialIndex != -1) continue;
adSpecialIndex = index;
inventoryDataGridView.Rows.Insert(index, 1);
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.AdSpecial;
inventoryDataGridView.Rows[index].Cells[2].Value = db.AdSpecials.Single(x => x.Id == i.FkAdSpecialId).Name;
}
}
@@ -603,17 +607,17 @@ namespace AdvertsingProfitControl
if (a.TotalProfitReturn != null) totalProfitReturn += (decimal)a.TotalProfitReturn;
if (a.RowAttribute == 1)
{
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.HeaderRow;
}
else if (a.RowAttribute == 2)
{
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.MemberRow;
}
if (a.FkAdSpecialId == null || adSpecialIndex != -1) continue;
adSpecialIndex = index;
actualSalesDataGridView.Rows.Insert(index, 1);
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = TableColors.AdSpecial;
actualSalesDataGridView.Rows[index].Cells[3].Value = db.AdSpecials.Single(x => x.Id == a.FkAdSpecialId).Name;
}
//Now add the totals row.
@@ -911,11 +915,6 @@ namespace AdvertsingProfitControl
#region Debug Tool Menu Items
private void DisplayDebugTool(object sender, EventArgs e)
{
}
/// <summary>
/// Displays the legacy Add Record form. Completely for looks.
/// </summary>