Exemple #1
0
        protected void Reply_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DataListItem Item  = (DataListItem)(((Control)sender).NamingContainer);
                int          index = Item.ItemIndex;
                if (((TextBox)AllMyNewAdviceReply_DataList.Items[index].FindControl("Reply_TextBox")).Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(Page, GetType(), "nocontent", "alert('请输入内容!');", true);
                    //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('请输入内容!');location.href='" + Request.Url.AbsoluteUri + "'</script>");
                }
                else
                {
                    string[] arg          = e.CommandArgument.ToString().Split(',');
                    string   adviceid     = arg[0];
                    string   targetuserid = arg[1];

                    MessageInfo reply = new MessageInfo();
                    reply.Anonymous    = 0;
                    reply.MessageID    = int.Parse(adviceid);
                    reply.UserID       = user.UserID;
                    reply.TargetUserID = int.Parse(targetuserid);
                    reply.Content      = ((TextBox)AllMyNewAdviceReply_DataList.Items[index].FindControl("Reply_TextBox")).Text;
                    reply.AddAdviceReply();

                    mynewadvicereply        = user.GetNewAdviceReply();
                    AspNetPager.RecordCount = mynewadvicereply.Tables["NewAdviceReply"].Rows.Count;
                    AllMyNewAdviceReply_DataList.DataSource = FilterTable(mynewadvicereply.Tables["NewAdviceReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                    AllMyNewAdviceReply_DataList.DataBind();
                    //Response.Redirect(Request.Url.AbsoluteUri);
                }
            }
        }
Exemple #2
0
        protected void Delete_AdviceReply_LinkButton_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                MessageInfo replyadvice = new MessageInfo();
                replyadvice.MessageID = int.Parse(e.CommandArgument.ToString());
                replyadvice.DeleteAdviceReply();

                mynewadvicereply        = user.GetNewAdviceReply();
                AspNetPager.RecordCount = mynewadvicereply.Tables["NewAdviceReply"].Rows.Count;
                AllMyNewAdviceReply_DataList.DataSource = FilterTable(mynewadvicereply.Tables["NewAdviceReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewAdviceReply_DataList.DataBind();
                //Response.Redirect(Request.Url.AbsoluteUri);
            }
        }
Exemple #3
0
        protected void AspNetPager_PageChanged(object src, EventArgs e)
        {
            int index;// = AspNetPager.CurrentPageIndex;

            if (Request.QueryString["Page"] == null)
            {
                index = 1;
            }
            else
            {
                index = Convert.ToInt32(Request.QueryString["Page"]);
                AspNetPager.CurrentPageIndex = index;//一直都是1,所以用这种法子给它改
            }
            AllMyNewAdviceReply_DataList.DataSource = FilterTable(mynewadvicereply.Tables["NewAdviceReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            AllMyNewAdviceReply_DataList.DataBind();
        }
Exemple #4
0
        protected void ReadAllNewAdviceReply_Button_Click(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                MessageInfo replyadvice = new MessageInfo();
                replyadvice.UserID = user.UserID;
                replyadvice.Type   = 4;
                replyadvice.ReadType();

                mynewadvicereply        = user.GetNewAdviceReply();
                AspNetPager.RecordCount = mynewadvicereply.Tables["NewAdviceReply"].Rows.Count;
                AllMyNewAdviceReply_DataList.DataSource = FilterTable(mynewadvicereply.Tables["NewAdviceReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewAdviceReply_DataList.DataBind();
                //Response.Redirect("/aspx/MyNewAdviceReply.aspx");
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                user = Session["UserInfo"] as UserInfo;
            }
            else
            {
                Response.Redirect("/aspx/Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                mynewadvicereply        = user.GetNewAdviceReply();
                AspNetPager.RecordCount = mynewadvicereply.Tables["NewAdviceReply"].Rows.Count;
                AllMyNewAdviceReply_DataList.DataSource = FilterTable(mynewadvicereply.Tables["NewAdviceReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewAdviceReply_DataList.DataBind();
            }
        }