public void trackSession(adminHomePage adminPg)
 {
     if (adminPg != null)
     {
         this.adminHomePageForm = adminPg;
     }
     else
     {
         MessageBox.Show("NO Ref Passed");
     }
 }
 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;
     }
 }
Exemple #4
0
        public void setFromDataBase(adminHomePage admin)
        {
            this.adminHome          = admin;
            this.userAddressTable   = db.UserAddrs.SingleOrDefault(x => x.userID == admin.uName);
            this.userBloodDataTable = db.BloodDatas.SingleOrDefault(x => x.userID == admin.uName);
            this.userDetailTable    = db.UserDtails.SingleOrDefault(x => x.userID == admin.uName);
            if (userAddressTable != null && userBloodDataTable != null && userDetailTable != null)
            {
                this.Text = userAddressTable.firstName + "'s Profile";
                this.txtFirstName.Text   = userAddressTable.firstName;
                this.txtLastName.Text    = userAddressTable.lastName;
                this.txtUserName.Text    = userAddressTable.userID;
                this.txtPhone.Text       = userAddressTable.mobileNo;
                this.txtEmail.Text       = userAddressTable.email;
                this.txtDistrict.Text    = userAddressTable.district;
                this.txtSubdistrict.Text = userAddressTable.subDistrict;
                this.txtPostal.Text      = userAddressTable.postalCode;
                this.LableBlood.Text     = userBloodDataTable.bloodGroup;
                try
                {
                    this.userPP.Image = Image.FromFile(userDetailTable.propicture);
                }
                catch (ArgumentNullException exp)
                {
                    this.userPP.Image = Image.FromFile(@"F:\Programming\C#\C# Project Updated\BloodBankManagement\BloodBankManagement\images\default.jpg");
                }

                //this.userPP.SizeMode = PictureBoxSizeMode.StretchImage;
                this.userPP.SizeMode = PictureBoxSizeMode.Zoom;
            }
            else
            {
                this.lableValidation.Text = "Problem To Load Database";
                //MessageBox.Show("Problem To Load Database");
            }
        }
Exemple #5
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     this.Hide();
     this.adminHome.destroySession();
     this.adminHome = null;
 }