protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Esempio n. 2
0
 public virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             db.Dispose();
         }
         this.disposed = true;
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             db.Dispose();
         }
     }
     this.disposed = true;
 }
 public virtual void Dispose()
 {
     if (disposing)
     {
         return;
     }
     disposing = true;
     if (context != null)
     {
         context.Dispose();
     }
 }
Esempio n. 5
0
 protected override void Dispose(bool disposing)
 {
     db.Dispose();
 }
Esempio n. 6
0
 public void Dispose()
 {
     bd.Dispose();
 }
Esempio n. 7
0
 public void Dispose()
 {
     dataContext.Dispose();
 }
Esempio n. 8
0
 public void Dispose()
 {
     _dbContext.Dispose();
 }
Esempio n. 9
0
 public void Dispose()
 {
     contexto.Dispose();
 }
Esempio n. 10
0
 private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     db.Dispose();
 }
Esempio n. 11
0
 public void Dispose() // IDisposable implementation
 {
     _context.Dispose();
 }
Esempio n. 12
0
 public void Dispose()
 {
     db.Dispose();
 }
Esempio n. 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (radClient.Checked)
            {
                try
                {
                    Cursor = Cursors.WaitCursor;

                    Properties.Settings.Default.DbName     = txtDbName.Text.Trim();
                    Properties.Settings.Default.DbUsername = txtUsername.Text.Trim();
                    Properties.Settings.Default.DbPassword = txtPassword.Text.Trim();
                    Properties.Settings.Default.ServerIP   = txtIP.Text.Trim();
                    Properties.Settings.Default.ServerName = txtName.Text.Trim();
                    Properties.Settings.Default.AppType    = "client";

                    Properties.Settings.Default.ImagePath = @"\\" + Path.Combine(Properties.Settings.Default.ServerName, @"spk\");

                    var constring = $"SERVER={txtIP.Text.Trim()}; DATABASE={txtDbName.Text.Trim()}; USER ID={txtUsername.Text.Trim()}; PASSWORD={txtPassword.Text.Trim()};";
                    var db        = new Model1();
                    db.AdjustConfigConString(constring);
                    db.Dispose();
                }
                catch (Exception ex)
                {
                    Cursor = Cursors.Arrow;
                    MessageBox.Show("An error occured. Please contact support.");
                    Utilities.Utils.LogException(ex);
                    return;
                }
            }
            else
            {
                Cursor = Cursors.WaitCursor;

                try
                {
                    var appPath = @"\\" + Path.Combine(Environment.MachineName, @"spk");
                    File.Copy(Path.Combine(Environment.CurrentDirectory, "small.png"), Path.Combine(appPath, "small.png"), true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Please create the shared spk folder first.");
                    Utilities.Utils.LogException(ex);
                    Cursor = Cursors.Arrow;
                    return;
                }

                if (!Directory.Exists(@"c:/spk/admin") || !Directory.Exists(@"c:/spk/image"))
                {
                    MessageBox.Show("Please Create the sub folders in the spk folder.");
                    return;
                }

                try
                {
                    Properties.Settings.Default.DbName     = txtDbName.Text;
                    Properties.Settings.Default.DbUsername = txtUsername.Text;
                    Properties.Settings.Default.DbPassword = txtPassword.Text;
                    Properties.Settings.Default.ServerIP   = "127.0.0.1";
                    Properties.Settings.Default.ServerName = txtServerName.Text;
                    Properties.Settings.Default.AppType    = "server";

                    Properties.Settings.Default.ImagePath = @"c:/spk/";

                    var constring = $"SERVER=Localhost; DATABASE={txtDbName.Text.Trim()}; USER ID={txtUsername.Text.Trim()}; PASSWORD={txtPassword.Text.Trim()};";
                    var db        = new Model1();
                    db.AdjustConfigConString(constring);
                    db.Dispose();
                }
                catch (Exception ex)
                {
                    Cursor = Cursors.Arrow;
                    MessageBox.Show("An error occured. Please contact support.");
                    Utilities.Utils.LogException(ex);
                    return;
                }
            }

            Properties.Settings.Default.SetupDone = true;
            Properties.Settings.Default.Save();

            MessageBox.Show("Configuration was saved successfully.");

            Cursor = Cursors.Arrow;

            if (_from == "main")
            {
                Close();
            }
            else
            {
                LoginForm frm = new LoginForm();
                frm.Show();
                Close();
            }
        }