Esempio n. 1
0
    protected void PostButton_Click(object sender, EventArgs e)
    {
        if (CommentBox.Text.Trim() != string.Empty)
        {
            UserTransaction commentDetails = new UserTransaction();

            DataTable dtComments = null;
            DataView  dvComments = null;

            if (ViewState[Constant.SESSION_COMMENT_TYPE] != null)
            {
                if (Int32.Parse(ViewState[Constant.SESSION_COMMENT_TYPE].ToString().Trim()) == 0)
                {
                    if ((ViewState[Constant.SESSION_BIDREFNO] != null) && (ViewState[Constant.SESSION_USERID] != null) && (ViewState[Constant.SESSION_USERTYPE] != null) &&
                        (ViewState[Constant.SESSION_USERID].ToString() != ""))
                    {
                        if (ViewState[Constant.SESSION_BIDREFNO].ToString().Trim() != "")
                        {
                            commentDetails.InsertItemComments(ViewState[Constant.SESSION_BIDREFNO].ToString().Trim(), CommentBox.Text,
                                                              ViewState[Constant.SESSION_USERID].ToString().Trim(), Int32.Parse(ViewState[Constant.SESSION_USERTYPE].ToString().Trim()), false);

                            hdnIsPosted.Value = "1";

                            dtComments = commentDetails.QueryItemCommentsbyRefNo(ViewState[Constant.SESSION_BIDREFNO].ToString().Trim(), false);
                            dvComments = new DataView(dtComments);
                        }
                    }
                }
                else
                {
                    if ((ViewState[Constant.SESSION_AUCTIONREFNO] != null) && (ViewState[Constant.SESSION_USERID] != null) && (ViewState[Constant.SESSION_USERTYPE] != null) &&
                        (ViewState[Constant.SESSION_USERID].ToString() != ""))
                    {
                        if (ViewState[Constant.SESSION_AUCTIONREFNO].ToString().Trim() != "")
                        {
                            commentDetails.InsertItemComments(ViewState[Constant.SESSION_AUCTIONREFNO].ToString().Trim(), CommentBox.Text,
                                                              ViewState[Constant.SESSION_USERID].ToString().Trim(), Int32.Parse(ViewState[Constant.SESSION_USERTYPE].ToString().Trim()), true);

                            hdnIsPosted.Value = "1";

                            dtComments = commentDetails.QueryItemCommentsbyRefNo(Session[Constant.SESSION_AUCTIONREFNO].ToString().Trim(), true);
                            dvComments = new DataView(dtComments);
                        }
                    }
                }
            }

            if (dvComments != null)
            {
                gvCommentArea.DataSource = dvComments;
                gvCommentArea.DataBind();

                CommentBox.Text = "";
            }
        }
    }
Esempio n. 2
0
    protected void PostButton_Click(object sender, EventArgs e)
    {
        if (CommentBox.Text.Trim() != string.Empty)
        {
            DataTable dtComments = null;
            DataView  dvComments = null;

            if (ViewState[Constant.SESSION_COMMENT_TYPE] != null)
            {
                if (Int32.Parse(ViewState[Constant.SESSION_COMMENT_TYPE].ToString().Trim()) == 0)
                {
                    if ((ViewState[Constant.SESSION_BIDREFNO] != null) && (ViewState[Constant.SESSION_USERID] != null) && (ViewState[Constant.SESSION_USERTYPE] != null) &&
                        (ViewState[Constant.SESSION_USERID].ToString() != ""))
                    {
                        if (ViewState[Constant.SESSION_BIDREFNO].ToString().Trim() != "")
                        {
                            UserTransaction.InsertItemComments(connstring, ViewState[Constant.SESSION_BIDREFNO].ToString().Trim(), CommentBox.Text, ViewState[Constant.SESSION_USERID].ToString().Trim(), Int32.Parse(ViewState[Constant.SESSION_USERTYPE].ToString().Trim()), false, chkAlowVendorView.Checked);

                            hdnIsPosted.Value = "1";

                            dtComments = UserTransaction.QueryItemCommentsbyRefNo(connstring, ViewState[Constant.SESSION_BIDREFNO].ToString().Trim(), false);
                            dvComments = new DataView(dtComments);
                        }
                    }
                }
                else
                {
                    if ((ViewState[Constant.SESSION_AUCTIONREFNO] != null) && (ViewState[Constant.SESSION_USERID] != null) && (ViewState[Constant.SESSION_USERTYPE] != null) &&
                        (ViewState[Constant.SESSION_USERID].ToString() != ""))
                    {
                        if (ViewState[Constant.SESSION_AUCTIONREFNO].ToString().Trim() != "")
                        {
                            UserTransaction.InsertItemComments(connstring, ViewState[Constant.SESSION_AUCTIONREFNO].ToString().Trim(), CommentBox.Text, ViewState[Constant.SESSION_USERID].ToString().Trim(), Int32.Parse(ViewState[Constant.SESSION_USERTYPE].ToString().Trim()), true, chkAlowVendorView.Checked);

                            hdnIsPosted.Value = "1";

                            dtComments = UserTransaction.QueryItemCommentsbyRefNo(connstring, Session[Constant.SESSION_AUCTIONREFNO].ToString().Trim(), true);
                            dvComments = new DataView(dtComments);
                        }
                    }
                }
            }

            if (dvComments != null)
            {
                CommentBox.Text = "";
                Response.Redirect(Request.AppRelativeCurrentExecutionFilePath);
            }
        }
    }
Esempio n. 3
0
    protected void btnStop_Click(object sender, ImageClickEventArgs e)
    {
        if (IsValid)
        {
            if (StopAuction(Int32.Parse(OnlineAuctionRefNo)))
            {   // if successful
                UserTransaction.InsertItemComments(connstring, OnlineAuctionRefNo, txtComment.Text.Trim(), Session[Constant.SESSION_USERID].ToString().Trim(), int.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()), true, true);

                Session[Constant.SESSION_AUCTIONREFNO] = Session[Constant.SESSION_ONLINE_AUCTION];
                Response.Redirect("auctionstopped.aspx?arn=" + OnlineAuctionRefNo);
            }
            else
            {   // failed to stop, likely to happen
            }
        }
    }