Exemple #1
0
        public IHttpActionResult FindSubOne(Guid id) => Json(SubControlService.TryCatchAction(
                                                                 action: m =>
        {
            id.CheckNotEmpty("id");
            var cacheUser = GetCacheUser;

            SubControl queryable = m.SubControlQueryable.FirstOrDefault(mx => mx.Id == id && ListOrganizeId.Contains(mx.LigthPoleOne.HostOne.Organize_Id));
            if (cacheUser.IsAdministrator)
            {
                queryable = m.SubControlQueryable.FirstOrDefault(mx => mx.Id == id);
            }
            SubControlView subv = queryable.MapTo <SubControlView>();
            return(new OperationResult(OperationResultType.Success, "请求数据成功", subv));
        }));
Exemple #2
0
 public IHttpActionResult GetSubNum([FromBody] params Guid[] Ids) => Json(SubControlService.TryCatchAction(
                                                                              action: m => {
     if (!Ids.IsEmpty())
     {
         var user = GetCacheUser;
         if (!GetCacheUser.IsAdministrator)
         {
             foreach (Guid id in Ids)
             {
                 if (!ListOrganizeId.Contains(id))
                 {
                     throw new Exception($"id:没有权限查询组织机构信息:{id}");
                 }
             }
         }
         return(m.GetSubCount(Ids));
     }
     else
     {
         return(m.GetSubCount(ListOrganizeId.ToArray()));
     }
 }));
Exemple #3
0
        public IHttpActionResult EditSubControls([FromBody] params SubControlInputDto[] datas) => Json(SubControlService.TryCatchAction(
                                                                                                           action: m =>
        {
            datas.CheckNotNullOrEmpty("datas");
            var cacheUser = GetCacheUser;

            // 不管信息是否添加成功?都执行删除当前对象页的缓存
            ICache cache = CacheManager.GetCacher <SubControlView>();
            cache.Clear();
            // --------------------------------------------

            return(m.EditSubControls(cacheUser, datas));
        }));
Exemple #4
0
 public IHttpActionResult DeleteSubReadTimeDatas([FromBody] Guid[] Ids) => Json(SubControlService.TryCatchAction(
                                                                                    action: m =>
 {
     Ids.CheckNotNullOrEmpty("Ids");
     var cacheUser = GetCacheUser;
     // 不管信息是否添加成功?都执行删除当前对象页的缓存
     ICache cache = CacheManager.GetCacher <SubReadTimeDataView>();
     cache.Clear();
     // --------------------------------------------
     return(m.DeleteReadTimeDatas(cacheUser, Ids));
 }));
Exemple #5
0
 public IHttpActionResult EidtSubLocation(Guid id, double x1, double y2) => Json(SubControlService.TryCatchAction(
                                                                                     action: m =>
 {
     id.CheckNotEmpty("id");
     var cacheUser = GetCacheUser;
     return(m.EidtSubLocation(id, x1, y2));
 }));
Exemple #6
0
        public IHttpActionResult GetSubReadTimeDatas([FromBody] GridRequestsModel grid) => Json(SubControlService.TryCatchAction(
                                                                                                    action: m =>
        {
            grid.CheckNotNull("grid");
            var cacheUser = GetCacheUser;

            //查询条件
            GridRequests request = new GridRequests(grid);
            //添加默认排序,只有排序未设置的情况下生效
            request.AddDefaultSortCondition(new SortCondition("UpdateTime", ListSortDirection.Descending));

            var queryable1 = from a in m.SubAggregationQueryable
                             join b in ListOrganizeId
                             on a.Organzie_Id equals b
                             join c in m.SubControlQueryable
                             on a.SubControl_Id equals c.Id
                             join d in m.SubRealTimeDataQueryable
                             on c.Id equals d.SubControl_Id
                             select new SubReadTimeDataView
            {
                Brightness         = d.Brightness,
                SubControl_Id      = d.SubControl_Id,
                Id                 = d.Id,
                CreatedTime        = d.CreatedTime,
                Current            = d.Current,
                DataItemDetailName = d.DataItemDetailOne.FullName,
                FullName           = d.FullName,
                DataItemDetail_Id  = d.DataItemDetail_Id,
                DimmingPort        = d.DimmingPort,
                Frequency          = d.Frequency,
                Power              = d.Power,
                SubControlName     = d.SubControlOne.SubName,
                Temperature        = d.Temperature,
                UpdateTime         = d.UpdateTime,
                Voltage            = d.Voltage,
                RegPacket          = d.SubControlOne.LigthPoleOne.HostOne.RegPackage
            };


            if (cacheUser.IsAdministrator)
            {
                queryable1 = from d in m.SubRealTimeDataQueryable
                             select new SubReadTimeDataView
                {
                    Brightness         = d.Brightness,
                    SubControl_Id      = d.SubControl_Id,
                    Id                 = d.Id,
                    CreatedTime        = d.CreatedTime,
                    Current            = d.Current,
                    DataItemDetailName = d.DataItemDetailOne.FullName,
                    FullName           = d.FullName,
                    DataItemDetail_Id  = d.DataItemDetail_Id,
                    DimmingPort        = d.DimmingPort,
                    Frequency          = d.Frequency,
                    Power              = d.Power,
                    SubControlName     = d.SubControlOne.SubName,
                    Temperature        = d.Temperature,
                    UpdateTime         = d.UpdateTime,
                    Voltage            = d.Voltage,
                    RegPacket          = d.SubControlOne.LigthPoleOne.HostOne.RegPackage
                };
            }

            Expression <Func <SubReadTimeDataView, bool> > predicate = FilterHelper.GetExpression <SubReadTimeDataView>(request.FilterGroup);

            var data = queryable1.ToPageCache <SubReadTimeDataView, SRTDPageOutDto>(predicate, request.PageCondition);

            return(new OperationResult(OperationResultType.Success, "获取数据成功!", data));
        }));
