private void checkVerificationCode()
        {
            DB_contextDataContext db             = new DB_contextDataContext();
            UserLoginData         logindataTable = db.UserLoginDatas.SingleOrDefault(x => x.username == this.LoggedUName);
            UserAddr  userAddresTab    = db.UserAddrs.SingleOrDefault(x => x.userID == this.LoggedUName);
            UserDtail userDetailsTable = db.UserDtails.SingleOrDefault(x => x.userID == this.LoggedUName);
            BloodData userBloodTable   = db.BloodDatas.SingleOrDefault(x => x.userID == this.LoggedUName);

            if (logindataTable != null && userAddresTab != null && userDetailsTable != null && userBloodTable != null)
            {
                if (logindataTable.verfication == code)
                {
                    logindataTable.confirmVerification = this.txtConfirm.Text;
                    userAddresTab.accountstatus        = "activated";
                    userDetailsTable.accountstatus     = "activated";
                    userBloodTable.accountstatus       = "activated";
                    db.SubmitChanges();
                    this.userLoginForm.isChecked = true;
                    this.lableStatus.Text        = "Account Activating.....";
                    Thread.Sleep(4000);
                    userHomePage userForm = new userHomePage();
                    userForm.showLoggedUser(LoggedUName);
                    this.Hide();
                    userForm.Show();
                }
                else
                {
                    this.lableStatus.Text = "Invalid Code";
                    this.txtConfirm.Clear();
                }
            }
        }
Пример #2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     this.login     = db.UserLoginDatas.SingleOrDefault(x => x.username == this.userBox.Text && x.password == this.passwordBox.Text);
     this.adminMode = db.UserLoginDatas.SingleOrDefault(x => x.username == this.userBox.Text && x.userroll == 1);
     this.userMode  = db.UserLoginDatas.SingleOrDefault(x => x.username == this.userBox.Text && x.userroll == 2);
     if (login != null)
     {
         if (adminMode != null)
         {
             adminHomePage adminForm = new adminHomePage();
             adminForm.showLoggedUser(this.userBox.Text);
             this.Hide();
             adminForm.Show();
         }
         else if (userMode != null)
         {
             if (!isChecked)
             {
                 this.checkVerification();
             }
             else
             {
                 userHomePage userForm = new userHomePage();
                 userForm.showLoggedUser(this.userBox.Text);
                 this.Hide();
                 userForm.Show();
             }
         }
     }
     else
     {
         MessageBox.Show("INVALID USERNAME or PASSWORD");
         this.userBox.Clear();
         this.passwordBox.Clear();
         this.btnForget.Visible = true;
     }
 }