Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //Set events for the submit button
            SubmitImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/SubmitDefault.png'");
            SubmitImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/SubmitMouseOver.png'");

            BackImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/BackArrowMouseOver.jpg'");
            BackImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/BackArrowDefault.jpg'");

            //Databind the dropdownlist with the security question
            //Start a new instance of the class contains the list and store it in an arraylist
            ArrayCollections GetList   = new ArrayCollections();
            ArrayList        Questions = GetList.SecurityQuestions();

            //Databind the arraylist to the drop down list
            SecurityQuestionDdl.DataSource = Questions;
            SecurityQuestionDdl.DataBind();
        }


        if (Request.Cookies["LoggedInCookie"] != null && Request.Cookies["LoggedInCookie"]["LoggedIn"] == "true")
        {
            LoginPanel1.Visible    = false;
            BackImgBtn.PostBackUrl = "Account.aspx";
        }
        else
        {
            FeaturedSidePanelLeft1.Visible = false;
            BackImgBtn.PostBackUrl         = "Register.aspx";
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //Set the events for the image button
            SubmitImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/SubmitDefault.png'");
            SubmitImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/SubmitMouseOver.png'");

            //Databind the security question drop downlist to an arraylist
            //Start an instance of the class that contains the security questions
            ArrayCollections getList           = new ArrayCollections();
            ArrayList        SecurityQuestions = getList.SecurityQuestions();

            //Set the datasource and databind the control
            SecurityDdl.DataSource = SecurityQuestions;
            SecurityDdl.DataBind();
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Check to see if the user is logged in else redirect them to the login page
        if (Request.Cookies["LoggedInCookie"] == null || (Request.Cookies["LoggedInCookie"] != null && Request.Cookies["LoggedInCookie"]["LoggedIn"] != "true"))
        {
            Response.Redirect("Register.aspx");
        }



        if (!IsPostBack)
        {
            //Set the button events
            logoutImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/LogoutMouseOver.png'");
            logoutImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/LogOutDefault.png'");

            PasswordImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/ChangePasswordMouseOver.jpg'");
            PasswordImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/ChangePasswordDefault.jpg'");

            SubmitImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/SubmitABookMouseOver.jpg'");
            SubmitImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/SubmitABookDefault.jpg'");

            UpdateBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/UpdateMouseOver.png'");
            UpdateBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/UpdateDefault.png'");

            RecoverPassImgBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/RecoverPasswordMouseOver.jpg'");
            RecoverPassImgBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/RecoverPasswordDefault.jpg'");

            //Databind the security question  to the drop down list
            //Create a new instance of the class containing the list of security questions: /App_code/ArrayCollections.cs
            ArrayList        SecurityQuestionsList = new ArrayList();
            ArrayCollections getlist = new ArrayCollections();
            SecurityQuestionsList = getlist.SecurityQuestions();

            //Set as the datasource
            SecurityQuestionDdl.DataSource = SecurityQuestionsList;

            //DataBind
            SecurityQuestionDdl.DataBind();

            //Set the textbox values to the userInfo from the database/Check to see the update report
            UseDataBase usedb = new UseDataBase();
            usedb.ConnectDataBase();

            //Data reader for the sql database
            SqlDataReader UserInfo = usedb.ExecuteQuery("SELECT [UserName],[UserPassword],[UserEmail],[UserAnswer],[UserQuestion] FROM [UserInformation] WHERE [UserId] = '" + Request.Cookies["LoggedInCookie"]["UserId"].ToString() + "'");

            //Read from the dataset and apply the values to the lables
            while (UserInfo.Read())
            {
                UserNameTxtb.Text                 = UserInfo.GetString(0);
                UserNameHeaderLble.Text           = UserInfo.GetString(0);
                EmailTxtb.Text                    = UserInfo.GetString(2);
                SecurityAnswerTxtb.Text           = UserInfo.GetString(3);
                SecurityQuestionDdl.SelectedValue = UserInfo.GetString(4);
            }

            //Close the connection to the database
            UserInfo.Close();

            //Close the datareader
            usedb.Close();
        }

        //Set the gridView to select all books containig the users Id
        SqlDataSource1.SelectCommand = "SELECT [BookImageUrl] , [BookId] , [BookName] FROM [BookInformation] WHERE [BookSubmiterId] = '" + Request.Cookies["LoggedInCookie"]["UserId"] + "'";

        // disply the report if the user has tried to update thier profile
        //Make sure no values are carried over
        UpdateReportLble.Text = "";

        if (Session["UpDateReport"] != null)
        {
            if (Session["UpDateReport"].ToString() == "True")
            {
                UpdateReportLble.Text = "Update Successful!";
            }
            else
            {
                UpdateReportLble.Text = "Something went wrong, try again in a few minuttes.";
            }
        }

        //Make sure no values are carried over
        Session["UpDateReport"] = null;
    }