Exemple #7
0
        public IHttpActionResult GetSubControls([FromBody] GridRequestsModel grid) => Json(SubControlService.TryCatchAction(
                                                                                               action: m =>
        {
            grid.CheckNotNull("grid");
            var cacheUser = GetCacheUser;

            //查询条件
            GridRequests request = new GridRequests(grid);
            //添加默认排序,只有排序未设置的情况下生效
            request.AddDefaultSortCondition(new SortCondition("CreatedTime", ListSortDirection.Descending));

            var queryable1 = from a in LightPoleService.LightPoleQueryable
                             join b in MyHostqueryable
                             on a.Host_Id equals b.Id
                             select new LightPoleView
            {
                Address            = a.Address,
                Id                 = a.Id,
                Host_Id            = a.Host_Id,
                CreatedTime        = a.CreatedTime,
                DataItemDetailName = a.DataItemDetailOne.FullName,
                DataItemDetail_Id  = a.DataItemDetail_Id,
                HostName           = a.HostOne.FullName,
                PoleName           = a.PoleName,
                PoleNum            = a.PoleNum,
                Remark             = a.Remark,
                OrganizeName       = a.HostOne.OrganizeOne.FullName,
                Organize_Id        = a.HostOne.Organize_Id,
                RegPacket          = a.HostOne.RegPackage
            };

            var queryable2 = from s in m.SubControlQueryable
                             join l in queryable1
                             on s.LigthPoleOne_Id equals l.Id
                             select new SubControlView
            {
                Id = s.Id,
                DataItemDetail_Id  = s.DataItemDetail_Id,
                LigthPoleOne_Id    = s.LigthPoleOne_Id,
                CreatedTime        = s.CreatedTime,
                DataItemDetailName = s.DataItemDetailOne.FullName,
                LigthPoleOneName   = s.LigthPoleOne.PoleName,
                OrganizeName       = l.OrganizeName,
                Organize_Id        = l.Organize_Id,
                Remark             = s.Remark,
                SubName            = s.SubName,
                SubNum             = s.SubNum,
                UID       = s.UID,
                RegPacket = l.RegPacket,
                Latitude  = s.Latitude,
                Longitude = s.Longitude
            };
            if (cacheUser.IsAdministrator)
            {
                queryable2 = from a in m.SubControlQueryable
                             join b in LightPoleService.LightPoleQueryable
                             on a.LigthPoleOne_Id equals b.Id
                             select new SubControlView
                {
                    Id = a.Id,
                    DataItemDetail_Id  = a.DataItemDetail_Id,
                    LigthPoleOne_Id    = a.LigthPoleOne_Id,
                    CreatedTime        = a.CreatedTime,
                    DataItemDetailName = a.DataItemDetailOne.FullName,
                    LigthPoleOneName   = a.LigthPoleOne.PoleName,
                    OrganizeName       = b.HostOne.OrganizeOne.FullName,
                    Organize_Id        = b.HostOne.Organize_Id,
                    Remark             = a.Remark,
                    SubName            = a.SubName,
                    SubNum             = a.SubNum,
                    UID       = a.UID,
                    RegPacket = b.HostOne.RegPackage,
                    Latitude  = a.Latitude,
                    Longitude = a.Longitude
                };
            }

            Expression <Func <SubControlView, bool> > predicate = FilterHelper.GetExpression <SubControlView>(request.FilterGroup);

            var data = queryable2.ToPageCache <SubControlView, SubControlPageOutDto>(predicate, request.PageCondition);

            //缓存用户获取的主机列表主机,用于操作验证
            var cacheUserId = data.ListData.Select(b => b.Id);
            ICache iCache   = CacheManager.GetCacher("CacheSubControlsId");
            iCache.Set(cacheUser.UserName.AESEncrypt128(), cacheUserId, TimeSpan.FromMinutes(30));
            //-------------------------------------------------------------------------------------

            return(new OperationResult(OperationResultType.Success, "获取数据成功!", data));
        }));
Exemple #8
0
 public IHttpActionResult Host_0x29([FromBody] SubControl_0x29_In data) => Json(SubControlService.TryCatchAction(m =>
 {
     return(m.UpdatedHost_0x29(data));
 }));
Exemple #9
0
 public IHttpActionResult Host_0x16([FromBody] params SubRealTimeData_0x16_In[] datas) => Json(SubControlService.TryCatchAction(m =>
 {
     return(m.UpdateSubReadTimeData_0x16(datas));
 }));
Exemple #10
0
 public IHttpActionResult GetOffineSubs() => Json(SubControlService.TryCatchAction(
                                                      action: m => {
     return(m.GetOffineSubs());
 }));