save() 공개 정적인 메소드

public static save ( string filename ) : void
filename string
리턴 void
예제 #1
0
 private void btnconnect_Click(object sender, EventArgs e)
 {
     Utilities.runInThread(() => {
         Globals.ConnectionStr(txtSHost.Text, txtSUser.Text, txtSPass.Text, txtSDatabase.Text);
         if (Utilities.AsyncDB().Connected())
         {
             Globals.Connected = true;
         }
         else
         {
             Globals.Connected = false;
         }
         if (Globals.Connected)
         {
             if (checkBoxRemember.Checked)
             {
                 Settings.save("StoredSettings", checkBoxRemember.Checked.ToString(), checkBoxAutoConnect.Checked.ToString(), txtSHost.Text, txtSUser.Text, txtSPass.Text, txtSDatabase.Text);
             }
             else
             {
                 Settings.delete("StoredSettings");
             }
             Utilities.InvokeMe(btnconnect, () =>
             {
                 btnconnect.Text = "Reconnect";
             });
             Utilities.notifyThem(ntfBox3, "Successfully Connected", NotificationBox.Type.Success);
         }
         else
         {
             Utilities.notifyThem(ntfBox3, "Could not connect to the Database", NotificationBox.Type.Error);
         }
     }).Start();
 }
예제 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Globals.Connected)
            {
                txtLUser.Text = txtLUser.Text.Trim();
                if (string.IsNullOrEmpty(txtLUser.Text) || string.IsNullOrEmpty(txtLPass.Text))
                {
                    Utilities.notifyThem(ntfBox1, "Empty username or password!", NotificationBox.Type.Warning);
                }
                else
                {
                    Utilities.runInThread(() => {
                        String HashPass = Utilities.MD5Hash(txtLPass.Text);

                        DB TempLogUser = Utilities.AsyncDB();
                        TempLogUser.bind(new string[] { "user", txtLUser.Text, "pass", HashPass });
                        DataTable dt = TempLogUser.query("select * from users where user = @user and pass = @pass");
                        if (dt.Rows.Count == 1)
                        {
                            if (ckbLRemember.Checked)
                            {
                                Settings.save("StoredAccount", ckbLRemember.Checked.ToString(), txtLUser.Text, txtLPass.Text);
                            }
                            else
                            {
                                Settings.delete("StoredAccount");
                            }

                            //Load Tags
                            Functionality.LoadTags();

                            int id          = int.Parse(dt.Rows[0][0].ToString());
                            string user     = dt.Rows[0][1].ToString();
                            string pass     = dt.Rows[0][2].ToString();
                            string mail     = dt.Rows[0][3].ToString();
                            string scode    = dt.Rows[0][4].ToString();
                            Globals.logUser = new User(id, user, pass, mail, scode);

                            Utilities.InvokeMe(this, () =>
                            {
                                ntfBox1.Visible = false;
                                this.Hide();
                                Globals.formMain.Show();
                            });
                        }
                        else
                        {
                            Utilities.notifyThem(ntfBox1, "Username or Password were incorrect", NotificationBox.Type.Error);
                        }
                    }).Start();
                }
            }
            else
            {
                Utilities.notifyThem(ntfBox1, "Not connected to DB!", NotificationBox.Type.Warning);
            }
        }