Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            UpdateDBlink ul = new UpdateDBlink();

            ai = ul.getAdmin(textBox1.Text);

            string pass;

            if (textBox1.Text == ai.UName && ai.UStatus == "Admin")
            {
                if (textBox2.Text == ai.Pword)
                {
                    /* HomeAdmin h = new HomeAdmin(ai);
                     * h.Show();
                     * this.Visible = false;
                     */
                    AdminHome h = new AdminHome(ai);
                    h.Show();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                ui   = ul.getUser(textBox1.Text);
                pass = ul.getPassword(textBox1.Text);

                if (textBox2.Text == pass)
                {
                    UserHome h = new UserHome(ui);
                    h.Show();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 private void textBox1_Leave(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         textBox1.Text = "Enter current password Here";
     }
     else
     {
         UpdateDBlink ul = new UpdateDBlink();
         string       pa = ul.getPassword(textBox1.Text);
         if (textBox1.Text == pa)
         {
             MessageBox.Show("current password matched", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         else
         {
             MessageBox.Show("Enter valid current password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             textBox1.Text = "";
             textBox1.Select();
         }
     }
 }