Updated how the record manipulation form behaves when adding new records, allowing the user to select a new date freely. May be the final update before the Entity Update.
This commit is contained in:
@@ -37,7 +37,8 @@ namespace AdvertsingProfitControl
|
||||
private DateTime _currentActiveDate;
|
||||
//
|
||||
private bool _isFormDirty;
|
||||
|
||||
//
|
||||
private FormRoll _formRoll;
|
||||
public NewModifyRecord(DateTime date)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -158,6 +159,7 @@ namespace AdvertsingProfitControl
|
||||
//_debugTabPage = mainTabControl.TabPages[4];
|
||||
//mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
||||
Text = @"Modify Record (Current Record: " + date.ToShortDateString() + @")";
|
||||
_formRoll = FormRoll.ModifyRecord;
|
||||
LoadDate(date);
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@ namespace AdvertsingProfitControl
|
||||
var databaseTracker = new DatabaseTracker();
|
||||
var databaseReader = new DatabaseReader();
|
||||
weekEndingCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
|
||||
SetNewRecordDate(databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString), 2);
|
||||
SetNewRecordDate(databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString), 1);
|
||||
_currentActiveDate = weekEndingCalendar.SelectionStart;
|
||||
//next pull all the ad items into memory.
|
||||
_adItemCollection = databaseReader.GetAdItemsSuggestionList(databaseTracker.DatabaseConnectionString);
|
||||
@@ -280,6 +282,7 @@ namespace AdvertsingProfitControl
|
||||
//_debugTabPage = mainTabControl.TabPages[4];
|
||||
//mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
||||
Text = @"Add New Record (Current Record: " + _currentActiveDate.ToShortDateString() + @")";
|
||||
_formRoll = FormRoll.AddRecord;
|
||||
addRecordButton.Text = @"Add Record";
|
||||
}
|
||||
|
||||
@@ -2552,7 +2555,46 @@ namespace AdvertsingProfitControl
|
||||
|
||||
private void ValidateDateChanged(object sender, DateRangeEventArgs e)
|
||||
{
|
||||
if (e.Start == _currentActiveDate || !weekEndingCalendar.BoldedDates.Contains(e.Start)) return;
|
||||
if (e.Start == _currentActiveDate) return;
|
||||
if (!weekEndingCalendar.BoldedDates.Contains(e.Start))
|
||||
{
|
||||
if (_formRoll == FormRoll.AddRecord)
|
||||
{
|
||||
//If the form is dirty then prompt the user to save changes.
|
||||
if (_isFormDirty)
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
@"Would you like to save the changes you have made to this record?", @"Changes Detected",
|
||||
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
//Save the changes made to the database then clear and load the date picked by the user.
|
||||
if (SaveRecords(false))
|
||||
{
|
||||
informationLabel.Text = @"Saved all changes successfully." + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorLabel.Text = @"Failed to save all changes." + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
else if (result == DialogResult.Cancel)
|
||||
{
|
||||
//Cancel this method, select the active current date and return.
|
||||
weekEndingCalendar.SelectionStart = _currentActiveDate;
|
||||
}
|
||||
//The "No" button doesn't need to be processed since it just means continue on with the method.
|
||||
}
|
||||
else
|
||||
{
|
||||
//Change the active date of the form.
|
||||
_currentActiveDate = e.Start;
|
||||
Text = Text = @"Add New Record (Current Record: " + e.Start.ToString("d") + @")";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the form is dirty then prompt the user to save changes.
|
||||
if (_isFormDirty)
|
||||
{
|
||||
@@ -2567,6 +2609,7 @@ namespace AdvertsingProfitControl
|
||||
else
|
||||
{
|
||||
errorLabel.Text = @"Failed to save all changes." + Environment.NewLine;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (result == DialogResult.Cancel)
|
||||
@@ -2585,6 +2628,7 @@ namespace AdvertsingProfitControl
|
||||
//Load the specified date from the database.
|
||||
LoadDate(e.Start);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetNewRecordDate(DateTime date, int weeksAhead = 0)
|
||||
{
|
||||
@@ -2865,6 +2909,7 @@ namespace AdvertsingProfitControl
|
||||
{
|
||||
informationLabel.Text += @"No cost analysis data to display." + Environment.NewLine;
|
||||
}
|
||||
_formRoll = FormRoll.ModifyRecord;
|
||||
}
|
||||
|
||||
private void LoadProjectionsTable(DataTable projections)
|
||||
@@ -3573,6 +3618,11 @@ namespace AdvertsingProfitControl
|
||||
{
|
||||
var success = true;
|
||||
//Get the date ID for the current active date.
|
||||
if (_currentActiveDate.DayOfWeek != DayOfWeek.Saturday)
|
||||
{
|
||||
SetNewRecordDate(_currentActiveDate);
|
||||
_currentActiveDate = weekEndingCalendar.SelectionStart;
|
||||
}
|
||||
var dateId = GetDateId(_currentActiveDate.ToString("d"));
|
||||
if (dateId == 0)
|
||||
{
|
||||
@@ -3769,6 +3819,7 @@ namespace AdvertsingProfitControl
|
||||
addRecordButton.Text = @"Update Record";
|
||||
Text = @"Modify Record (Current Record: " + _currentActiveDate.ToShortDateString() + @")";
|
||||
}
|
||||
_formRoll = FormRoll.ModifyRecord;
|
||||
weekEndingCalendar.AddBoldedDate(_currentActiveDate);
|
||||
weekEndingCalendar.Invalidate();
|
||||
return success;
|
||||
@@ -4359,6 +4410,7 @@ namespace AdvertsingProfitControl
|
||||
Text = @"Add New Record (Current Date: " + _currentActiveDate.ToShortDateString() + @")";
|
||||
informationLabel.Text = string.Empty;
|
||||
errorLabel.Text = string.Empty;
|
||||
_formRoll = FormRoll.AddRecord;
|
||||
}
|
||||
|
||||
private void NormalizeApcTables()
|
||||
@@ -4543,5 +4595,11 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum FormRoll
|
||||
{
|
||||
AddRecord = 0,
|
||||
ModifyRecord = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.9.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.9.2.0")]
|
||||
[assembly: AssemblyVersion("1.9.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.9.3.0")]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>Cu5j9/buzIqFXwUVaREpWMereptetrOpSA4RfZP4zPs=</dsig:DigestValue>
|
||||
<dsig:DigestValue>wZKyz33oBaTu7LlzGeOCxkM7UGOPV8kZeC+ZUmNCdwY=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="2433536">
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="2434048">
|
||||
<assemblyIdentity name="AdvertsingProfitControl" version="1.9.2.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>IfKNnpS3AvxJQzSAD+uL9oD6uCKebOR0f5N0pEztZ20=</dsig:DigestValue>
|
||||
<dsig:DigestValue>Go6lCPrcJgk3GBchewQqB1BCxQhEtIFVMBBGG72lMB8=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
@@ -78,13 +78,13 @@
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<file name="APCDatabase Template Script.sql" size="5400">
|
||||
<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>e48EkTyChGHXYJETENSLw7RKQ1LZ5ZDUghEtiv5DmqY=</dsig:DigestValue>
|
||||
<dsig:DigestValue>hrCGS0Sn5+IzPQDdJqcLf/Le8W/IzTyGRSduCe/L7Yo=</dsig:DigestValue>
|
||||
</hash>
|
||||
</file>
|
||||
<file name="APCDatabase.accdb" size="864256">
|
||||
|
||||
Reference in New Issue
Block a user