예제 #1
0
 private void Validate_login()
 {
     if (frmLoginDataSet != null)
     {
         int  counter          = cmbboxUsername.SelectedIndex;
         bool areEqualUsername = string.Equals(frmLoginDataSet.Tables["COMBO_BOX"].Rows[counter]["username"].ToString(), cmbboxUsername.Text, StringComparison.OrdinalIgnoreCase);
         if (areEqualUsername)
         {
             bool areEqualPassword = string.Equals(frmLoginDataSet.Tables["COMBO_BOX"].Rows[counter]["password"].ToString(), txtboxPassword.Text, StringComparison.OrdinalIgnoreCase);;
             if (areEqualPassword)
             {
                 if (counter == 0)
                 {
                     Debug.WriteLine("Password Matched for " + cmbboxUsername.Text);
                     FrmAdminPage frmAdminPage = new FrmAdminPage();
                     Hide();
                     frmAdminPage.ShowDialog();
                     Close();
                 }
                 else
                 {
                     Debug.WriteLine("Password Matched for " + cmbboxUsername.Text);
                     FrmUserPage frmUserPage = new FrmUserPage(Convert.ToUInt32(cmbboxUsername.SelectedValue));
                     Hide();
                     frmUserPage.ShowDialog();
                     Close();
                 }
             }
             else
             {
                 MessageBox.Show("Password Not Matched for " + cmbboxUsername.Text);
             }
         }
     }
 }
예제 #2
0
 private void Validate_login()
 {
     if (frmLoginDataSet != null)
     {
         int counter = cmbboxUsername.SelectedIndex;
         if (counter < 0)
         {
             MessageBox.Show("Error in login", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         bool areEqualUsername = string.Equals(frmLoginDataSet.Tables["COMBO_BOX"].Rows[counter]["username"].ToString(), cmbboxUsername.Text);
         if (areEqualUsername)
         {
             bool areEqualPassword = string.Equals(frmLoginDataSet.Tables["COMBO_BOX"].Rows[counter]["password"].ToString(), txtboxPassword.Text);;
             if (areEqualPassword)
             {
                 if (counter == 0)
                 {
                     Debug.WriteLine("Password Matched for " + cmbboxUsername.Text);
                     FrmAdminPage frmAdminPage = new FrmAdminPage();
                     Hide();
                     frmAdminPage.ShowDialog();
                     Close();
                 }
                 else
                 {
                     Debug.WriteLine("Password Matched for " + cmbboxUsername.Text);
                     FrmUserPage frmUserPage = new FrmUserPage(Convert.ToUInt32(cmbboxUsername.SelectedValue));
                     Hide();
                     frmUserPage.ShowDialog();
                     Close();
                 }
             }
             else
             {
                 MessageBox.Show("Password Not Matched for " + cmbboxUsername.Text, "PASSWORD NOT MATCHED", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }