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