Ejemplo n.º 1
0
        /// <summary>
        /// 根据类型 Id获取绑定的信息
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="CType">类型</param>
        /// <returns></returns>
        public JsonResult GetBindInfo(string ID, string CType)
        {
            var mql = TS_ShopSet.SelectAll().Where(TS_ShopSet.Id.Equal(ID));

            switch (CType)
            {
            case "1":    //店铺
                TS_ShopBiz sb = new TS_ShopBiz();
                mql = TS_ShopSet.SelectAll().Where(TS_ShopSet.Id.Equal(ID));
                TS_Shop Rmodel = sb.GetEntity(mql);
                return(MyJson(Rmodel, JsonRequestBehavior.AllowGet));

                break;

            case "2":    //便民服务
                TS_ServiceBiz sb2 = new TS_ServiceBiz();
                mql = TS_ServiceSet.SelectAll().Where(TS_ServiceSet.Id.Equal(ID));
                TS_Service Rmodel2 = sb2.GetEntity(mql);;
                return(MyJson(Rmodel2, JsonRequestBehavior.AllowGet));

                break;

            case "3":    //维修店
                TS_RepairShopBiz sb3 = new TS_RepairShopBiz();
                mql = TS_RepairShopSet.SelectAll().Where(TS_RepairShopSet.Id.Equal(ID));
                TS_RepairShop Rmodel3 = sb3.GetEntity(mql);
                return(MyJson(Rmodel3, JsonRequestBehavior.AllowGet));

                break;

            case "4":    //便民信息
                TS_ServiceNewBiz sb4 = new TS_ServiceNewBiz();
                mql = TS_ServiceNewSet.SelectAll().Where(TS_ServiceNewSet.Id.Equal(ID));
                TS_ServiceNew Rmodel4 = sb4.GetEntity(mql);
                return(MyJson(Rmodel4, JsonRequestBehavior.AllowGet));

                break;

            default:

                return(null);

                break;
            }
        }
Ejemplo n.º 2
0
        // 请求例子  /httpSever/TS_RepairShopHandler.ashx?json={"jsonEntity":{"Category":"06","CityCode":"4502","Longitude":"108.267898","Latitude":"22.847358"},"pageIndex":"1","pageSize":"20","action":"GetByCategory"}
        // 请求例子  /httpSever/TS_RepairShopHandler.ashx?json={"jsonEntity":{"Category":"06","KeyWords":"电车","Longitude":"110.22587","Latitude":"25.272585"},"pageIndex":"1","pageSize":"20","action":"SearhByKeyWords"}
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            // context.Response.Write("Hello World");
            HttpReSultMode resultMode = new HttpReSultMode();
            string         Id         = "";
            int            res        = 0;//返回结果行数

            try
            {
                JObject httpObject = JsonHelper.FromJson(context.Request["json"]);

                switch (httpObject["action"].ToString())
                {
                case "GetByCategory":
                    this.GetByCategory(context, httpObject, resultMode);
                    break;

                case "GetById":
                    #region
                    Id = FilterTools.FilterSpecial(httpObject["jsonEntity"]["Id"].ToString());
                    var           mqlG   = TS_RepairShopSet.SelectAll().Where(TS_RepairShopSet.Id.Equal(Id));
                    TS_RepairShop modelG = OPBiz.GetEntity(mqlG);
                    if (modelG != null)
                    {
                        resultMode.Code = 11;
                        resultMode.Msg  = "获取成功";
                        resultMode.Data = JsonHelper.ToJson(modelG, true);
                    }
                    else
                    {
                        resultMode.Code = -13;
                        resultMode.Msg  = "数据不存在";
                        resultMode.Data = "";
                    }
                    #endregion

                    break;

                case "ClickCount":    //点击量
                    Id  = FilterTools.FilterSpecial(httpObject["jsonEntity"]["Id"].ToString());
                    res = OPBiz.SetCout("Id", Id, "Clicks");
                    if (res > 0)
                    {
                        resultMode.Code = 11;
                        resultMode.Data = res.ToString();
                        resultMode.Msg  = "统计成功";
                    }
                    else
                    {
                        resultMode.Code = -13;
                        resultMode.Data = "0";
                        resultMode.Msg  = "统计失败!";
                    }


                    break;

                case "PraiseCount":    //点赞量加1
                    Id  = FilterTools.FilterSpecial(httpObject["jsonEntity"]["Id"].ToString());
                    res = OPBiz.SetCout("Id", Id, "Praises");
                    if (res > 0)
                    {
                        resultMode.Code = 11;
                        resultMode.Data = res.ToString();
                        resultMode.Msg  = "统计成功";
                    }
                    else
                    {
                        resultMode.Code = -13;
                        resultMode.Data = "0";
                        resultMode.Msg  = "统计失败!";
                    }


                    break;

                case "CallCount":    //呼叫量加1
                    Id  = FilterTools.FilterSpecial(httpObject["jsonEntity"]["Id"].ToString());
                    res = OPBiz.SetCout("Id", Id, "CallCount");
                    if (res > 0)
                    {
                        resultMode.Code = 11;
                        resultMode.Data = res.ToString();
                        resultMode.Msg  = "统计成功";
                    }
                    else
                    {
                        resultMode.Code = -13;
                        resultMode.Data = "0";
                        resultMode.Msg  = "统计失败!";
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                resultMode.Code = -11;
                resultMode.Data = ex.ToString();
            }
            context.Response.Write(JsonHelper.ToJson(resultMode, true));
            context.Response.End();
        }