Exemplo n.º 1
0
    protected void dlUrunler_ItemCommand(object source, DataListCommandEventArgs args)
    {
        if (args.CommandName == "btnLeaveComment")
        {
            HiddenField  hfCommentedProductId = (HiddenField)args.Item.FindControl("hfCommentedProductId");
            TextBox      txtCommentBody       = (TextBox)args.Item.FindControl("txtCommentBody");
            TextBox      txtCommentHeader     = (TextBox)args.Item.FindControl("txtCommentHeader");
            DropDownList ddlStar = (DropDownList)args.Item.FindControl("ddlStar");

            string comment = txtCommentBody.Text;
            string header  = txtCommentHeader.Text;
            int    star    = Convert.ToInt32(ddlStar.SelectedValue);


            if (Session["Oturum"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                User autUser = Session["Oturum"] as User;
                if (autUser == default(User))
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    GgDbProvider.AddComment(header, comment, autUser.ObjectID, Convert.ToInt32(hfCommentedProductId.Value), star);
                    //pnlInfo.Visible = true;
                    Response.Write("<script>alert('Yorumunuz başarıyla eklendi. ');</script>");
                }
            }
        }
    }