Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsHttpPost)
            {
                if (Request.Form["op"].Trim().ToString() == "add")
                {
                    code    = Request.Form["txtcode"].Trim().ToString();
                    name    = Request.Form["txtName"].Trim().ToString();
                    way     = Request.Form["txtWay"].Trim().ToString();
                    content = Request.Form["txtContent"].Trim().ToString();
                    if (code != Request.Cookies["CheckCode"].Value.ToString())
                    {
                        errostr = Request.Form["hint_9001"].ToString();
                    }
                    else
                    {
                        GuestBookModel g = new GuestBookModel();
                        g.F_Contacts = VerifyTool.DeleteAll(name);
                        g.F_Way      = VerifyTool.DeleteAll(way);
                        g.F_Content  = VerifyTool.DeleteAll(content);
                        g.F_IP       = WebTools.GetRealIP();
                        g.F_Lang     = lang;
                        int res = EispGuestBookBLL.AddGuestBook(g);

                        if (res > 0)
                        {
                            errostr = Request.Form["hint_1001"].ToString();
                        }
                    }
                    ((Label)Master.FindControl("ErroStr")).Text = errostr;
                }
            }
        }
Esempio n. 2
0
        protected void GuestBookBind(int number, int pagesize)
        {
            List <GuestBookModel> list = EispGuestBookBLL.GetGuestBookListByLang(lang, number, pagesize);

            //  AspNetPager1.RecordCount = 9;

            this.GridView1.DataSource = list;
            this.GridView1.DataBind();
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (EispGuestBookBLL.GetRecordCount() > 0)
         {
             AspNetPager1.RecordCount = EispGuestBookBLL.GetRecordCount();
             GuestBookBind(AspNetPager1.RecordCount, AspNetPager1.PageSize);
         }
     }
 }
Esempio n. 4
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in GridView1.Rows)
     {
         if (((CheckBox)row.FindControl("chk")).Checked)
         {
             int id = int.Parse(((Label)row.FindControl("id")).Text);
             // this.News_Delete(id);
             EispGuestBookBLL.DeleteGuestBookByID(id);
         }
     }
     if (EispGuestBookBLL.GetRecordCount() > 0)
     {
         AspNetPager1.RecordCount = EispGuestBookBLL.GetRecordCount();
         GuestBookBind(AspNetPager1.RecordCount, AspNetPager1.PageSize);
     }
 }