示例#1
0
 public void login(string user, string pass)
 {
     try
     {
         LoginNew.setConnection(user, pass, txtServer.Text, LoginNew.db);
         LoginNew.conn.Open();
         if (LoginNew.conn != null && (LoginNew.conn.State == ConnectionState.Open))
         {
             this.txtPass.Clear();
             this.txtUser.Clear();
             new MainForm(this).Show();
             this.Hide();
         }
         else
         {
             MetroMessageBox.Show(this, "Access Denied", "Invalid User", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, ex.Message, "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         LoginNew.conn.Close();
     }
 }
示例#2
0
 public MainForm(LoginNew parent)
 {
     this.parent = parent;
     this.LoadMainForm();
 }