Exemplo n.º 1
0
        private void LoadSettings()
        {
            app = Application.Current as App;
            DB  = DentalSmileDBFactory.GetInstance();

            //if (Smile.INSTALL)
            if (!DB.TestConnectionString())
            {
                SettingsDB dbForm = new SettingsDB();
                dbForm.ShowDialog();
                DB = DentalSmileDBFactory.GetInstance();
            }

            //detect if Admin  is NULL
            if (DB.selectDefaultAdmin() == null)
            {
                AdminPasswordDialog dlg = new AdminPasswordDialog();
                dlg.ShowDialog();
            }

            Smile.Phases = DB.SelectAllPhases();

            if (App.user == null)
            {
                //ChangePasswordDialog dlg = new ChangePasswordDialog();
                LoginDialog dlg = new LoginDialog();
                dlg.ShowDialog();
            }
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     if (txtConfirmPasswd.Password != null && txtPasswd.Password.Equals(txtConfirmPasswd.Password))
     {
         //if admin is NULL
         if (DB.selectDefaultAdmin() == null)
         {
             //insert
             DB.InsertDefaultAdmin(txtConfirmPasswd.Password);
         }
         else
         {
             //update
             DB.updateAdmin(txtConfirmPasswd.Password);
         }
         MessageBox.Show("Successfully changes.");
         this.Close();
     }
     else
     {
         MessageBox.Show("Password is Invalid.");
         txtPasswd.Focus();
     }
 }
Exemplo n.º 3
0
        private void LoadSettings()
        {
            //Smile.DbDatabase = Properties.Settings.Default.DbDatabase = "xx";
            //Smile.INSTALL = Properties.Settings.Default.InstallationMode = true;

            DentalSmileDB DB = DentalSmileDBFactory.GetInstance();

            ///TODO
            //test DB connection, if fail changes configuration
            //if (true)
            if (Smile.INSTALL)
            {
                SettingsDB dbForm = new SettingsDB();
                dbForm.ShowDialog();
                DB = DentalSmileDBFactory.GetInstance();
            }

            //detect if Admin  is NULL
            if (DB.selectDefaultAdmin() == null)
            {
                AdminPasswordDialog dlg = new AdminPasswordDialog();
                dlg.ShowDialog();
            }
        }