码迷,mamicode.com
首页 > 其他好文 > 详细

ashx 方法模板

时间:2015-04-01 19:15:20      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:

        int count = 0;
            this.page = DTRequest.GetQueryInt("page", 1);
            //查询字符串拼接
            string searchparams = DTRequest.GetQueryString("jsonstring");
            fooddetail model = jss.Deserialize<fooddetail>(searchparams);
            StringBuilder searchsql = new StringBuilder();
            //判断名字是否为空
            if (!string.IsNullOrEmpty(model.dishesName))
            {
                searchsql.Append(" and dishesName like ‘%" + model.dishesName + "%‘");
            }
            BLL.restaurant bll = new BLL.restaurant();
            try
            {
                var dt = bll.GetList(10, 1, "dishesId>0" + searchsql.ToString(), "sort_id asc,add_time desc,dishesId desc", out count).Tables[0];
                string strjson = Dtb2Json(dt);
                context.Response.Write("{\"retcode\": 1,\"retmsg\": \"Success\", \"foodlist\":" + strjson + "}");
            }
            catch (Exception e)
            {
                context.Response.Write("{\"retcode\": 2,\"retmsg\": \"" + e.Message + "\"}");
            }
            finally
            {
                context.Response.End();

            }

 

ashx 方法模板

标签:

原文地址:http://www.cnblogs.com/sunzhenyong/p/4384618.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!