Example #1
0
        protected void ReplyAdvice_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DataListItem Item  = (DataListItem)(((Control)sender).NamingContainer);
                int          index = Item.ItemIndex;
                if (((TextBox)AllMyNewAdvice_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
                {
                    MessageInfo replyadvice = new MessageInfo();
                    replyadvice.Anonymous    = 0;
                    replyadvice.MessageID    = int.Parse(e.CommandArgument.ToString());
                    replyadvice.UserID       = user.UserID;
                    replyadvice.TargetUserID = int.Parse(TargetUserID_TextBox.Text);
                    replyadvice.Content      = ((TextBox)AllMyNewAdvice_DataList.Items[index].FindControl("Reply_TextBox")).Text;
                    replyadvice.AddAdviceReply();

                    mynewadvice                        = user.GetNewAdvice();
                    AspNetPager.RecordCount            = mynewadvice.Tables["NewAdvice"].Rows.Count;
                    AllMyNewAdvice_DataList.DataSource = FilterTable(mynewadvice.Tables["NewAdvice"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                    AllMyNewAdvice_DataList.DataBind();
                    //Response.Redirect(Request.Url.AbsoluteUri);
                }
            }
        }
Example #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();

                mynewadvice                        = user.GetNewAdvice();
                AspNetPager.RecordCount            = mynewadvice.Tables["NewAdvice"].Rows.Count;
                AllMyNewAdvice_DataList.DataSource = FilterTable(mynewadvice.Tables["NewAdvice"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewAdvice_DataList.DataBind();
                //Response.Redirect(Request.Url.AbsoluteUri);
            }
        }
Example #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,所以用这种法子给它改
            }
            AllMyNewAdvice_DataList.DataSource = FilterTable(mynewadvice.Tables["NewAdvice"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            AllMyNewAdvice_DataList.DataBind();
        }
Example #4
0
        protected void ReadAllNewAdvice_Button_Click(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                MessageInfo advice = new MessageInfo();
                advice.UserID = user.UserID;
                advice.Type   = 2;
                advice.ReadType();

                mynewadvice                        = user.GetNewAdvice();
                AspNetPager.RecordCount            = mynewadvice.Tables["NewAdvice"].Rows.Count;
                AllMyNewAdvice_DataList.DataSource = FilterTable(mynewadvice.Tables["NewAdvice"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewAdvice_DataList.DataBind();
                //Response.Redirect("/aspx/MyNewAdvice.aspx");
            }
        }
Example #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)
            {
                mynewadvice                        = user.GetNewAdvice();
                AspNetPager.RecordCount            = mynewadvice.Tables["NewAdvice"].Rows.Count;
                AllMyNewAdvice_DataList.DataSource = FilterTable(mynewadvice.Tables["NewAdvice"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewAdvice_DataList.DataBind();
            }
        }