public JsonResult Detail(Guid pmuid, Guid?useruid) { JsonResult result = new JsonResult(); result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; useruid = useruid == null? UserContext.account.Usr_UId:useruid; //获取账号访问设备uid的访问次数,并不设置过期时间 Func <List <VisitCount> > initvisit = () => { return(new List <VisitCount>()); }; List <VisitCount> vclist = DBHelper.getWithNoExpire <List <VisitCount> >(initvisit, useruid + ConfigurationManager.AppSettings["VisitPressureMeterCount"]); //增加账号访问设备uid的访问次数 Func <List <VisitCount> > visitcount = () => account_service.AddDeviceVisits(vclist, pmuid); DBHelper.getAndFresh <VisitCount>(visitcount, useruid + ConfigurationManager.AppSettings["VisitPressureMeterCount"]); //获取并返回设备uid的区域状态数据 AreaDevice_t ad = areadevice_service.GetAreaDeviceByDeviceUid(pmuid); Func <List <PressureMeterStatusAndArea> > pmsFunc = () => pressuremeter_service.GetPressureMeterStatusByArea(ad.AD_AreaUid); result.Data = DBHelper.get <PressureMeterStatusAndArea>(pmsFunc, ConfigurationManager.AppSettings["PressureMeterStatusByAreaUid"] + ad.AD_AreaUid).ToList(); //Func<List<PressureMeterStatusAndArea>> pmAndStatusArea = () => (pressuremeter_service.GetPressureMeterStatusAndArea()); //result.Data = DBHelper.get<PressureMeterStatusAndArea>(pmAndStatusArea, ConfigurationManager.AppSettings["allPressureMeterStatusAndArea"]).Where(p => p.pressuremeter.PM_UId == pmuid).ToList(); return(result); }
/// <summary> /// /// </summary> /// <param name="uid"></param> /// <returns></returns> public JsonResult Detail(Guid uid) { JsonResult result = new JsonResult(); //获取账号访问设备uid的访问次数,不设置过期时间 Func <List <VisitCount> > initvisit = () => { return(new List <VisitCount>()); }; List <VisitCount> vclist = DBHelper.getWithNoExpire <List <VisitCount> >(initvisit, UserContext.account.Usr_UId + ConfigurationManager.AppSettings["VisitFlowMeterCount"]); //增加账号访问设备uid的访问次数 Func <List <VisitCount> > visitcount = () => account_Service.AddDeviceVisits(vclist, uid); DBHelper.getAndFresh <VisitCount>(visitcount, UserContext.account.Usr_UId + ConfigurationManager.AppSettings["VisitFlowMeterCount"]); //获取并返回设备uid的区域状态数据 AreaDevice_t ad = areadevice_Service.GetAreaDeviceByDeviceUid(uid); Func <List <FlowMeterStatusAndArea> > fmsFunc = () => flowmeter_Service.GetFlowMeterStatusByArea(ad.AD_AreaUid); result.Data = DBHelper.get <FlowMeterStatusAndArea>(fmsFunc, ConfigurationManager.AppSettings["FlowMeterStatusByAreaUid"] + ad.AD_AreaUid).Where(p => p.flowmeter.FM_UId == uid).ToList(); //Func<List<FlowMeterStatusAndArea>> fmAndStatusArea = () => (flowmeter_Service.GetFlowMeterStatusAndArea()); //result.Data = DBHelper.get<FlowMeterStatusAndArea>(fmAndStatusArea, ConfigurationManager.AppSettings["allFlowMeterStatusAndArea"]).Where(p => p.flowmeter.FM_UId == uid).ToList(); return(result); }