public JsonResult GetInfo(string ID) { var mql2 = TS_RepairShopSet.SelectAll().Where(TS_RepairShopSet.Id.Equal(ID)); TS_RepairShop Rmodel = OPBiz.GetEntity(mql2); // groupsBiz.Add(rol); return(MyJson(Rmodel)); }
/// <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; } }
public JsonResult EditInfo(TS_RepairShop DitModle) { HttpReSultMode ReSultMode = new HttpReSultMode(); bool IsAdd = false; if (DitModle.Details != null) { DitModle.Details = DitModle.Details.Replace("<", "<").Replace(">", ">"); } else { DitModle.Details = ""; } DitModle.UpdateTime = DateTime.Now; if (DitModle.Longitude != null && DitModle.Latitude != null)//geohash编码 { double Latitude = double.Parse(DitModle.Latitude.ToString()); double Longitude = double.Parse(DitModle.Longitude.ToString()); DitModle.geohash = Geohash.Encode(Latitude, Longitude); } if (!(DitModle.Id != null && !DitModle.Id.ToString().Equals("00000000-0000-0000-0000-000000000000")))//id为空,是添加 { IsAdd = true; } if (IsAdd) { #region 初始化 DitModle.Id = Guid.NewGuid(); DitModle.CreateTime = DateTime.Now; DitModle.CreateManId = UserData.Id; DitModle.Praises = 0; DitModle.CallCount = 0; DitModle.Clicks = 0; DitModle.States = 0; DitModle.isDeleted = false; DitModle.isValid = 1; DitModle.Star = 1; #endregion try { OPBiz.Add(DitModle); ReSultMode.Code = 11; ReSultMode.Data = DitModle.Id.ToString(); ReSultMode.Msg = "添加成功"; } catch (Exception e) { ReSultMode.Code = -11; ReSultMode.Data = e.ToString(); ReSultMode.Msg = "添加失败"; } } else { DitModle.WhereExpression = TS_RepairShopSet.Id.Equal(DitModle.Id); //DitModle.ChangedMap.Remove("doctorid");//移除主键值 var mqlO = TS_RepairShopSet.SelectAll().Where(TS_RepairShopSet.Id.Equal(DitModle.Id)); TS_RepairShop modelOld = OPBiz.GetEntity(mqlO);//旧数据 #region 能修改的数据 DitModle.CreateTime = modelOld.CreateTime; DitModle.CreateManId = modelOld.CreateManId; DitModle.Praises = modelOld.Praises; DitModle.CallCount = modelOld.CallCount; DitModle.Clicks = modelOld.Clicks; DitModle.States = modelOld.States; DitModle.isDeleted = modelOld.isDeleted; DitModle.isValid = modelOld.isValid; DitModle.Star = modelOld.Star; #endregion if (OPBiz.Update(DitModle) > 0) { ReSultMode.Code = 11; ReSultMode.Data = ""; ReSultMode.Msg = "修改成功"; } else { ReSultMode.Code = -13; ReSultMode.Data = ""; ReSultMode.Msg = "修改失败"; } } return(Json(ReSultMode, JsonRequestBehavior.AllowGet)); }
// 请求例子 /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(); }