예제 #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #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();
     }
 }
예제 #5
0
 protected override void Dispose(bool disposing)
 {
     db.Dispose();
 }
예제 #6
0
 public void Dispose()
 {
     bd.Dispose();
 }
예제 #7
0
 public void Dispose()
 {
     dataContext.Dispose();
 }
예제 #8
0
 public void Dispose()
 {
     _dbContext.Dispose();
 }
예제 #9
0
 public void Dispose()
 {
     contexto.Dispose();
 }
예제 #10
0
 private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     db.Dispose();
 }
예제 #11
0
 public void Dispose() // IDisposable implementation
 {
     _context.Dispose();
 }
예제 #12
0
 public void Dispose()
 {
     db.Dispose();
 }
예제 #13
0
파일: frmSetup.cs 프로젝트: Frankofoedu/SPK
        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();
            }
        }