示例#1
0
 private void tbLogin_Click(object sender, EventArgs e)
 {
     #region AdminSelectFromComboBox
     if (cbRoleSelect.SelectedIndex == 0)
     {
         btMemberSignUP.Visible = false;
         if (tbUserName.Text == "mawaat" || tbPassword.Text == "mawaat")
         {
             WelcomeAdmin WelcomForm = new WelcomeAdmin();
             this.Hide();
             WelcomForm.Show();
         }
     }
     #endregion
     #region MemberSelectedFromComboxBox
     if (cbRoleSelect.SelectedIndex == 1)
     {
         WelcomeMember MemberPage = new WelcomeMember();
         btMemberSignUP.Visible = true;
         string        Username      = tbUserName.Text;
         string        Password      = tbPassword.Text;
         List <string> LoginUserName = new List <string>();
         List <string> LoginPassword = new List <string>();
         LMS           Login         = new LMS();
         DataTable     dt            = Login.GettingMemberTable();
         dgUserName.DataSource = dt;
         if (dgUserName.Rows.Count > 1)
         {
             for (int i = 0; i < dgUserName.Rows.Count; i++)
             {
                 LoginUserName.Add(Convert.ToString(dgUserName.Rows[i].Cells[3].Value));
                 LoginPassword.Add(Convert.ToString(dgUserName.Rows[i].Cells[4].Value));
                 if (Username == LoginUserName[i] && Password == LoginPassword[i])
                 {
                     this.Hide();
                     MemberPage.Show();
                 }
             }
         }
     }
     #endregion
 }
示例#2
0
        private void tbUserName_TextChanged(object sender, EventArgs e)
        {
            List <string> Usernames = new List <string>();
            string        UserName  = tbUserName.Text;
            LMS           Main      = new LMS();
            DataTable     dt        = Main.GettingMemberTable();

            DGMember.DataSource = dt;
            if (DGMember.Rows.Count > 1)
            {
                for (int i = 0; i < DGMember.Rows.Count; i++)
                {
                    Usernames.Add(Convert.ToString(DGMember.Rows[i].Cells[3].Value));
                    if (UserName == Usernames[0])
                    {
                        MessageBox.Show("Username exist kindly change it");
                        tbUserName.Text = tbUserName.Text + "0";
                    }
                }
            }
        }