Пример #1
0
    //when grid view of seminar is selected
    protected void gvSeminar_SelectedIndexChanged(object sender, EventArgs e)
    {
        Panel1.Visible = true;
        Member m = (Member)Session["user"];
        List <ShoppingCart> shoppingcarts = ShoppingCartDBMgr.getAllShoppingCart(m.Email);

        gvSeminar.DataSource = shoppingcarts;
        gvSeminar.DataBind();
        List <Seminar>  seminars  = SeminarMgr.getAllSeminar();
        List <Schedule> schedules = ScheduleMgr.getAllSchedule();
        List <Review>   reviews   = ReviewDBMgr.getAllReviewById(m.Email);
        Seminar         a         = seminars[gvSeminar.PageSize * gvSeminar.PageIndex + gvSeminar.SelectedIndex];
        Schedule        b         = schedules[gvSeminar.SelectedIndex];

        if (reviews == null)
        {
            tbxRating.Text  = "0";
            tbxRemarks.Text = " ";
        }
        else
        {
            Review c = reviews[gvSeminar.SelectedIndex];
            tbxRating.Text  = c.Rating.ToString();
            tbxRemarks.Text = c.Remarks;
        }
        tbxId.Text    = a.Id;
        tbxName.Text  = a.Name;
        tbxPrice.Text = a.Price.ToString();
        tbxDate.Text  = b.Date.ToShortDateString();
    }
Пример #2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Member m = (Member)Session["user"];
        List <ShoppingCart> shoppingcarts = ShoppingCartDBMgr.getAllShoppingCart(m.Email);

        gvSeminar.DataSource = shoppingcarts;
        gvSeminar.DataBind();
        List <Seminar> seminars = SeminarMgr.getAllSeminar();
        Seminar        a        = seminars[gvSeminar.SelectedIndex];
        List <Review>  reviews  = ReviewDBMgr.getAllReviewById(m.Email);
        //Review c = reviews[gvSeminar.SelectedIndex];
        //tbxRating.Text = c.Rating.ToString();
        //tbxRemarks.Text = c.Remarks;
        Review r = new Review()
        {
            Rating  = Convert.ToInt32(tbxRating.Text),
            Remarks = tbxRemarks.Text,
            Seminar = a,
            Member  = m
        };
        int row = ReviewDBMgr.updateReview(r);

        lblOutput.Text = row + " Updated!";
    }