Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["LoggedInCookie"] == null || (Request.Cookies["LoggedInCookie"] != null && Request.Cookies["LoggedInCookie"]["LoggedIn"] != "true"))
        {
            Response.Redirect("Register.aspx");
        }

        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 dropdown list
            //Open a new instance of the class containing the genrelist
            //Store as an arraylist
            ArrayCollections getlist   = new ArrayCollections();
            ArrayList        genreList = getlist.GenreList();
            //Remove "All" from the arraylist since it is not a genre
            genreList.Remove("All");

            //Set source and databind
            GenreDdl.DataSource = genreList;
            GenreDdl.DataBind();
        }

        //Set the gridviews select command to only bring up books that the user has rated
        SqlDataSource1.SelectCommand = "SELECT TOP 4 [BookImageUrl] , [BookId] , [BookName] FROM [BookInformation] WHERE [BookSubmiterId] = '" + Request.Cookies["LoggedInCookie"]["UserId"] + "'";

        //Hide the details panel
        BookDetailsPnl.Visible = false;
    }
Esempio n. 2
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";
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Used to databind the dropdownlist with the book genres
        ArrayList DdlGenreArray = new ArrayList();

        //Check the cookies to see if the user is loggedin otherwise redirect to Register.aspx
        if (Request.Cookies["LoggedInCookie"] == null || (Request.Cookies["LoggedInCookie"] != null && Request.Cookies["LoggedInCookie"]["LoggedIn"] != "true"))
        {
            Response.Redirect("Register.aspx");
        }

        //Check if the page has been loaded before
        if (!Page.IsPostBack)
        {
            //Add mouseenter/mouseover events to the image buttons
            FindYesBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/YesMouseOver.jpg'");
            FindYesBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/YesDefault.jpg'");

            FindNoBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/NoMouseOver.jpg'");
            FindNoBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/NoDefault.jpg'");

            //Databind items to the DropDownList (DdlGenere) using an ArrayCollection
            ArrayCollections getlist = new ArrayCollections();
            DdlGenreArray       = getlist.GenreList();
            DdlGenre.DataSource = DdlGenreArray;
            DdlGenre.DataBind();
        }
    }
Esempio n. 4
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();
        }
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Check the cookies to see if the user is loggedin otherwise redirect to Register.aspx
        if (Request.Cookies["LoggedInCookie"] == null || (Request.Cookies["LoggedInCookie"] != null && Request.Cookies["LoggedInCookie"]["LoggedIn"] != "true"))
        {
            Response.Redirect("Register.aspx");
        }

        //Check if the page has been loaded before
        if (!Page.IsPostBack)
        {
            //Add mouseenter/mouseover events to the image buttons
            FindYesBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/YesMouseOver.jpg'");
            FindYesBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/YesDefault.jpg'");

            FindNoBtn.Attributes.Add("onmouseover", "this.src = 'Resources/Images/NoMouseOver.jpg'");
            FindNoBtn.Attributes.Add("onmouseout", "this.src = 'Resources/Images/NoDefault.jpg'");

            //Databind items to the DropDownList (DdlGenere) using an ArrayCollection
            //Used to databind the dropdownlist with the book genres
            ArrayList DdlGenreArray = new ArrayList();
            //DataBind the dropdownlist by getting the list from the ArrayCollections class
            ArrayCollections getlist = new ArrayCollections();
            //Get the list
            DdlGenreArray = getlist.GenreList();
            //Apply the source
            DdlGenre.DataSource = DdlGenreArray;
            //DataBind
            DdlGenre.DataBind();

            //Open a new instance of the bookWormService
            Service BookWormService = new Service();
            //Execute the query against the database on the service (Man, I love APIs)
            MainGridView.DataSource = BookWormService.ExecuteQuery("SELECT [BookId], [BookName], [BookImageUrl], [BookAuthor], [BookAverageRating] FROM [BookInformation] ");
            //Databind the gridView
            MainGridView.DataBind();
            //Dispose of the Service Resources
            BookWormService.Dispose();
        }
    }
Esempio n. 6
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;
    }