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();
                }
            }
        }
Example #2
0
 public void TrackUserSession(userHomePage user)
 {
     if (user != null)
     {
         this.userHomepageForm = user;
         this.uName            = this.userHomepageForm.LoggedUName;
         this.uRoll            = this.userHomepageForm.uRoll;
         this.setFromDataBase();
     }
     else
     {
         MessageBox.Show("NO REF PASSED");
     }
     MessageBox.Show(uName + " ROLL : " + this.uRoll);
 }
 public virtual void TrackUserSession(adminHomePage admin, userHomePage user)
 {
     if (admin != null)
     {
         this.adminForm = admin;
         this.uName     = this.adminForm.LoggedUName;
         this.uRoll     = this.adminForm.uRoll;
         user           = null;
     }
     else if (user != null)
     {
         this.userForm = user;
         this.uName    = this.userForm.LoggedUName;
         this.uRoll    = this.userForm.uRoll;
         admin         = null;
     }
     else
     {
         MessageBox.Show("NO REF PASSED");
     }
     MessageBox.Show(uName + " ROLL : " + this.uRoll);
 }
 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;
     }
 }