zoukankan      html  css  js  c++  java
  • 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();
                    string nickName = this.GetRequest("nickName").ToString();
                    string NewsId = this.GetRequest("NewsId").ToString();
                    try
                    {
                        switch (action)
                        {
                            case "add":
                                state = this.Db.GetState("insert into NewsComment(NewsId,NickName,Content,Ip) values(@NewsID,@NickName,@Content,@IP)", this.Db.MakeParameters("@NewsID", NewsId, "@NickName", nickName, "@Content", values, "@IP", Request.UserHostAddress.ToString())) ? ("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;
                        }
                    }
                    catch (Exception ex)
                    {
                        state = ex.Message;
                    }
                    Response.Clear();
                    Response.Write(state);
                    Response.End();
                }
            }

  • 相关阅读:
    HLG 1522 子序列的和【队列的应用】
    POJ 3273 Monthly Expense【二分】
    HDU 4004 The Frog's Games 【二分】
    POJ 2001 Shortest Prefixes【第一棵字典树】
    POJ 2823 Sliding Window【单调对列经典题目】
    HDU 1969 Pie 【二分】
    POJ 3125 Printer Queue【暴力模拟】
    POJ 3250 Bad Hair Day【单调栈】
    字典树【模板】
    验证码 Code
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835585.html
Copyright © 2011-2022 走看看