Implemented database backups and restores into the AdvertisingProfitControlData DLL and added a form, DatabaseRecovery, to manage the backups and restores. Updated the installer to include the data DLL file into the install bundle.

This commit is contained in:
2017-06-23 03:12:51 -05:00
parent 308b60bd84
commit 12a6b36370
20 changed files with 5378 additions and 80 deletions
@@ -50,7 +50,7 @@ namespace AdvertsingProfitControl
private void RegisterNewAdSpecial(object sender, EventArgs e)
{
var db = new AdvertisingProfitControlModel();
var db = new AdvertisingProfitControlDbContext();
if (!_isUpdating)
{
if (!db.AdSpecials.Any(x => x.Name == newAdSpecialTextBox.Text))
@@ -100,7 +100,7 @@ namespace AdvertsingProfitControl
private void RefreshAdSpecialListing()
{
adSpecialsListBox.Items.Clear();
var db = new AdvertisingProfitControlModel();
var db = new AdvertisingProfitControlDbContext();
var adSpecials = db.AdSpecials.Select(x => x).OrderBy(x => x.Name);
foreach (var adSpecial in adSpecials)
{
@@ -120,7 +120,7 @@ namespace AdvertsingProfitControl
{
var item = adSpecialsListBox.SelectedItems[0];
var adSpecial = (AdSpecial) item.Tag;
var db = new AdvertisingProfitControlModel();
var db = new AdvertisingProfitControlDbContext();
var ad = db.AdSpecials.Single(x => x.Id == adSpecial.Id);
//Check to see if the ad special is used by other tables.
if (ad.ActualSales.Count > 0)