Updated the table class files to allow a nullable ad special ID and changed the enum in the new modify record form to a boolean. Added a form to manage ad special keywords, still needs to handle removing them properly.
This commit is contained in:
@@ -53,8 +53,7 @@ RowPosition INTEGER NOT NULL,
|
|||||||
RowAttribute INTEGER NOT NULL, --Rename to "HeaderId"? Point to the header group's ID number perhaps?
|
RowAttribute INTEGER NOT NULL, --Rename to "HeaderId"? Point to the header group's ID number perhaps?
|
||||||
--Now begin all the foreign keys.
|
--Now begin all the foreign keys.
|
||||||
FkAdItemId INTEGER NOT NULL FOREIGN KEY REFERENCES AdItems(Id),
|
FkAdItemId INTEGER NOT NULL FOREIGN KEY REFERENCES AdItems(Id),
|
||||||
FkAdSpecialId INTEGER NOT NULL,
|
FkAdSpecialId INTEGER FOREIGN KEY REFERENCES AdSpecials(Id), --Can be NULL
|
||||||
--FkAdSpecialId INTEGER NOT NULL FOREIGN KEY REFERENCES AdSpecials(Id), --Can be NULL
|
|
||||||
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)
|
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -73,8 +72,7 @@ RowPosition INTEGER NOT NULL,
|
|||||||
RowAttribute INTEGER NOT NULL, --Rename to "HeaderId"? Point to the header group's ID number perhaps?
|
RowAttribute INTEGER NOT NULL, --Rename to "HeaderId"? Point to the header group's ID number perhaps?
|
||||||
--Now begin all the foreign keys.
|
--Now begin all the foreign keys.
|
||||||
FkAdItemId INTEGER NOT NULL FOREIGN KEY REFERENCES AdItems(Id),
|
FkAdItemId INTEGER NOT NULL FOREIGN KEY REFERENCES AdItems(Id),
|
||||||
FkAdSpecialId INTEGER NOT NULL,
|
FkAdSpecialId INTEGER FOREIGN KEY REFERENCES AdSpecials(Id), --Can be NULL
|
||||||
--FkAdSpecialId INTEGER NOT NULL FOREIGN KEY REFERENCES AdSpecials(Id), --Can be NULL
|
|
||||||
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)
|
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -96,8 +94,7 @@ RowPosition INTEGER NOT NULL,
|
|||||||
RowAttribute INTEGER NOT NULL, --Rename to "HeaderId"? Point to the header group's ID number perhaps?
|
RowAttribute INTEGER NOT NULL, --Rename to "HeaderId"? Point to the header group's ID number perhaps?
|
||||||
--Now begin all the foreign keys.
|
--Now begin all the foreign keys.
|
||||||
FkAdItemId INTEGER NOT NULL FOREIGN KEY REFERENCES AdItems(Id),
|
FkAdItemId INTEGER NOT NULL FOREIGN KEY REFERENCES AdItems(Id),
|
||||||
FkAdSpecialId INTEGER NOT NULL,
|
FkAdSpecialId INTEGER FOREIGN KEY REFERENCES AdSpecials(Id), --Can be NULL
|
||||||
--FkAdSpecialId INTEGER NOT NULL FOREIGN KEY REFERENCES AdSpecials(Id), --Can be NULL
|
|
||||||
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)
|
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,14 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
public int FkAdItemId { get; set; }
|
public int FkAdItemId { get; set; }
|
||||||
|
|
||||||
public int FkAdSpecialId { get; set; }
|
public int? FkAdSpecialId { get; set; }
|
||||||
|
|
||||||
public int FkDateId { get; set; }
|
public int FkDateId { get; set; }
|
||||||
|
|
||||||
public virtual AdItem AdItem { get; set; }
|
public virtual AdItem AdItem { get; set; }
|
||||||
|
|
||||||
|
public virtual AdSpecial AdSpecial { get; set; }
|
||||||
|
|
||||||
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
public partial class AdSpecial
|
public partial class AdSpecial
|
||||||
{
|
{
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||||
|
public AdSpecial()
|
||||||
|
{
|
||||||
|
ActualSales = new HashSet<ActualSale>();
|
||||||
|
Inventories = new HashSet<Inventory>();
|
||||||
|
Projections = new HashSet<Projection>();
|
||||||
|
}
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
@@ -16,5 +24,14 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
[StringLength(256)]
|
[StringLength(256)]
|
||||||
public string Description { get; set; }
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace AdvertsingProfitControl
|
|||||||
public partial class AdvertisingProfitControlModel : DbContext
|
public partial class AdvertisingProfitControlModel : DbContext
|
||||||
{
|
{
|
||||||
public AdvertisingProfitControlModel()
|
public AdvertisingProfitControlModel()
|
||||||
: base("name=AdvertisingProfitControlContext")
|
: base("name=AdvertisingProfitControlDbContext")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +86,21 @@ namespace AdvertsingProfitControl
|
|||||||
.Property(e => e.Description)
|
.Property(e => e.Description)
|
||||||
.IsUnicode(false);
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<AdSpecial>()
|
||||||
|
.HasMany(e => e.ActualSales)
|
||||||
|
.WithOptional(e => e.AdSpecial)
|
||||||
|
.HasForeignKey(e => e.FkAdSpecialId);
|
||||||
|
|
||||||
|
modelBuilder.Entity<AdSpecial>()
|
||||||
|
.HasMany(e => e.Inventories)
|
||||||
|
.WithOptional(e => e.AdSpecial)
|
||||||
|
.HasForeignKey(e => e.FkAdSpecialId);
|
||||||
|
|
||||||
|
modelBuilder.Entity<AdSpecial>()
|
||||||
|
.HasMany(e => e.Projections)
|
||||||
|
.WithOptional(e => e.AdSpecial)
|
||||||
|
.HasForeignKey(e => e.FkAdSpecialId);
|
||||||
|
|
||||||
modelBuilder.Entity<CostAnalysi>()
|
modelBuilder.Entity<CostAnalysi>()
|
||||||
.Property(e => e.SalesPerManHour)
|
.Property(e => e.SalesPerManHour)
|
||||||
.HasPrecision(19, 2);
|
.HasPrecision(19, 2);
|
||||||
@@ -118,6 +133,10 @@ namespace AdvertsingProfitControl
|
|||||||
.Property(e => e.EndingInventory)
|
.Property(e => e.EndingInventory)
|
||||||
.IsUnicode(false);
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Invoice>()
|
||||||
|
.Property(e => e.InvoiceNumber)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
modelBuilder.Entity<Invoice>()
|
modelBuilder.Entity<Invoice>()
|
||||||
.Property(e => e.InvoiceNetAmountAtCost)
|
.Property(e => e.InvoiceNetAmountAtCost)
|
||||||
.HasPrecision(19, 2);
|
.HasPrecision(19, 2);
|
||||||
|
|||||||
@@ -128,6 +128,12 @@
|
|||||||
<Compile Include="DebugDatabaseConverter.Designer.cs">
|
<Compile Include="DebugDatabaseConverter.Designer.cs">
|
||||||
<DependentUpon>DebugDatabaseConverter.cs</DependentUpon>
|
<DependentUpon>DebugDatabaseConverter.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="FrmRegisterAdSpecial.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FrmRegisterAdSpecial.Designer.cs">
|
||||||
|
<DependentUpon>FrmRegisterAdSpecial.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Holiday.cs" />
|
<Compile Include="Holiday.cs" />
|
||||||
<Compile Include="Inventory.cs" />
|
<Compile Include="Inventory.cs" />
|
||||||
<Compile Include="Invoice.cs" />
|
<Compile Include="Invoice.cs" />
|
||||||
@@ -182,6 +188,9 @@
|
|||||||
<EmbeddedResource Include="FrmLogConsole.resx">
|
<EmbeddedResource Include="FrmLogConsole.resx">
|
||||||
<DependentUpon>FrmLogConsole.cs</DependentUpon>
|
<DependentUpon>FrmLogConsole.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="FrmRegisterAdSpecial.resx">
|
||||||
|
<DependentUpon>FrmRegisterAdSpecial.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="NewModifyRecord.resx">
|
<EmbeddedResource Include="NewModifyRecord.resx">
|
||||||
<DependentUpon>NewModifyRecord.cs</DependentUpon>
|
<DependentUpon>NewModifyRecord.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
@@ -15,5 +15,7 @@
|
|||||||
</providers>
|
</providers>
|
||||||
</entityFramework>
|
</entityFramework>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="AdvertisingProfitControlContext" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=AdvertisingProfitControl;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /></connectionStrings>
|
<add name="AdvertisingProfitControlContext" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=AdvertisingProfitControl;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
|
||||||
|
<add name="AdvertisingProfitControlDbContext" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=AdvertisingProfitControl;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
|
||||||
|
</connectionStrings>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -328,7 +328,7 @@ namespace AdvertsingProfitControl
|
|||||||
db.Suppliers.Add(supplier);
|
db.Suppliers.Add(supplier);
|
||||||
}
|
}
|
||||||
invoiceObject.InvoiceDate = DateTime.Parse(invoice.Rows[i][0].ToString());
|
invoiceObject.InvoiceDate = DateTime.Parse(invoice.Rows[i][0].ToString());
|
||||||
invoiceObject.InvoiceNumber = int.Parse(invoice.Rows[i][2].ToString());
|
invoiceObject.InvoiceNumber = invoice.Rows[i][2].ToString();
|
||||||
invoiceObject.InvoiceNetAmountAtCost = decimal.Parse(invoice.Rows[i][3].ToString());
|
invoiceObject.InvoiceNetAmountAtCost = decimal.Parse(invoice.Rows[i][3].ToString());
|
||||||
invoiceObject.InvoiceNetAmount = decimal.Parse(invoice.Rows[i][4].ToString());
|
invoiceObject.InvoiceNetAmount = decimal.Parse(invoice.Rows[i][4].ToString());
|
||||||
invoiceObject.InvoiceNote = invoice.Rows[i][5].ToString();
|
invoiceObject.InvoiceNote = invoice.Rows[i][5].ToString();
|
||||||
|
|||||||
+13
-3
@@ -104,6 +104,7 @@
|
|||||||
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label();
|
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label();
|
||||||
this.perfectGrossProfitLabel = new System.Windows.Forms.Label();
|
this.perfectGrossProfitLabel = new System.Windows.Forms.Label();
|
||||||
this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label();
|
this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label();
|
||||||
|
this.reportsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mainMenu.SuspendLayout();
|
this.mainMenu.SuspendLayout();
|
||||||
this.mainTableLayoutPanel.SuspendLayout();
|
this.mainTableLayoutPanel.SuspendLayout();
|
||||||
this.commentMainTableLayoutPanel.SuspendLayout();
|
this.commentMainTableLayoutPanel.SuspendLayout();
|
||||||
@@ -146,6 +147,7 @@
|
|||||||
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.fileMainMenu,
|
this.fileMainMenu,
|
||||||
this.recordsToolStripMenuItem,
|
this.recordsToolStripMenuItem,
|
||||||
|
this.reportsMainMenu,
|
||||||
this.toolsMainMenu,
|
this.toolsMainMenu,
|
||||||
this.helpMainMenu,
|
this.helpMainMenu,
|
||||||
this.debugMainMenu});
|
this.debugMainMenu});
|
||||||
@@ -196,9 +198,9 @@
|
|||||||
// toolsMainMenu
|
// toolsMainMenu
|
||||||
//
|
//
|
||||||
this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.adSpecialKeyWordsToolsMainMenu,
|
this.clearSelectedDateToolsMainMenu,
|
||||||
this.manageItemsToolsMainMenu,
|
this.manageItemsToolsMainMenu,
|
||||||
this.clearSelectedDateToolsMainMenu});
|
this.adSpecialKeyWordsToolsMainMenu});
|
||||||
this.toolsMainMenu.Name = "toolsMainMenu";
|
this.toolsMainMenu.Name = "toolsMainMenu";
|
||||||
this.toolsMainMenu.Size = new System.Drawing.Size(72, 34);
|
this.toolsMainMenu.Size = new System.Drawing.Size(72, 34);
|
||||||
this.toolsMainMenu.Text = "&Tools";
|
this.toolsMainMenu.Text = "&Tools";
|
||||||
@@ -208,7 +210,7 @@
|
|||||||
this.adSpecialKeyWordsToolsMainMenu.Name = "adSpecialKeyWordsToolsMainMenu";
|
this.adSpecialKeyWordsToolsMainMenu.Name = "adSpecialKeyWordsToolsMainMenu";
|
||||||
this.adSpecialKeyWordsToolsMainMenu.Size = new System.Drawing.Size(286, 34);
|
this.adSpecialKeyWordsToolsMainMenu.Size = new System.Drawing.Size(286, 34);
|
||||||
this.adSpecialKeyWordsToolsMainMenu.Text = "&Register Ad Special";
|
this.adSpecialKeyWordsToolsMainMenu.Text = "&Register Ad Special";
|
||||||
this.adSpecialKeyWordsToolsMainMenu.Visible = false;
|
this.adSpecialKeyWordsToolsMainMenu.Click += new System.EventHandler(this.adSpecialKeyWordsToolsMainMenu_Click);
|
||||||
//
|
//
|
||||||
// manageItemsToolsMainMenu
|
// manageItemsToolsMainMenu
|
||||||
//
|
//
|
||||||
@@ -944,6 +946,13 @@
|
|||||||
this.grossProfitDollarGrossProfitLabel.TabIndex = 2;
|
this.grossProfitDollarGrossProfitLabel.TabIndex = 2;
|
||||||
this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: ";
|
this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: ";
|
||||||
//
|
//
|
||||||
|
// reportsMainMenu
|
||||||
|
//
|
||||||
|
this.reportsMainMenu.Name = "reportsMainMenu";
|
||||||
|
this.reportsMainMenu.Size = new System.Drawing.Size(95, 34);
|
||||||
|
this.reportsMainMenu.Text = "R&eports";
|
||||||
|
this.reportsMainMenu.Visible = false;
|
||||||
|
//
|
||||||
// FrmMain
|
// FrmMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
||||||
@@ -1067,6 +1076,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem clearSelectedDateToolsMainMenu;
|
private System.Windows.Forms.ToolStripMenuItem clearSelectedDateToolsMainMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem addRecordToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem addRecordToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem rawViewDebugMainMenu;
|
private System.Windows.Forms.ToolStripMenuItem rawViewDebugMainMenu;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem reportsMainMenu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace AdvertsingProfitControl
|
|||||||
private void frmMain_Load(object sender, EventArgs e)
|
private void frmMain_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var db = new AdvertisingProfitControlModel();
|
var db = new AdvertisingProfitControlModel();
|
||||||
monthCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
|
RefreshDateListing();
|
||||||
ConstructApcDataGridViews();
|
ConstructApcDataGridViews();
|
||||||
ConstructInvoicesDataGridView();
|
ConstructInvoicesDataGridView();
|
||||||
RowParsing.AdSpecialGroups.AddRange(db.AdSpecials.Select(x => x.Name));
|
RowParsing.AdSpecialGroups.AddRange(db.AdSpecials.Select(x => x.Name));
|
||||||
@@ -135,6 +135,7 @@ namespace AdvertsingProfitControl
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
//One the user has closed the add record form, check to see if there is a newer date
|
//One the user has closed the add record form, check to see if there is a newer date
|
||||||
//available. If so, reload the form.
|
//available. If so, reload the form.
|
||||||
|
RefreshDateListing();
|
||||||
var date = db.WeekEndingDates.OrderByDescending(x => x.EndingDate).FirstOrDefault();
|
var date = db.WeekEndingDates.OrderByDescending(x => x.EndingDate).FirstOrDefault();
|
||||||
if (date == null) return;
|
if (date == null) return;
|
||||||
if (date.EndingDate == _currentActiveDate) return;
|
if (date.EndingDate == _currentActiveDate) return;
|
||||||
@@ -157,6 +158,7 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
var form = new NewModifyRecord(_currentActiveDate);
|
var form = new NewModifyRecord(_currentActiveDate);
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
RefreshDateListing();
|
||||||
//On return reload the date that was just modified by the modify record form.
|
//On return reload the date that was just modified by the modify record form.
|
||||||
LoadDate(_currentActiveDate);
|
LoadDate(_currentActiveDate);
|
||||||
}
|
}
|
||||||
@@ -347,16 +349,6 @@ namespace AdvertsingProfitControl
|
|||||||
private void LoadDate(DateTime date)
|
private void LoadDate(DateTime date)
|
||||||
{
|
{
|
||||||
var db = new AdvertisingProfitControlModel();
|
var db = new AdvertisingProfitControlModel();
|
||||||
if (monthCalendar.BoldedDates.Length == 0)
|
|
||||||
{
|
|
||||||
//The database is most likely empty so halt everything.
|
|
||||||
dateTimeGroupBox.Text = @"The database appears to be empty.";
|
|
||||||
modifyRecordMainMenu.Enabled = false;
|
|
||||||
modifyRecordMainMenu.ToolTipText = @"There are no records to modify.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modifyRecordMainMenu.Enabled = true;
|
|
||||||
modifyRecordMainMenu.ToolTipText = @"";
|
|
||||||
var dateRecord = db.WeekEndingDates.SingleOrDefault(x => x.EndingDate == date);
|
var dateRecord = db.WeekEndingDates.SingleOrDefault(x => x.EndingDate == date);
|
||||||
if (dateRecord == null)
|
if (dateRecord == null)
|
||||||
{
|
{
|
||||||
@@ -413,7 +405,7 @@ namespace AdvertsingProfitControl
|
|||||||
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
projectionsDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.FkAdSpecialId != 0 && adSpecialIndex == -1)
|
if (p.FkAdSpecialId != null && adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
//TODO: Fix null reference when no object is found.
|
//TODO: Fix null reference when no object is found.
|
||||||
adSpecialIndex = index;
|
adSpecialIndex = index;
|
||||||
@@ -469,7 +461,7 @@ namespace AdvertsingProfitControl
|
|||||||
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
inventoryDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.FkAdSpecialId != 0 && adSpecialIndex == -1)
|
if (i.FkAdSpecialId != null && adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
adSpecialIndex = index;
|
adSpecialIndex = index;
|
||||||
inventoryDataGridView.Rows.Insert(index, 1);
|
inventoryDataGridView.Rows.Insert(index, 1);
|
||||||
@@ -509,7 +501,7 @@ namespace AdvertsingProfitControl
|
|||||||
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
actualSalesDataGridView.Rows[index].DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.FkAdSpecialId != 0 && adSpecialIndex == -1)
|
if (a.FkAdSpecialId != null && adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
adSpecialIndex = index;
|
adSpecialIndex = index;
|
||||||
actualSalesDataGridView.Rows.Insert(index, 1);
|
actualSalesDataGridView.Rows.Insert(index, 1);
|
||||||
@@ -781,6 +773,17 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
var db = new AdvertisingProfitControlModel();
|
var db = new AdvertisingProfitControlModel();
|
||||||
monthCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
|
monthCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
|
||||||
|
if (monthCalendar.BoldedDates.Length > 0)
|
||||||
|
{
|
||||||
|
modifyRecordMainMenu.Enabled = true;
|
||||||
|
modifyRecordMainMenu.ToolTipText = @"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dateTimeGroupBox.Text = @"No records found in the database.";
|
||||||
|
modifyRecordMainMenu.Enabled = false;
|
||||||
|
modifyRecordMainMenu.ToolTipText = @"There are no records to modify.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearSelectedDateToolsMainMenu_Click(object sender, EventArgs e)
|
private void clearSelectedDateToolsMainMenu_Click(object sender, EventArgs e)
|
||||||
@@ -845,6 +848,7 @@ namespace AdvertsingProfitControl
|
|||||||
db.WeekEndingDates.Remove(dateRecord);
|
db.WeekEndingDates.Remove(dateRecord);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
scope.Complete();
|
scope.Complete();
|
||||||
|
ClearForm();
|
||||||
}
|
}
|
||||||
catch (DbUpdateException ex)
|
catch (DbUpdateException ex)
|
||||||
{
|
{
|
||||||
@@ -854,7 +858,11 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
RefreshDateListing();
|
RefreshDateListing();
|
||||||
LoadDate(db.WeekEndingDates.OrderByDescending(x => x.EndingDate).FirstOrDefault().EndingDate);
|
var mostRecentDate = db.WeekEndingDates.OrderByDescending(x => x.EndingDate).FirstOrDefault();
|
||||||
|
if (mostRecentDate != null)
|
||||||
|
{
|
||||||
|
LoadDate(mostRecentDate.EndingDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRecordToolStripMenuItem_Click_1(object sender, EventArgs e)
|
private void addRecordToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||||
@@ -867,6 +875,12 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void adSpecialKeyWordsToolsMainMenu_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var form = new FrmRegisterAdSpecial();
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
|
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
namespace AdvertsingProfitControl
|
||||||
|
{
|
||||||
|
partial class FrmRegisterAdSpecial
|
||||||
|
{
|
||||||
|
/// <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.registerAdSpecialButton = new System.Windows.Forms.Button();
|
||||||
|
this.deleteAdSpecialButton = new System.Windows.Forms.Button();
|
||||||
|
this.newAdSpecialLabel = new System.Windows.Forms.Label();
|
||||||
|
this.newAdSpecialTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.informationLabel = new System.Windows.Forms.Label();
|
||||||
|
this.adSpecialDescription = new System.Windows.Forms.Label();
|
||||||
|
this.descriptionTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.adSpecialsListBox = new System.Windows.Forms.ListView();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// registerAdSpecialButton
|
||||||
|
//
|
||||||
|
this.registerAdSpecialButton.Enabled = false;
|
||||||
|
this.registerAdSpecialButton.Location = new System.Drawing.Point(476, 428);
|
||||||
|
this.registerAdSpecialButton.Name = "registerAdSpecialButton";
|
||||||
|
this.registerAdSpecialButton.Size = new System.Drawing.Size(200, 50);
|
||||||
|
this.registerAdSpecialButton.TabIndex = 0;
|
||||||
|
this.registerAdSpecialButton.Text = "Register Ad Special";
|
||||||
|
this.registerAdSpecialButton.UseVisualStyleBackColor = true;
|
||||||
|
this.registerAdSpecialButton.Click += new System.EventHandler(this.RegisterNewAdSpecial);
|
||||||
|
//
|
||||||
|
// deleteAdSpecialButton
|
||||||
|
//
|
||||||
|
this.deleteAdSpecialButton.Enabled = false;
|
||||||
|
this.deleteAdSpecialButton.Location = new System.Drawing.Point(13, 428);
|
||||||
|
this.deleteAdSpecialButton.Name = "deleteAdSpecialButton";
|
||||||
|
this.deleteAdSpecialButton.Size = new System.Drawing.Size(200, 50);
|
||||||
|
this.deleteAdSpecialButton.TabIndex = 2;
|
||||||
|
this.deleteAdSpecialButton.Text = "Remove Ad Special";
|
||||||
|
this.deleteAdSpecialButton.UseVisualStyleBackColor = true;
|
||||||
|
this.deleteAdSpecialButton.Click += new System.EventHandler(this.deleteAdSpecialButton_Click);
|
||||||
|
//
|
||||||
|
// newAdSpecialLabel
|
||||||
|
//
|
||||||
|
this.newAdSpecialLabel.AutoSize = true;
|
||||||
|
this.newAdSpecialLabel.Location = new System.Drawing.Point(17, 21);
|
||||||
|
this.newAdSpecialLabel.Name = "newAdSpecialLabel";
|
||||||
|
this.newAdSpecialLabel.Size = new System.Drawing.Size(233, 25);
|
||||||
|
this.newAdSpecialLabel.TabIndex = 3;
|
||||||
|
this.newAdSpecialLabel.Text = "Register New Ad Special:";
|
||||||
|
//
|
||||||
|
// newAdSpecialTextBox
|
||||||
|
//
|
||||||
|
this.newAdSpecialTextBox.Location = new System.Drawing.Point(17, 54);
|
||||||
|
this.newAdSpecialTextBox.Name = "newAdSpecialTextBox";
|
||||||
|
this.newAdSpecialTextBox.Size = new System.Drawing.Size(228, 29);
|
||||||
|
this.newAdSpecialTextBox.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// informationLabel
|
||||||
|
//
|
||||||
|
this.informationLabel.AutoSize = true;
|
||||||
|
this.informationLabel.Location = new System.Drawing.Point(17, 171);
|
||||||
|
this.informationLabel.Name = "informationLabel";
|
||||||
|
this.informationLabel.Size = new System.Drawing.Size(64, 25);
|
||||||
|
this.informationLabel.TabIndex = 5;
|
||||||
|
this.informationLabel.Text = "label1";
|
||||||
|
//
|
||||||
|
// adSpecialDescription
|
||||||
|
//
|
||||||
|
this.adSpecialDescription.AutoSize = true;
|
||||||
|
this.adSpecialDescription.Location = new System.Drawing.Point(17, 91);
|
||||||
|
this.adSpecialDescription.Name = "adSpecialDescription";
|
||||||
|
this.adSpecialDescription.Size = new System.Drawing.Size(207, 25);
|
||||||
|
this.adSpecialDescription.TabIndex = 6;
|
||||||
|
this.adSpecialDescription.Text = "Description (Optional):";
|
||||||
|
//
|
||||||
|
// descriptionTextBox
|
||||||
|
//
|
||||||
|
this.descriptionTextBox.Location = new System.Drawing.Point(17, 124);
|
||||||
|
this.descriptionTextBox.Name = "descriptionTextBox";
|
||||||
|
this.descriptionTextBox.Size = new System.Drawing.Size(228, 29);
|
||||||
|
this.descriptionTextBox.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// adSpecialsListBox
|
||||||
|
//
|
||||||
|
this.adSpecialsListBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||||
|
this.adSpecialsListBox.Location = new System.Drawing.Point(256, 21);
|
||||||
|
this.adSpecialsListBox.Name = "adSpecialsListBox";
|
||||||
|
this.adSpecialsListBox.Size = new System.Drawing.Size(420, 401);
|
||||||
|
this.adSpecialsListBox.TabIndex = 8;
|
||||||
|
this.adSpecialsListBox.UseCompatibleStateImageBehavior = false;
|
||||||
|
this.adSpecialsListBox.View = System.Windows.Forms.View.Details;
|
||||||
|
//
|
||||||
|
// FrmRegisterAdSpecial
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(686, 489);
|
||||||
|
this.Controls.Add(this.adSpecialsListBox);
|
||||||
|
this.Controls.Add(this.descriptionTextBox);
|
||||||
|
this.Controls.Add(this.adSpecialDescription);
|
||||||
|
this.Controls.Add(this.informationLabel);
|
||||||
|
this.Controls.Add(this.newAdSpecialTextBox);
|
||||||
|
this.Controls.Add(this.newAdSpecialLabel);
|
||||||
|
this.Controls.Add(this.deleteAdSpecialButton);
|
||||||
|
this.Controls.Add(this.registerAdSpecialButton);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "FrmRegisterAdSpecial";
|
||||||
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "Register Ad Special";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button registerAdSpecialButton;
|
||||||
|
private System.Windows.Forms.Button deleteAdSpecialButton;
|
||||||
|
private System.Windows.Forms.Label newAdSpecialLabel;
|
||||||
|
private System.Windows.Forms.TextBox newAdSpecialTextBox;
|
||||||
|
private System.Windows.Forms.Label informationLabel;
|
||||||
|
private System.Windows.Forms.Label adSpecialDescription;
|
||||||
|
private System.Windows.Forms.TextBox descriptionTextBox;
|
||||||
|
private System.Windows.Forms.ListView adSpecialsListBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.Entity.Infrastructure;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AdvertsingProfitControl
|
||||||
|
{
|
||||||
|
public partial class FrmRegisterAdSpecial : Form
|
||||||
|
{
|
||||||
|
private readonly ToolTip _tt = new ToolTip();
|
||||||
|
private bool _isUpdating;
|
||||||
|
|
||||||
|
public FrmRegisterAdSpecial()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
newAdSpecialTextBox.TextChanged += NewAdSpecialTextChanged;
|
||||||
|
var columnHeader = new ColumnHeader
|
||||||
|
{
|
||||||
|
Name = "AdSpecialsHeaderColumn",
|
||||||
|
Text = @"Current Ad Special Grouping Keywords:",
|
||||||
|
Width = adSpecialsListBox.Width - 5
|
||||||
|
};
|
||||||
|
adSpecialsListBox.Columns.Add(columnHeader);
|
||||||
|
adSpecialsListBox.MouseMove += OnMouseMove;
|
||||||
|
adSpecialsListBox.ItemSelectionChanged += UpdateAdSpecialTextBoxes;
|
||||||
|
RefreshAdSpecialListing();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAdSpecialTextBoxes(object sender, ListViewItemSelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
newAdSpecialTextBox.Text = ((AdSpecial) e.Item.Tag).Name;
|
||||||
|
descriptionTextBox.Text = ((AdSpecial) e.Item.Tag).Description;
|
||||||
|
_isUpdating = true;
|
||||||
|
deleteAdSpecialButton.Enabled = true;
|
||||||
|
registerAdSpecialButton.Text = @"Update Ad Special";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NewAdSpecialTextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_isUpdating && newAdSpecialTextBox.Text.Length == 0)
|
||||||
|
{
|
||||||
|
_isUpdating = false;
|
||||||
|
descriptionTextBox.Text = string.Empty;
|
||||||
|
registerAdSpecialButton.Text = @"Register Ad Special";
|
||||||
|
}
|
||||||
|
registerAdSpecialButton.Enabled = newAdSpecialTextBox.Text.Length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RegisterNewAdSpecial(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var db = new AdvertisingProfitControlModel();
|
||||||
|
if (!_isUpdating)
|
||||||
|
{
|
||||||
|
if (!db.AdSpecials.Any(x => x.Name == newAdSpecialTextBox.Text))
|
||||||
|
{
|
||||||
|
var adSpecial = new AdSpecial
|
||||||
|
{
|
||||||
|
Name = newAdSpecialTextBox.Text,
|
||||||
|
Description = descriptionTextBox.Text
|
||||||
|
};
|
||||||
|
db.AdSpecials.Add(adSpecial);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.SaveChanges();
|
||||||
|
informationLabel.Text = @"Registered '" + Environment.NewLine + adSpecial.Name + Environment.NewLine + @"' successfully.";
|
||||||
|
}
|
||||||
|
catch (DbUpdateException ex)
|
||||||
|
{
|
||||||
|
informationLabel.Text = @"Failed to register '" + Environment.NewLine + adSpecial.Name + @"'." + Environment.NewLine +
|
||||||
|
ex.Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show(@"Ad Special '" + newAdSpecialTextBox.Text + @"' already exists.",
|
||||||
|
@"Duplicate Entry", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
newAdSpecialTextBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var item = adSpecialsListBox.SelectedItems[0];
|
||||||
|
var index = ((AdSpecial) item.Tag).Id;
|
||||||
|
var adSpecial = db.AdSpecials.SingleOrDefault(x => x.Id == index);
|
||||||
|
if (adSpecial == null)
|
||||||
|
{
|
||||||
|
informationLabel.Text = @"Failed to retrieve " + Environment.NewLine + @"ad special keyword ID.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
adSpecial.Name = newAdSpecialTextBox.Text;
|
||||||
|
adSpecial.Description = descriptionTextBox.Text;
|
||||||
|
db.SaveChanges();
|
||||||
|
informationLabel.Text = @"Updated '" + Environment.NewLine + newAdSpecialTextBox.Text + Environment.NewLine + @"' successfully.";
|
||||||
|
}
|
||||||
|
RefreshAdSpecialListing();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
var box = sender as ListBox;
|
||||||
|
if (box == null) return;
|
||||||
|
var listBox = box;
|
||||||
|
var point = new Point(e.X, e.Y);
|
||||||
|
var hoverIndex = listBox.IndexFromPoint(point);
|
||||||
|
if (hoverIndex >= 0 && hoverIndex < listBox.Items.Count)
|
||||||
|
{
|
||||||
|
// _tt.SetToolTip(listBox, _descriptions[hoverIndex]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshAdSpecialListing()
|
||||||
|
{
|
||||||
|
adSpecialsListBox.Items.Clear();
|
||||||
|
var db = new AdvertisingProfitControlModel();
|
||||||
|
var adSpecials = db.AdSpecials.Select(x => x);
|
||||||
|
foreach (var adSpecial in adSpecials)
|
||||||
|
{
|
||||||
|
var item = new ListViewItem
|
||||||
|
{
|
||||||
|
Text = adSpecial.Name,
|
||||||
|
Tag = adSpecial
|
||||||
|
};
|
||||||
|
adSpecialsListBox.Items.Add(item);
|
||||||
|
}
|
||||||
|
deleteAdSpecialButton.Enabled = false;
|
||||||
|
newAdSpecialTextBox.Text = string.Empty;
|
||||||
|
descriptionTextBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteAdSpecialButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//TODO: Scan for Ad Specials that are in use by a table before removing.
|
||||||
|
var item = adSpecialsListBox.SelectedItems[0];
|
||||||
|
var adSpecial = (AdSpecial) item.Tag;
|
||||||
|
var db = new AdvertisingProfitControlModel();
|
||||||
|
var ad = db.AdSpecials.Single(x => x.Id == adSpecial.Id);
|
||||||
|
db.AdSpecials.Remove(ad);
|
||||||
|
db.SaveChanges();
|
||||||
|
RefreshAdSpecialListing();
|
||||||
|
informationLabel.Text = @"Removed '" + Environment.NewLine + adSpecial.Name + Environment.NewLine + @"' successfully.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
@@ -29,12 +29,14 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
public int FkAdItemId { get; set; }
|
public int FkAdItemId { get; set; }
|
||||||
|
|
||||||
public int FkAdSpecialId { get; set; }
|
public int? FkAdSpecialId { get; set; }
|
||||||
|
|
||||||
public int FkDateId { get; set; }
|
public int FkDateId { get; set; }
|
||||||
|
|
||||||
public virtual AdItem AdItem { get; set; }
|
public virtual AdItem AdItem { get; set; }
|
||||||
|
|
||||||
|
public virtual AdSpecial AdSpecial { get; set; }
|
||||||
|
|
||||||
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ namespace AdvertsingProfitControl
|
|||||||
[Column(TypeName = "date")]
|
[Column(TypeName = "date")]
|
||||||
public DateTime InvoiceDate { get; set; }
|
public DateTime InvoiceDate { get; set; }
|
||||||
|
|
||||||
public int InvoiceNumber { get; set; }
|
[Required]
|
||||||
|
[StringLength(256)]
|
||||||
|
public string InvoiceNumber { get; set; }
|
||||||
|
|
||||||
public decimal? InvoiceNetAmountAtCost { get; set; }
|
public decimal? InvoiceNetAmountAtCost { get; set; }
|
||||||
|
|
||||||
@@ -27,7 +29,7 @@ namespace AdvertsingProfitControl
|
|||||||
public int FkDateId { get; set; }
|
public int FkDateId { get; set; }
|
||||||
|
|
||||||
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
||||||
[Required]
|
|
||||||
public virtual Supplier Supplier { get; set; }
|
public virtual Supplier Supplier { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-27
@@ -31,8 +31,9 @@
|
|||||||
this.mainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
this.mainLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
|
this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
|
||||||
this.FileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.FileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.clearFormFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.exitFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.exitFileMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.editMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.createNewRecordEditMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mainTabControl = new System.Windows.Forms.TabControl();
|
this.mainTabControl = new System.Windows.Forms.TabControl();
|
||||||
this.projectionTabPage = new System.Windows.Forms.TabPage();
|
this.projectionTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.projectionsDataGridView = new System.Windows.Forms.DataGridView();
|
this.projectionsDataGridView = new System.Windows.Forms.DataGridView();
|
||||||
@@ -106,8 +107,6 @@
|
|||||||
this.informationPanel = new System.Windows.Forms.Panel();
|
this.informationPanel = new System.Windows.Forms.Panel();
|
||||||
this.errorLabel = new System.Windows.Forms.Label();
|
this.errorLabel = new System.Windows.Forms.Label();
|
||||||
this.addRecordButton = new System.Windows.Forms.Button();
|
this.addRecordButton = new System.Windows.Forms.Button();
|
||||||
this.editMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.createNewRecordEditMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mainLayoutPanel.SuspendLayout();
|
this.mainLayoutPanel.SuspendLayout();
|
||||||
this.mainMenuStrip.SuspendLayout();
|
this.mainMenuStrip.SuspendLayout();
|
||||||
this.mainTabControl.SuspendLayout();
|
this.mainTabControl.SuspendLayout();
|
||||||
@@ -175,24 +174,32 @@
|
|||||||
// FileMainMenu
|
// FileMainMenu
|
||||||
//
|
//
|
||||||
this.FileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.FileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.clearFormFileMainMenu,
|
|
||||||
this.exitFileMainMenu});
|
this.exitFileMainMenu});
|
||||||
this.FileMainMenu.Name = "FileMainMenu";
|
this.FileMainMenu.Name = "FileMainMenu";
|
||||||
this.FileMainMenu.Size = new System.Drawing.Size(56, 31);
|
this.FileMainMenu.Size = new System.Drawing.Size(56, 31);
|
||||||
this.FileMainMenu.Text = "&File";
|
this.FileMainMenu.Text = "&File";
|
||||||
//
|
//
|
||||||
// clearFormFileMainMenu
|
|
||||||
//
|
|
||||||
this.clearFormFileMainMenu.Name = "clearFormFileMainMenu";
|
|
||||||
this.clearFormFileMainMenu.Size = new System.Drawing.Size(205, 34);
|
|
||||||
this.clearFormFileMainMenu.Text = "&Clear Form";
|
|
||||||
//
|
|
||||||
// exitFileMainMenu
|
// exitFileMainMenu
|
||||||
//
|
//
|
||||||
this.exitFileMainMenu.Name = "exitFileMainMenu";
|
this.exitFileMainMenu.Name = "exitFileMainMenu";
|
||||||
this.exitFileMainMenu.Size = new System.Drawing.Size(205, 34);
|
this.exitFileMainMenu.Size = new System.Drawing.Size(138, 34);
|
||||||
this.exitFileMainMenu.Text = "E&xit";
|
this.exitFileMainMenu.Text = "E&xit";
|
||||||
//
|
//
|
||||||
|
// editMainMenu
|
||||||
|
//
|
||||||
|
this.editMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.createNewRecordEditMainMenu});
|
||||||
|
this.editMainMenu.Name = "editMainMenu";
|
||||||
|
this.editMainMenu.Size = new System.Drawing.Size(60, 31);
|
||||||
|
this.editMainMenu.Text = "&Edit";
|
||||||
|
//
|
||||||
|
// createNewRecordEditMainMenu
|
||||||
|
//
|
||||||
|
this.createNewRecordEditMainMenu.Name = "createNewRecordEditMainMenu";
|
||||||
|
this.createNewRecordEditMainMenu.Size = new System.Drawing.Size(283, 34);
|
||||||
|
this.createNewRecordEditMainMenu.Text = "&Create New Record";
|
||||||
|
this.createNewRecordEditMainMenu.Click += new System.EventHandler(this.createNewRecordEditMainMenu_Click);
|
||||||
|
//
|
||||||
// mainTabControl
|
// mainTabControl
|
||||||
//
|
//
|
||||||
this.mainLayoutPanel.SetColumnSpan(this.mainTabControl, 4);
|
this.mainLayoutPanel.SetColumnSpan(this.mainTabControl, 4);
|
||||||
@@ -939,21 +946,6 @@
|
|||||||
this.addRecordButton.UseVisualStyleBackColor = true;
|
this.addRecordButton.UseVisualStyleBackColor = true;
|
||||||
this.addRecordButton.Click += new System.EventHandler(this.addRecordButton_Click);
|
this.addRecordButton.Click += new System.EventHandler(this.addRecordButton_Click);
|
||||||
//
|
//
|
||||||
// editMainMenu
|
|
||||||
//
|
|
||||||
this.editMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.createNewRecordEditMainMenu});
|
|
||||||
this.editMainMenu.Name = "editMainMenu";
|
|
||||||
this.editMainMenu.Size = new System.Drawing.Size(60, 31);
|
|
||||||
this.editMainMenu.Text = "&Edit";
|
|
||||||
//
|
|
||||||
// createNewRecordEditMainMenu
|
|
||||||
//
|
|
||||||
this.createNewRecordEditMainMenu.Name = "createNewRecordEditMainMenu";
|
|
||||||
this.createNewRecordEditMainMenu.Size = new System.Drawing.Size(283, 34);
|
|
||||||
this.createNewRecordEditMainMenu.Text = "&Create New Record";
|
|
||||||
this.createNewRecordEditMainMenu.Click += new System.EventHandler(this.createNewRecordEditMainMenu_Click);
|
|
||||||
//
|
|
||||||
// NewModifyRecord
|
// NewModifyRecord
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
|
||||||
@@ -1004,7 +996,6 @@
|
|||||||
private System.Windows.Forms.TableLayoutPanel mainLayoutPanel;
|
private System.Windows.Forms.TableLayoutPanel mainLayoutPanel;
|
||||||
private System.Windows.Forms.MenuStrip mainMenuStrip;
|
private System.Windows.Forms.MenuStrip mainMenuStrip;
|
||||||
private System.Windows.Forms.ToolStripMenuItem FileMainMenu;
|
private System.Windows.Forms.ToolStripMenuItem FileMainMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem clearFormFileMainMenu;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu;
|
private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu;
|
||||||
private System.Windows.Forms.TabControl mainTabControl;
|
private System.Windows.Forms.TabControl mainTabControl;
|
||||||
private System.Windows.Forms.TabPage projectionTabPage;
|
private System.Windows.Forms.TabPage projectionTabPage;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace AdvertsingProfitControl
|
|||||||
//
|
//
|
||||||
private bool _isFormDirty;
|
private bool _isFormDirty;
|
||||||
//
|
//
|
||||||
private FormRoll _formRoll;
|
private bool _isModifyingRecord;
|
||||||
public NewModifyRecord(DateTime date)
|
public NewModifyRecord(DateTime date)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -50,7 +50,7 @@ namespace AdvertsingProfitControl
|
|||||||
InitializeForm();
|
InitializeForm();
|
||||||
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
||||||
Text = @"Modify Record (Current Record: " + date.ToShortDateString() + @")";
|
Text = @"Modify Record (Current Record: " + date.ToShortDateString() + @")";
|
||||||
_formRoll = FormRoll.ModifyRecord;
|
_isModifyingRecord = true;
|
||||||
LoadDate(date);
|
LoadDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ namespace AdvertsingProfitControl
|
|||||||
//_debugTabPage = mainTabControl.TabPages[4];
|
//_debugTabPage = mainTabControl.TabPages[4];
|
||||||
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
||||||
Text = @"Add New Record (Current Record: " + _currentActiveDate.ToShortDateString() + @")";
|
Text = @"Add New Record (Current Record: " + _currentActiveDate.ToShortDateString() + @")";
|
||||||
_formRoll = FormRoll.AddRecord;
|
_isModifyingRecord = false;
|
||||||
addRecordButton.Text = @"Add Record";
|
addRecordButton.Text = @"Add Record";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2450,7 +2450,7 @@ namespace AdvertsingProfitControl
|
|||||||
if (e.Start == _currentActiveDate) return;
|
if (e.Start == _currentActiveDate) return;
|
||||||
if (!weekEndingCalendar.BoldedDates.Contains(e.Start))
|
if (!weekEndingCalendar.BoldedDates.Contains(e.Start))
|
||||||
{
|
{
|
||||||
if (_formRoll == FormRoll.AddRecord)
|
if (_isModifyingRecord == false)
|
||||||
{
|
{
|
||||||
_currentActiveDate = e.Start;
|
_currentActiveDate = e.Start;
|
||||||
Text = @"Add New Record (Current Record: " + e.Start.ToString("d") + @")";
|
Text = @"Add New Record (Current Record: " + e.Start.ToString("d") + @")";
|
||||||
@@ -2605,6 +2605,9 @@ namespace AdvertsingProfitControl
|
|||||||
//Clear the used ad items
|
//Clear the used ad items
|
||||||
_usedAdItems[0].Clear(); //regular ad items (section 1)
|
_usedAdItems[0].Clear(); //regular ad items (section 1)
|
||||||
_usedAdItems[1].Clear(); //ad special items (section 2)
|
_usedAdItems[1].Clear(); //ad special items (section 2)
|
||||||
|
//Reset the error label
|
||||||
|
errorLabel.Text = string.Empty;
|
||||||
|
errorLabel.ForeColor = Color.Red;
|
||||||
//Clear invoices
|
//Clear invoices
|
||||||
invoicesDataGridView.Rows.Clear();
|
invoicesDataGridView.Rows.Clear();
|
||||||
//Clear comments
|
//Clear comments
|
||||||
@@ -2734,7 +2737,7 @@ namespace AdvertsingProfitControl
|
|||||||
LoadWeeklySales(dateRecord);
|
LoadWeeklySales(dateRecord);
|
||||||
LoadTaxable(dateRecord);
|
LoadTaxable(dateRecord);
|
||||||
LoadCostAnalysis(dateRecord);
|
LoadCostAnalysis(dateRecord);
|
||||||
_formRoll = FormRoll.ModifyRecord;
|
_isModifyingRecord = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadProjectionsTable(WeekEndingDate dateRecord)
|
private void LoadProjectionsTable(WeekEndingDate dateRecord)
|
||||||
@@ -2752,7 +2755,7 @@ namespace AdvertsingProfitControl
|
|||||||
var index = 0;
|
var index = 0;
|
||||||
foreach (var projection in projections)
|
foreach (var projection in projections)
|
||||||
{
|
{
|
||||||
if (projection.FkAdSpecialId != 0 && adSpecialIndex == -1)
|
if (projection.FkAdSpecialId != null && adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
adSpecialIndex = index;
|
adSpecialIndex = index;
|
||||||
projectionsDataGridView.Rows.Insert(index, 1);
|
projectionsDataGridView.Rows.Insert(index, 1);
|
||||||
@@ -2816,7 +2819,7 @@ namespace AdvertsingProfitControl
|
|||||||
var index = 0;
|
var index = 0;
|
||||||
foreach (var inventory in inventories)
|
foreach (var inventory in inventories)
|
||||||
{
|
{
|
||||||
if (inventory.FkAdSpecialId != 0 && adSpecialIndex == -1)
|
if (inventory.FkAdSpecialId != null && adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
adSpecialIndex = index;
|
adSpecialIndex = index;
|
||||||
inventoryDataGridView.Rows.Insert(index, 1);
|
inventoryDataGridView.Rows.Insert(index, 1);
|
||||||
@@ -2878,7 +2881,7 @@ namespace AdvertsingProfitControl
|
|||||||
var index = 0;
|
var index = 0;
|
||||||
foreach (var actualSale in actualSales)
|
foreach (var actualSale in actualSales)
|
||||||
{
|
{
|
||||||
if (actualSale.FkAdSpecialId != 0 && adSpecialIndex == -1)
|
if (actualSale.FkAdSpecialId != null && adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
adSpecialIndex = index;
|
adSpecialIndex = index;
|
||||||
actualSalesDataGridView.Rows.Insert(index, 1);
|
actualSalesDataGridView.Rows.Insert(index, 1);
|
||||||
@@ -3211,20 +3214,20 @@ namespace AdvertsingProfitControl
|
|||||||
//Prevent the ad special row from being marked in any way.
|
//Prevent the ad special row from being marked in any way.
|
||||||
if (i == _adSpecialIndex) continue;
|
if (i == _adSpecialIndex) continue;
|
||||||
//Prevent rows pulled from that the database, that haven't been touched, from being marked as well.
|
//Prevent rows pulled from that the database, that haven't been touched, from being marked as well.
|
||||||
if ((bool) projectionsDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].EditedFormattedValue)
|
if ((bool) projectionsDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].EditedFormattedValue && projectionsDataGridView.Rows[i].Cells[(int) SalesTableColumns.Id].EditedFormattedValue.ToString() != string.Empty)
|
||||||
{
|
{
|
||||||
projectionsDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].Value = false;
|
projectionsDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].Value = false;
|
||||||
projectionsDataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
projectionsDataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
}
|
}
|
||||||
//Prevent rows pulled from that the database, that haven't been touched, from being marked as well.
|
//Prevent rows pulled from that the database, that haven't been touched, from being marked as well.
|
||||||
if ((bool) inventoryDataGridView.Rows[i].Cells[(int)InventoryTableColumns.IsDirty].EditedFormattedValue)
|
if ((bool) inventoryDataGridView.Rows[i].Cells[(int)InventoryTableColumns.IsDirty].EditedFormattedValue && inventoryDataGridView.Rows[i].Cells[(int)InventoryTableColumns.Id].EditedFormattedValue.ToString() != string.Empty)
|
||||||
{
|
{
|
||||||
inventoryDataGridView.Rows[i].Cells[(int) InventoryTableColumns.IsDirty].Value = false;
|
inventoryDataGridView.Rows[i].Cells[(int) InventoryTableColumns.IsDirty].Value = false;
|
||||||
inventoryDataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
inventoryDataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
}
|
}
|
||||||
//Prevent rows pulled from that the database, that haven't been touched, from being marked as well.
|
//Prevent rows pulled from that the database, that haven't been touched, from being marked as well.
|
||||||
if (!(bool)
|
if (!(bool)
|
||||||
actualSalesDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].EditedFormattedValue)
|
actualSalesDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].EditedFormattedValue && actualSalesDataGridView.Rows[i].Cells[(int)SalesTableColumns.Id].EditedFormattedValue.ToString() != string.Empty)
|
||||||
continue;
|
continue;
|
||||||
actualSalesDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].Value = false;
|
actualSalesDataGridView.Rows[i].Cells[(int) SalesTableColumns.IsDirty].Value = false;
|
||||||
actualSalesDataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
actualSalesDataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
@@ -3275,7 +3278,7 @@ namespace AdvertsingProfitControl
|
|||||||
_isFormDirty = false;
|
_isFormDirty = false;
|
||||||
addRecordButton.Text = @"Update Record";
|
addRecordButton.Text = @"Update Record";
|
||||||
Text = @"Modify Record (Current Record: " + _currentActiveDate.ToShortDateString() + @")";
|
Text = @"Modify Record (Current Record: " + _currentActiveDate.ToShortDateString() + @")";
|
||||||
_formRoll = FormRoll.ModifyRecord;
|
_isModifyingRecord = true;
|
||||||
weekEndingCalendar.AddBoldedDate(_currentActiveDate);
|
weekEndingCalendar.AddBoldedDate(_currentActiveDate);
|
||||||
weekEndingCalendar.Invalidate();
|
weekEndingCalendar.Invalidate();
|
||||||
return success;
|
return success;
|
||||||
@@ -3307,6 +3310,15 @@ namespace AdvertsingProfitControl
|
|||||||
if (row.Index == _adSpecialIndex)
|
if (row.Index == _adSpecialIndex)
|
||||||
{
|
{
|
||||||
adSpecial = GetAdSpecial(adItemName);
|
adSpecial = GetAdSpecial(adItemName);
|
||||||
|
//Check to see if the ad special return value exists.
|
||||||
|
if (adSpecial.Id == 0)
|
||||||
|
{
|
||||||
|
//Warn the user about the error and break out of the loop.
|
||||||
|
//We can simply ignore the ad special group and write the rest to the database.
|
||||||
|
errorLabel.Text = @"Warning: ad special group '" + adItemName + @"' failed to" + Environment.NewLine + @"write to the database." + Environment.NewLine + @"All rows starting from " + (_adSpecialIndex + 1) + @" to " + (projectionsDataGridView.RowCount - 1) + @" will not be saved.";
|
||||||
|
errorLabel.ForeColor = Color.Orange;
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Check to see if the ad item is in the database and if so grab the object for it, otherwise add it.
|
//Check to see if the ad item is in the database and if so grab the object for it, otherwise add it.
|
||||||
@@ -3340,7 +3352,7 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
projection.FkAdSpecialId = 0;
|
projection.FkAdSpecialId = null;
|
||||||
}
|
}
|
||||||
//Check for an ID number
|
//Check for an ID number
|
||||||
if (row.Cells[(int)SalesTableColumns.Id].EditedFormattedValue.ToString() == string.Empty)
|
if (row.Cells[(int)SalesTableColumns.Id].EditedFormattedValue.ToString() == string.Empty)
|
||||||
@@ -3375,7 +3387,7 @@ namespace AdvertsingProfitControl
|
|||||||
? 0
|
? 0
|
||||||
: decimal.Parse(
|
: decimal.Parse(
|
||||||
row.Cells[(int) SalesTableColumns.TotalProfitReturn].EditedFormattedValue
|
row.Cells[(int) SalesTableColumns.TotalProfitReturn].EditedFormattedValue
|
||||||
.ToString());
|
.ToString());
|
||||||
projection.FkAdItemId = adItem.Id;
|
projection.FkAdItemId = adItem.Id;
|
||||||
projection.RowAttribute = rowAttribute;
|
projection.RowAttribute = rowAttribute;
|
||||||
projection.RowPosition = row.Index + 1;
|
projection.RowPosition = row.Index + 1;
|
||||||
@@ -3470,6 +3482,15 @@ namespace AdvertsingProfitControl
|
|||||||
if (row.Index == _adSpecialIndex)
|
if (row.Index == _adSpecialIndex)
|
||||||
{
|
{
|
||||||
adSpecial = GetAdSpecial(adItemName);
|
adSpecial = GetAdSpecial(adItemName);
|
||||||
|
//Check to see if the ad special return value exists.
|
||||||
|
if (adSpecial.Id == 0)
|
||||||
|
{
|
||||||
|
//Warn the user about the error and break out of the loop.
|
||||||
|
//We can simply ignore the ad special group and write the rest to the database.
|
||||||
|
errorLabel.Text = @"Warning: ad special group '" + adItemName + @"' failed to" + Environment.NewLine + @"write to the database." + Environment.NewLine + @"All rows starting from " + (_adSpecialIndex + 1) + @" to " + (projectionsDataGridView.RowCount - 1) + @" will not be saved.";
|
||||||
|
errorLabel.ForeColor = Color.Orange;
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Check to see if the ad item is in the database and if so grab the object for it, otherwise add it.
|
//Check to see if the ad item is in the database and if so grab the object for it, otherwise add it.
|
||||||
@@ -3503,7 +3524,7 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inventory.FkAdSpecialId = 0;
|
inventory.FkAdSpecialId = null;
|
||||||
}
|
}
|
||||||
//Check for an ID number
|
//Check for an ID number
|
||||||
if (row.Cells[(int)InventoryTableColumns.Id].EditedFormattedValue.ToString() == string.Empty)
|
if (row.Cells[(int)InventoryTableColumns.Id].EditedFormattedValue.ToString() == string.Empty)
|
||||||
@@ -3595,6 +3616,15 @@ namespace AdvertsingProfitControl
|
|||||||
if (row.Index == _adSpecialIndex)
|
if (row.Index == _adSpecialIndex)
|
||||||
{
|
{
|
||||||
adSpecial = GetAdSpecial(adItemName);
|
adSpecial = GetAdSpecial(adItemName);
|
||||||
|
//Check to see if the ad special return value exists.
|
||||||
|
if (adSpecial.Id == 0)
|
||||||
|
{
|
||||||
|
//Warn the user about the error and break out of the loop.
|
||||||
|
//We can simply ignore the ad special group and write the rest to the database.
|
||||||
|
errorLabel.Text = @"Warning: ad special group '" + adItemName + @"' failed to" + Environment.NewLine + @"write to the database." + Environment.NewLine + @"All rows starting from " + (_adSpecialIndex + 1) + @" to " + (projectionsDataGridView.RowCount - 1) + @" will not be saved.";
|
||||||
|
errorLabel.ForeColor = Color.Orange;
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Check to see if the ad item is in the database and if so grab the object for it, otherwise add it.
|
//Check to see if the ad item is in the database and if so grab the object for it, otherwise add it.
|
||||||
@@ -3628,7 +3658,7 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actualSale.FkAdSpecialId = 0;
|
actualSale.FkAdSpecialId = null;
|
||||||
}
|
}
|
||||||
//Check for an ID number
|
//Check for an ID number
|
||||||
if (row.Cells[(int)SalesTableColumns.Id].EditedFormattedValue.ToString() == string.Empty)
|
if (row.Cells[(int)SalesTableColumns.Id].EditedFormattedValue.ToString() == string.Empty)
|
||||||
@@ -3772,7 +3802,7 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
//If there isn't one then create a new record and add it to the database.
|
//If there isn't one then create a new record and add it to the database.
|
||||||
invoice.InvoiceDate = DateTime.Parse(row.Cells[(int)InvoiceTableColumns.InvoiceDate].EditedFormattedValue.ToString());
|
invoice.InvoiceDate = DateTime.Parse(row.Cells[(int)InvoiceTableColumns.InvoiceDate].EditedFormattedValue.ToString());
|
||||||
invoice.InvoiceNumber = int.Parse(row.Cells[(int)InvoiceTableColumns.InvoiceNumber].EditedFormattedValue.ToString());
|
invoice.InvoiceNumber = row.Cells[(int)InvoiceTableColumns.InvoiceNumber].EditedFormattedValue.ToString();
|
||||||
invoice.InvoiceNetAmountAtCost =
|
invoice.InvoiceNetAmountAtCost =
|
||||||
string.IsNullOrWhiteSpace(
|
string.IsNullOrWhiteSpace(
|
||||||
row.Cells[(int)InvoiceTableColumns.InvoiceNetAmountAtCost].EditedFormattedValue.ToString())
|
row.Cells[(int)InvoiceTableColumns.InvoiceNetAmountAtCost].EditedFormattedValue.ToString())
|
||||||
@@ -3800,10 +3830,7 @@ namespace AdvertsingProfitControl
|
|||||||
invoice.InvoiceDate =
|
invoice.InvoiceDate =
|
||||||
DateTime.Parse(
|
DateTime.Parse(
|
||||||
row.Cells[(int) InvoiceTableColumns.InvoiceDate].EditedFormattedValue.ToString());
|
row.Cells[(int) InvoiceTableColumns.InvoiceDate].EditedFormattedValue.ToString());
|
||||||
invoice.InvoiceNumber =
|
invoice.InvoiceNumber = row.Cells[(int) InvoiceTableColumns.InvoiceNumber].EditedFormattedValue.ToString();
|
||||||
int.Parse(
|
|
||||||
row.Cells[(int) InvoiceTableColumns.InvoiceNumber].EditedFormattedValue.ToString
|
|
||||||
());
|
|
||||||
invoice.InvoiceNetAmountAtCost =
|
invoice.InvoiceNetAmountAtCost =
|
||||||
string.IsNullOrWhiteSpace(
|
string.IsNullOrWhiteSpace(
|
||||||
row.Cells[(int) InvoiceTableColumns.InvoiceNetAmountAtCost].EditedFormattedValue
|
row.Cells[(int) InvoiceTableColumns.InvoiceNetAmountAtCost].EditedFormattedValue
|
||||||
@@ -4250,7 +4277,7 @@ namespace AdvertsingProfitControl
|
|||||||
Text = @"Add New Record (Current Date: " + _currentActiveDate.ToShortDateString() + @")";
|
Text = @"Add New Record (Current Date: " + _currentActiveDate.ToShortDateString() + @")";
|
||||||
informationLabel.Text = string.Empty;
|
informationLabel.Text = string.Empty;
|
||||||
errorLabel.Text = string.Empty;
|
errorLabel.Text = string.Empty;
|
||||||
_formRoll = FormRoll.AddRecord;
|
_isModifyingRecord = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NormalizeApcTables()
|
private void NormalizeApcTables()
|
||||||
@@ -4436,10 +4463,5 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum FormRoll
|
|
||||||
{
|
|
||||||
AddRecord = 0,
|
|
||||||
ModifyRecord = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,14 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
public int FkAdItemId { get; set; }
|
public int FkAdItemId { get; set; }
|
||||||
|
|
||||||
public int FkAdSpecialId { get; set; }
|
public int? FkAdSpecialId { get; set; }
|
||||||
|
|
||||||
public int FkDateId { get; set; }
|
public int FkDateId { get; set; }
|
||||||
|
|
||||||
public virtual AdItem AdItem { get; set; }
|
public virtual AdItem AdItem { get; set; }
|
||||||
|
|
||||||
|
public virtual AdSpecial AdSpecial { get; set; }
|
||||||
|
|
||||||
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
public virtual WeekEndingDate WeekEndingDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user