Ajax处理函数模板

 public void IsAjaxFunction()
        {
            string state = "0";
            string isAjax = this.GetRequest("isAjax").ToLower();

            if (isAjax == "true")
            {
                string action = this.GetRequest("action").ToString();
                string values = this.GetRequest("values").ToString();
                switch (action)
                {
                    case "repost":
                        state = this.Db.GetState("update Product set FlushTime=getdate() where P_ID=@P_ID", new System.Data.SqlClient.SqlParameter("@P_ID", values)) ? ("1") : ("0");
                        break;
                    case "shanchu":
                        state = this.Db.GetState("delete from  Product where P_ID=@P_ID", new System.Data.SqlClient.SqlParameter("@P_ID", values)) ? ("1") : ("0");
                        break;
                    default:
                        break;
                }
                Response.Clear();
                Response.Write(state);
                Response.End();
            }
        }

posted on 2009-06-09 14:33  bestsaler  阅读(107)  评论(0编辑  收藏  举报