Fixed a bug that caused the ModifyRecord form to crash on load if the cursor was over the top left hand header cell. Set a timeout for the restore SQL statement to hopefully prevent a timeout exception from being thrown. Minor code clean up.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AdvertsingProfitControl</RootNamespace>
|
||||
<AssemblyName>AdvertsingProfitControl</AssemblyName>
|
||||
<AssemblyName>AdvertisingProfitControl</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
}
|
||||
|
||||
if (backup.SingleFileBackup(customBackupLocation))
|
||||
if (backup.SingleFileBackup(Properties.Settings.Default.ConnectionString, customBackupLocation))
|
||||
{
|
||||
//Check the state of the backup.
|
||||
if (backup.State == 0)
|
||||
@@ -196,7 +196,7 @@ namespace AdvertsingProfitControl
|
||||
return;
|
||||
}
|
||||
|
||||
if (restore.SingleFileRestore(restoreLocationTextBox.Text, Properties.Settings.Default.DefaultServer))
|
||||
if (restore.SingleFileRestore(restoreLocationTextBox.Text, Properties.Settings.Default.ConnectionString))
|
||||
{
|
||||
restoreResultLabel.Text = @"Successfully restored the database.";
|
||||
restoreLocationTextBox.Text = string.Empty;
|
||||
|
||||
+7
-17
@@ -41,7 +41,6 @@
|
||||
this.informationLabel = new System.Windows.Forms.Label();
|
||||
this.mainMenu = new System.Windows.Forms.MenuStrip();
|
||||
this.databaseToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.backupRestoreMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.checkIntegrityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -70,7 +69,7 @@
|
||||
//
|
||||
this.connectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.connectButton.Location = new System.Drawing.Point(421, 257);
|
||||
this.connectButton.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
|
||||
this.connectButton.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.connectButton.Name = "connectButton";
|
||||
this.connectButton.Size = new System.Drawing.Size(128, 35);
|
||||
this.connectButton.TabIndex = 5;
|
||||
@@ -87,7 +86,7 @@
|
||||
"Windows Authentication",
|
||||
"SQL Server Authentication"});
|
||||
this.authenticationTypeComboBox.Location = new System.Drawing.Point(146, 108);
|
||||
this.authenticationTypeComboBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.authenticationTypeComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.authenticationTypeComboBox.MaxDropDownItems = 5;
|
||||
this.authenticationTypeComboBox.Name = "authenticationTypeComboBox";
|
||||
this.authenticationTypeComboBox.Size = new System.Drawing.Size(230, 28);
|
||||
@@ -117,7 +116,7 @@
|
||||
//
|
||||
this.loginTextBox.Enabled = false;
|
||||
this.loginTextBox.Location = new System.Drawing.Point(146, 163);
|
||||
this.loginTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.loginTextBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.loginTextBox.Name = "loginTextBox";
|
||||
this.loginTextBox.Size = new System.Drawing.Size(230, 26);
|
||||
this.loginTextBox.TabIndex = 3;
|
||||
@@ -126,7 +125,7 @@
|
||||
//
|
||||
this.passwordTextBox.Enabled = false;
|
||||
this.passwordTextBox.Location = new System.Drawing.Point(146, 216);
|
||||
this.passwordTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.passwordTextBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.passwordTextBox.Name = "passwordTextBox";
|
||||
this.passwordTextBox.PasswordChar = '*';
|
||||
this.passwordTextBox.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
@@ -137,7 +136,7 @@
|
||||
//
|
||||
this.serverNameComboBox.FormattingEnabled = true;
|
||||
this.serverNameComboBox.Location = new System.Drawing.Point(146, 53);
|
||||
this.serverNameComboBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.serverNameComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.serverNameComboBox.Name = "serverNameComboBox";
|
||||
this.serverNameComboBox.Size = new System.Drawing.Size(371, 28);
|
||||
this.serverNameComboBox.TabIndex = 1;
|
||||
@@ -166,23 +165,15 @@
|
||||
// databaseToolsToolStripMenuItem
|
||||
//
|
||||
this.databaseToolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.backupRestoreMainMenu,
|
||||
this.checkIntegrityToolStripMenuItem});
|
||||
this.databaseToolsToolStripMenuItem.Name = "databaseToolsToolStripMenuItem";
|
||||
this.databaseToolsToolStripMenuItem.Size = new System.Drawing.Size(144, 29);
|
||||
this.databaseToolsToolStripMenuItem.Text = "&Database Tools";
|
||||
//
|
||||
// backupRestoreMainMenu
|
||||
//
|
||||
this.backupRestoreMainMenu.Name = "backupRestoreMainMenu";
|
||||
this.backupRestoreMainMenu.Size = new System.Drawing.Size(252, 30);
|
||||
this.backupRestoreMainMenu.Text = "&Backup and Restore";
|
||||
this.backupRestoreMainMenu.Click += new System.EventHandler(this.backupRestoreToolStripMenuItem_Click);
|
||||
//
|
||||
// checkIntegrityToolStripMenuItem
|
||||
//
|
||||
this.checkIntegrityToolStripMenuItem.Name = "checkIntegrityToolStripMenuItem";
|
||||
this.checkIntegrityToolStripMenuItem.Size = new System.Drawing.Size(252, 30);
|
||||
this.checkIntegrityToolStripMenuItem.Size = new System.Drawing.Size(214, 30);
|
||||
this.checkIntegrityToolStripMenuItem.Text = "&Check Integrity";
|
||||
this.checkIntegrityToolStripMenuItem.Click += new System.EventHandler(this.checkIntegrityToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -206,7 +197,7 @@
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this.mainMenu;
|
||||
this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
|
||||
this.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "FrmLoginForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
@@ -231,7 +222,6 @@
|
||||
private System.Windows.Forms.Label informationLabel;
|
||||
private System.Windows.Forms.MenuStrip mainMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem databaseToolsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem backupRestoreMainMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem checkIntegrityToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -512,8 +512,7 @@ namespace AdvertsingProfitControl
|
||||
var adSpecialIndex = -1;
|
||||
decimal totalSales = 0;
|
||||
decimal totalProfitReturn = 0;
|
||||
var projections = db.Projections.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x).OrderBy(x => x.RowPosition);
|
||||
|
||||
var projections = db.Projections.Where(x => x.WeekEndingDate.Id == dateRecord.Id).Select(x => x).OrderBy(x => x.RowPosition);
|
||||
foreach (var p in projections)
|
||||
{
|
||||
projectionsDataGridView.Rows.Add();
|
||||
|
||||
@@ -77,14 +77,13 @@ namespace AdvertsingProfitControl
|
||||
|
||||
public NewModifyRecord(DateTime date)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
//
|
||||
weekEndingCalendar.SelectionStart = date;
|
||||
_currentActiveDate = date;
|
||||
InitializeForm();
|
||||
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
|
||||
Text = @"Modify Record (Current Record: " + date.ToShortDateString() + @")";
|
||||
_isModifyingRecord = true;
|
||||
LoadDate(date);
|
||||
}
|
||||
|
||||
@@ -2728,6 +2727,14 @@ out double beginningBinCount, out string _))
|
||||
|
||||
public void InitializeForm()
|
||||
{
|
||||
//Apply a little nonsense fix for a but that occurs with the DataGridView control where if a cursor
|
||||
//is placed over the top left hand header cell, it causes an InvalidOperationException. This mainly
|
||||
//effects this form when its overloaded constructor is called since the mouse cursor is right on top
|
||||
//of the aforementioned cell after clicking the "Modify Existing Record" menu option on the main form.
|
||||
//More info one the bug here https://stackoverflow.com/questions/34344499/invalidoperationexception-this-operation-cannot-be-performed-while-an-auto-fill
|
||||
//The following fix is applied to the projections DataGridView since its the first grid displayed to the user.
|
||||
//The fix is simple however, force the form to create the cell as follows:
|
||||
var projectionsLeftHeaderCell = projectionsDataGridView.TopLeftHeaderCell;
|
||||
var db = new AdvertisingProfitControlDbContext();
|
||||
weekEndingCalendar.BoldedDates = db.WeekEndingDates.Select(zdate => zdate.EndingDate).ToArray();
|
||||
weekEndingCalendar.DateChanged += ValidateDateChanged;
|
||||
|
||||
@@ -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("3.5.*")]
|
||||
[assembly: AssemblyFileVersion("3.5.1.0")]
|
||||
[assembly: AssemblyVersion("3.7.0.0")]
|
||||
[assembly: AssemblyFileVersion("3.7.0.0")]
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
Logger.WriteLog(DateTime.Now, "Generate Full Report", e.Message, Level.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user