Exemplo n.º 1
0
    protected void GridViewAllFlats_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowindex = Convert.ToInt32(e.CommandArgument) % GridViewAllFlats.PageSize;

        if (e.CommandName == "Add")
        {
            int    flatId       = Convert.ToInt32(GridViewAllFlats.Rows[rowindex].Cells[0].Text);
            string studentEmail = Session["Email"].ToString();
            int    score        = Convert.ToInt32(Session["Score"]);
            client.AddToWishlist(studentEmail, flatId, score);
            Response.Redirect("MainPageStudent.aspx");
        }
        else if (e.CommandName == "Remove")
        {
            int    flatId       = Convert.ToInt32(GridViewAllFlats.Rows[rowindex].Cells[0].Text);
            string studentEmail = Session["Email"].ToString();
            client.RemoveFromWishlist(studentEmail.Trim(), flatId);
            Response.Redirect("MainPageStudent.aspx");
        }
        if (e.CommandName == "View")
        {
            Session["Flat"] = Convert.ToInt32(GridViewAllFlats.Rows[rowindex].Cells[0].Text);
            Response.Redirect("FlatsDetailsStudent.aspx");
        }
    }
Exemplo n.º 2
0
    protected void ButtonAddFlat_Click(object sender, EventArgs e)
    {
        int    flatId       = Convert.ToInt32(Session["Flat"]);
        string studentEmail = Session["Email"].ToString();
        int    score        = Convert.ToInt32(Session["Score"]);

        client.AddToWishlist(studentEmail, flatId, score);
        LabelAddRemove.Text = "Flat has been added to your wishlist.";
    }