Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User           userObj = new User();
            UserManagement uDao    = new UserManagement();


            userObj = uDao.getUserByID(Session["SelectedID"].ToString());

            lbName.Text     = userObj.Name;
            lbEmail.Text    = userObj.Email;
            lbContact.Text  = userObj.ContactNumber;
            lbUserType.Text = uDao.getUserType(userObj.Type);
            lbCompany.Text  = userObj.CompanyName;
            lbStatus.Text   = uDao.getUserStatus(userObj.Status);
        }
        protected void diffUserView()
        {
            //VIC: the user of the session key username is misleading, it should be usertype right?
            if ((string)Session["userType"] == Reference.USR_ADM)
            {
                UserView.Visible  = false;
                AdminView.Visible = true;

                User           userObj = new User();
                UserManagement uDao    = new UserManagement();

                userObj = uDao.getAdminByID(Session["userID"].ToString());

                lbAdminName.Text    = userObj.Name;
                lbAdminEmail.Text   = userObj.Email;
                lbAdminContact.Text = userObj.ContactNumber;
                lbAdminType.Text    = uDao.getUserType(userObj.Type);
                lbAdminStatus.Text  = uDao.getUserStatus(userObj.Status);
            }
            //VIC: the condition is redundant, if the above condition is false which already means username is not admin, there is no need for this statement as it will always be true
            else
            {
                UserView.Visible  = true;
                AdminView.Visible = false;

                User           userObj = new User();
                UserManagement uDao    = new UserManagement();


                userObj = uDao.getUserByID(Session["userID"].ToString());

                lbName.Text     = userObj.Name;
                lbEmail.Text    = userObj.Email;
                lbContact.Text  = userObj.ContactNumber;
                lbUserType.Text = uDao.getUserType(userObj.Type);
                lbCompany.Text  = userObj.CompanyName;
                lbStatus.Text   = uDao.getUserStatus(userObj.Status);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Deny normal user access
            if (Session["userType"].ToString() == Reference.USR_MEM)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('You do not have access to this page'); window.location='" +
                                                    Request.ApplicationPath + "ProfileInfo.aspx';", true);
            }
            else
            {
                User           userObj = new User();
                UserManagement uDao    = new UserManagement();


                userObj = uDao.getUserByID(Session["selectedID"].ToString());

                lbName.Text     = userObj.Name;
                lbEmail.Text    = userObj.Email;
                lbContact.Text  = userObj.ContactNumber;
                lbUserType.Text = uDao.getUserType(userObj.Type);
                lbCompany.Text  = userObj.CompanyName;
                lbStatus.Text   = uDao.getUserStatus(userObj.Status);
            }
        }