Esempio n. 1
0
        public RequestPageResult <SelectModelOutput> FindManufacturerInfoForSelect(PageSearchCondition <ManufacturerInfoSearchConditionInput> searchCondition)
        {
            var rst = new RequestPageResult <SelectModelOutput>()
            {
                Flag = false
            };

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var trupleData = GetRepositoryData(searchCondition);
                rst.ResultDatas = trupleData.Where(ter => ter.IsActive).Select(item => new SelectModelOutput()
                {
                    Value = item.Id.ToString().ToLower(),
                    Key   = item.Id,
                    Text  = item.ManufacturerName
                }).ToList();
                rst.TotalCount = trupleData.Count();
                rst.Flag       = true;
            }
            catch { }
            return(rst);
        }
Esempio n. 2
0
        public RequestPageResult <VideoDevEquipmentInfoOutput> FindDatas(PageSearchCondition <VideoDevEquipmentInfoSearchConditionInput> searchCondition)
        {
            RequestPageResult <VideoDevEquipmentInfoOutput> rst = new RequestPageResult <VideoDevEquipmentInfoOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = _repository.GetAllIncluding(dev => dev.EquipmentInfo, video => video.VideoDev);
                datas = GetRepositoryData(datas, searchCondition);

                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = datas.OrderBy <VideoDevEquipmentInfo>(searchCondition.Sorting).ThenBy(dev => dev.Id);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                var rstDatas = ObjectMapper.Map <List <VideoDevEquipmentInfoOutput> >(datas);
                rst.ResultDatas = rstDatas;
                rst.Flag        = true;
            }
            catch { }
            return(rst);
        }
Esempio n. 3
0
        public RequestPageResult <SelectModelOutput> FindVideoTerminalForSelect(PageSearchCondition <VideoDevEquipmentInfoSearchConditionInput> searchCondition)
        {
            RequestPageResult <SelectModelOutput> rst = new RequestPageResult <SelectModelOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                searchCondition.SearchCondition.IsOnlyActive = true;
                var datas = _repository.GetAllIncluding(video => video.VideoDev);
                var videoTerminalDatas = GetRepositoryData(datas, searchCondition).Select(item => item.VideoDev);
                videoTerminalDatas = videoTerminalDatas.OrderBy(v => v.SeqNo).ThenBy(v => v.DevName);
                rst.ResultDatas    = videoTerminalDatas.Select(dev => new SelectModelOutput
                {
                    Key   = dev.Id,
                    Text  = dev.DevName,
                    Value = dev.Id.ToString().ToLower()
                }).ToList();
                rst.Flag = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 4
0
        public RequestPageResult <SelectModelOutput> FindEquipmentTypeForSelect(PageSearchCondition <EquipmentTypeSearchConditionInput> searchCondition)
        {
            var rst = new RequestPageResult <SelectModelOutput>()
            {
                Flag = false
            };

            if (searchCondition == null)
            {
                return(rst);
            }

            try
            {
                searchCondition.SearchCondition.IsOnlyActive = true;
                var datas = GetRepositoryData(searchCondition);
                rst.ResultDatas = datas.Select(item => new SelectModelOutput()
                {
                    Value = item.Id.ToString().ToLower(),
                    Key   = item.Id,
                    Text  = item.Name
                }).ToList();
                rst.Flag = true;
            }
            catch { }
            return(rst);
        }
Esempio n. 5
0
        public RequestPageResult <EquipmentTypeOutput> FindDatas(PageSearchCondition <EquipmentTypeSearchConditionInput> searchCondition)
        {
            var rst = new RequestPageResult <EquipmentTypeOutput>()
            {
                Flag = false
            };

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = GetRepositoryData(searchCondition);
                var count = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting).ThenBy(item => item.Name) : datas.OrderBy(type => type.Name);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = ObjectMapper.Map <List <EquipmentTypeOutput> >(datas);
                rst.TotalCount  = count;
                rst.Flag        = true;
            }
            catch { }
            return(rst);
        }
        public RequestPageResult <SelectModelOutput> FindVideoDevForSelect(PageSearchCondition <VideoDevSearchConditionInput> searchCondition)
        {
            RequestPageResult <SelectModelOutput> rst = new RequestPageResult <SelectModelOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                searchCondition.SearchCondition.IsOnlyActive = true;
                var preDatas = searchCondition.SearchCondition.IsNeedPresetPoint ? _repository.GetAllIncluding(dev => dev.PresetPoints) : _repository.GetAllIncluding();
                var datas    = GetReponsityData(searchCondition, preDatas);
                datas           = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting).ThenBy(dev => dev.SeqNo) : datas.OrderBy(dev => dev.SeqNo).ThenBy(dev => dev.DevName);
                rst.ResultDatas = datas.Select(dev => new SelectModelOutput
                {
                    Key      = dev.Id,
                    ParentId = dev.VideoDevId,
                    Text     = dev.DevName,
                    Value    = dev.Id.ToString().ToLower()
                }).ToList();
                rst.Flag = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
        public RequestPageResult <InspectionItemResultOutput> FindDatas(PageSearchCondition <InspectionItemResultSearchConditionInput> searchCondition)
        {
            RequestPageResult <InspectionItemResultOutput> rst = new RequestPageResult <InspectionItemResultOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = _inspectionItemResultRepository.GetAll();
                datas = datas
                        .WhereIf(!searchCondition.SearchCondition.ItemName.IsNullOrEmpty(), e => e.ItemName.Contains(searchCondition.SearchCondition.ItemName, StringComparison.Ordinal))
                        .WhereIf(searchCondition.SearchCondition.InspectionResultId.HasValue, e => e.InspectionResultId == searchCondition.SearchCondition.InspectionResultId)
                        .WhereIf(searchCondition.SearchCondition.MaxAnalysisTime.HasValue, e => e.AnalysisTime < searchCondition.SearchCondition.MaxAnalysisTime)
                        .WhereIf(searchCondition.SearchCondition.MinAnalysisTime.HasValue, e => e.AnalysisTime >= searchCondition.SearchCondition.MinAnalysisTime);
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting) : datas.OrderByDescending(e => e.AnalysisTime);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = ObjectMapper.Map <List <InspectionItemResultOutput> >(datas);
                rst.Flag        = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 8
0
        public RequestPageResult <FunctionOutput> FindDatas(PageSearchCondition <FunctionSearchConditionInput> searchCondition)
        {
            RequestPageResult <FunctionOutput> rst = new RequestPageResult <FunctionOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                IQueryable <SysFunction> datas;
                datas = _repository.GetAllIncluding();
                datas = GetfilteredData(datas, searchCondition);
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy <SysFunction>(searchCondition.Sorting).ThenBy(dev => dev.SeqNo) : datas.OrderBy(dev => dev.Id);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                var rstDatas = ObjectMapper.Map <List <FunctionOutput> >(datas);
                rst.ResultDatas = rstDatas;
                rst.Flag        = true;
            }
            catch { }
            return(rst);
        }
Esempio n. 9
0
        public RequestPageResult <ManufacturerInfoOutput> FindDatas(PageSearchCondition <ManufacturerInfoSearchConditionInput> searchCondition)
        {
            RequestPageResult <ManufacturerInfoOutput> rst = new RequestPageResult <ManufacturerInfoOutput>()
            {
                Flag = false
            };

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = GetRepositoryData(searchCondition);
                //获取条件下所有数量
                var totalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(item => searchCondition.Sorting) : datas.OrderBy(item => item.ManufacturerName);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);

                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }

                rst.TotalCount  = totalCount;
                rst.ResultDatas = ObjectMapper.Map <List <ManufacturerInfoOutput> >(datas);
                rst.Flag        = true;
            }
            catch { }
            return(rst);
        }
Esempio n. 10
0
        public RequestPageResult <PowerSupplyLineOutput> FindDatas(PageSearchCondition <PowerSupplyLineSearchConditionInput> searchCondition)
        {
            RequestPageResult <PowerSupplyLineOutput> rst = new RequestPageResult <PowerSupplyLineOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = searchCondition.SearchCondition.IsNeedChildren ? _powerSupplyLineRepository.GetAllIncluding(line => line.TransformerSubstations) : _powerSupplyLineRepository.GetAll();
                if (searchCondition.SearchCondition.IsOnlyActive)
                {
                    datas = datas.Where(line => line.IsActive);
                }
                datas = datas.WhereIf(!searchCondition.SearchCondition.LineName.IsNullOrEmpty(), line => line.LineName.Contains(searchCondition.SearchCondition.LineName));
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting) : datas.OrderBy(line => line.LineName);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = ObjectMapper.Map <List <PowerSupplyLineOutput> >(datas);
                rst.Flag        = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 11
0
		protected void dataSourceMain_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
		{
			WhereSqlClauseBuilder builder = ConditionMapping.GetWhereSqlClauseBuilder(this.Condition);

			string cate = Request.QueryString["category"];
			if (string.IsNullOrEmpty(cate) == false)
				builder.AppendItem("CATEGORY", cate);

			this.dataSourceMain.Condition = builder;
		}
Esempio n. 12
0
        private IQueryable <EquipmentType> GetRepositoryData(PageSearchCondition <EquipmentTypeSearchConditionInput> searchCondition)
        {
            var datas = _repository.GetAll();

            datas = datas
                    .WhereIf(searchCondition.SearchCondition.IsOnlyActive, type => type.IsActive)
                    .WhereIf(!string.IsNullOrWhiteSpace(searchCondition.SearchCondition.Name), type => type.Name.Contains(searchCondition.SearchCondition.Name, StringComparison.Ordinal));

            return(datas);
        }
 private IQueryable <VideoDev> GetReponsityData(PageSearchCondition <VideoDevSearchConditionInput> searchCondition, IQueryable <VideoDev> datas)
 {
     return(datas
            .WhereIf(searchCondition.SearchCondition.IsOnlyActive, dev => dev.IsActive)
            .WhereIf(searchCondition.SearchCondition.DevType.HasValue, dev => dev.DevType == searchCondition.SearchCondition.DevType)
            .WhereIf(searchCondition.SearchCondition.ManufacturerInfoId.HasValue, dev => dev.ManufacturerInfoId == searchCondition.SearchCondition.ManufacturerInfoId)
            .WhereIf(searchCondition.SearchCondition.TransformerSubstationId.HasValue, dev => dev.TransformerSubstationId == searchCondition.SearchCondition.TransformerSubstationId)
            .WhereIf(searchCondition.SearchCondition.VideoDevId.HasValue, dev => dev.VideoDevId == searchCondition.SearchCondition.VideoDevId && dev.DevType != VideoDevTypeEnum.硬盘录像机)
            .WhereIf(searchCondition.SearchCondition.IsVideoTerminal, dev => dev.DevType != VideoDevTypeEnum.硬盘录像机)
            .WhereIf(!searchCondition.SearchCondition.DevName.IsNullOrEmpty(), dev => dev.DevName.Contains(searchCondition.SearchCondition.DevName, StringComparison.Ordinal)));
 }
        private IQueryable <EquipmentInfo> GetRepositoryData(PageSearchCondition <EquipmentInfoSearchConditionInput> searchCondition)
        {
            var datas = _repository.GetAllIncluding(type => type.EquipmentType, sub => sub.TransformerSubstation, mf => mf.ManufacturerInfo);

            datas = datas.
                    WhereIf(searchCondition.SearchCondition.TransformerSubstationId != null, item => item.TransformerSubstationId == searchCondition.SearchCondition.TransformerSubstationId).
                    WhereIf(searchCondition.SearchCondition.EquipmentTypeId != null, item => item.EquipmentTypeId == searchCondition.SearchCondition.EquipmentTypeId).
                    WhereIf(searchCondition.SearchCondition.IsOnlyActive, item => item.IsActive).
                    WhereIf(!string.IsNullOrWhiteSpace(searchCondition.SearchCondition.Name), item => item.Name.Contains(searchCondition.SearchCondition.Name, StringComparison.Ordinal));

            return(datas);
        }
Esempio n. 15
0
        private IQueryable <ManufacturerInfo> GetRepositoryData(PageSearchCondition <ManufacturerInfoSearchConditionInput> searchCondition)
        {
            var datas = _manufacturerInfoRepository.GetAll();

            datas = datas.
                    WhereIf(searchCondition.SearchCondition.IsOnlyDeleted, ter => ter.IsDeleted).
                    WhereIf(!searchCondition.SearchCondition.IsOnlyDeleted, ter => !ter.IsDeleted).
                    WhereIf(searchCondition.SearchCondition.IsOnlyActive, ter => ter.IsActive).
                    WhereIf(!searchCondition.SearchCondition.ManufacturerName.IsNullOrEmpty(), item => item.ManufacturerName.Contains(searchCondition.SearchCondition.ManufacturerName, StringComparison.Ordinal));

            return(datas);
        }
Esempio n. 16
0
        protected void dataSourceMain_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            WhereSqlClauseBuilder builder = ConditionMapping.GetWhereSqlClauseBuilder(this.Condition);

            string cate = Request.QueryString["category"];

            if (string.IsNullOrEmpty(cate) == false)
            {
                builder.AppendItem("CATEGORY", cate);
            }

            this.dataSourceMain.Condition = builder;
        }
Esempio n. 17
0
		protected void Page_Load(object sender, EventArgs e)
		{
			if (Page.IsPostBack == false || this.EnableViewState == false)
			{
				this.Condition = new PageSearchCondition();

				lnk1.NavigateUrl = "TaskMonitor.aspx?" + Request.QueryString;
				lnk2.NavigateUrl = "TaskAchived.aspx?" + Request.QueryString;
			}

			this.searchBinding.Data = this.Condition;

			this.Response.CacheControl = "no-cache";
		}
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false || this.EnableViewState == false)
            {
                this.Condition = new PageSearchCondition();

                lnk1.NavigateUrl = "TaskMonitor.aspx?" + Request.QueryString;
                lnk2.NavigateUrl = "TaskAchived.aspx?" + Request.QueryString;
            }

            this.searchBinding.Data = this.Condition;

            this.Response.CacheControl = "no-cache";
        }
Esempio n. 19
0
        public RequestPageResult <SelectModelOutput> FindPresetPointsForSelect(PageSearchCondition <PresetPointSearchCondition> searchCondition)
        {
            RequestPageResult <SelectModelOutput> rst = new RequestPageResult <SelectModelOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = _presetPointRepository.GetAll();
                if (searchCondition.SearchCondition.IsOnlyActive)
                {
                    datas = datas.Where(ter => ter.IsActive);
                }
                datas = datas
                        .WhereIf(!searchCondition.SearchCondition.Name.IsNullOrEmpty(), p => p.Name.Contains(searchCondition.SearchCondition.Name, StringComparison.Ordinal))
                        .WhereIf(searchCondition.SearchCondition.VideoDevId.HasValue, p => p.VideoDevId == searchCondition.SearchCondition.VideoDevId)
                        .WhereIf(searchCondition.SearchCondition.Number != 0, p => p.Number == searchCondition.SearchCondition.Number);
                //获取条件下所有数量
                //rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting) : datas.OrderBy(ter => ter.Name);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != 0)
                {
                    datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = datas.Select(p => new SelectModelOutput
                {
                    Key   = p.Id,
                    Text  = p.Name,
                    Value = p.Id.ToString().ToLower()
                }).ToList();
                rst.Flag    = true;
                rst.Message = "操作成功";
            }
            catch (Exception ex)
            {
                rst.Flag    = false;
                rst.Message = ex.ToString();
            }
            return(rst);
        }
Esempio n. 20
0
        public virtual RequestPageResult <UserOutput> FindDatas([FromBody] PageSearchCondition <UserSearchConditionInput> searchCondition)
        {
            RequestPageResult <UserOutput> rst = new RequestPageResult <UserOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                var datas     = _sysUserRepository.GetAllIncluding()
                                .WhereIf(!searchCondition.SearchCondition.UserName.IsNullOrEmpty(), u => u.UserName.Contains(searchCondition.SearchCondition.UserName, StringComparison.Ordinal));
                if (searchCondition.SearchCondition.IsOnlyActive)
                {
                    datas = datas.Where(u => u.IsActive);
                }
                rst.TotalCount = datas.Count();
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                if (!string.IsNullOrWhiteSpace(searchCondition.Sorting))
                {
                    datas = datas.OrderBy(searchCondition.Sorting);
                }
                else
                {
                    datas = datas.OrderBy(u => u.UserName);
                }
                rst.ResultDatas = ObjectMapper.Map <List <UserOutput> >(datas);
                rst.Flag        = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 21
0
        public RequestPageResult <TransformerSubstationOutput> FindDatas(PageSearchCondition <TransformerSubstationSearchConditionInput> searchCondition)
        {
            RequestPageResult <TransformerSubstationOutput> rst = new RequestPageResult <TransformerSubstationOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = searchCondition.SearchCondition.IsNeedChildren ? _transformerSubstationRepository.GetAllIncluding(Station => Station.VideoDevs) : _transformerSubstationRepository.GetAll();
                if (searchCondition.SearchCondition.IsOnlyActive)
                {
                    datas = datas.Where(sub => sub.IsActive);
                }
                datas = datas.WhereIf(searchCondition.SearchCondition.SubstationName != null, sub => sub.SubstationName.Contains(searchCondition.SearchCondition.SubstationName, StringComparison.OrdinalIgnoreCase));

                datas = datas.WhereIf(searchCondition.SearchCondition.PowerSupplyLineId != null, sub => (sub.PowerSupplyLineId ?? new Guid()).Equals(searchCondition.SearchCondition.PowerSupplyLineId));
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting) : datas.OrderBy(sub => sub.SubstationName);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = ObjectMapper.Map <List <TransformerSubstationOutput> >(datas);
                rst.Flag        = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 22
0
        public RequestPageResult <InspectionCardOutput> FindDatas(PageSearchCondition <InspectionCardSearchConditionInput> searchCondition)
        {
            RequestPageResult <InspectionCardOutput> rst = new RequestPageResult <InspectionCardOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = searchCondition.SearchCondition.IsNeedChildren ? _inspectionCardRepository.GetAllIncluding(card => card.TransformerSubstation, card => card.InspectionItems, card => card.InspectionPlanTasks) : _inspectionCardRepository.GetAllIncluding(card => card.TransformerSubstation);
                if (searchCondition.SearchCondition.IsOnlyActive)
                {
                    datas = datas.Where(ter => ter.IsActive);
                }
                datas = datas
                        .WhereIf(!searchCondition.SearchCondition.CardName.IsNullOrEmpty(), card => card.CardName.Contains(searchCondition.SearchCondition.CardName, StringComparison.Ordinal))
                        .WhereIf(searchCondition.SearchCondition.TransformerSubstationId.HasValue, card => card.TransformerSubstationId == searchCondition.SearchCondition.TransformerSubstationId);
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting) : datas.OrderBy(card => card.CardName);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = ObjectMapper.Map <List <InspectionCardOutput> >(datas);
                rst.Flag        = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 23
0
        public RequestPageResult <InspectionItemOutput> FindDatas(PageSearchCondition <InspectionItemSearchConditionInput> searchCondition)
        {
            RequestPageResult <InspectionItemOutput> rst = new RequestPageResult <InspectionItemOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = _inspectionItemRepository.GetAllIncluding(item => item.InspectionCard, item => item.PresetPoint, item => item.VideoDev);
                if (searchCondition.SearchCondition.IsOnlyActive)
                {
                    datas = datas.Where(ter => ter.IsActive);
                }
                datas = datas
                        .WhereIf(!searchCondition.SearchCondition.ItemName.IsNullOrEmpty(), item => item.ItemName.Contains(searchCondition.SearchCondition.ItemName, StringComparison.Ordinal))
                        .WhereIf(searchCondition.SearchCondition.InspectionCardId.HasValue, item => item.InspectionCardId == searchCondition.SearchCondition.InspectionCardId);
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting).ThenBy(item => item.SeqNo) : datas.OrderBy(item => item.SeqNo);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }
                rst.ResultDatas = ObjectMapper.Map <List <InspectionItemOutput> >(datas);
                rst.Flag        = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 24
0
        private IQueryable <SysFunction> GetfilteredData(IQueryable <SysFunction> datas, PageSearchCondition <FunctionSearchConditionInput> searchCondition)
        {
            //按照id查询所有父id和查询id相等的条列
            var resList = datas.WhereIf(!string.IsNullOrWhiteSpace(searchCondition.SearchCondition.Name), item => item.Name.Contains(searchCondition.SearchCondition.Name))
                          .WhereIf(!string.IsNullOrWhiteSpace(searchCondition.SearchCondition.Code), item => item.Code.Contains(searchCondition.SearchCondition.Code))
                          .WhereIf(searchCondition.SearchCondition.Id.HasValue, item => item.SysFunctionId == searchCondition.SearchCondition.Id);

            return(resList);
        }
        public RequestPageResult <VideoDevOutput> FindDatas(PageSearchCondition <VideoDevSearchConditionInput> searchCondition)
        {
            RequestPageResult <VideoDevOutput> rst = new RequestPageResult <VideoDevOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var preDatas = searchCondition.SearchCondition.IsNeedPresetPoint ? _repository.GetAllIncluding(dev => dev.PresetPoints, dev => dev.ManufacturerInfo) : _repository.GetAllIncluding(dev => dev.ManufacturerInfo);

                var datas = GetReponsityData(searchCondition, preDatas);
                //获取条件下所有数量
                rst.TotalCount = datas.Count();
                //排序
                datas = !string.IsNullOrWhiteSpace(searchCondition.Sorting) ? datas.OrderBy(searchCondition.Sorting).ThenBy(dev => dev.SeqNo) : datas.OrderBy(dev => dev.SeqNo);
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas = datas.PageBy(skipCount, searchCondition.PageSize);
                }

                List <VideoDevOutput> rstDatas = null;
                if (!searchCondition.SearchCondition.IsVideoTerminal && searchCondition.SearchCondition.IsNeedChildren)
                {
                    var temp = _repository.GetAllIncluding(dev => dev.ManufacturerInfo).Where(dev => dev.DevType != VideoDevTypeEnum.硬盘录像机);
                    temp = temp.WhereIf(searchCondition.SearchCondition.IsOnlyActive, dev => dev.IsActive);

                    rstDatas = datas.GroupJoin(temp, pDev => pDev.Id, cDev => cDev.VideoDevId, (pDev, cDev) => new VideoDevOutput
                    {
                        Id                      = pDev.Id,
                        SeqNo                   = pDev.SeqNo,
                        DevName                 = pDev.DevName,
                        DevType                 = pDev.DevType,
                        ManufacturerInfoId      = pDev.ManufacturerInfoId,
                        IP                      = pDev.IP,
                        Port                    = pDev.Port,
                        DevUserName             = pDev.DevUserName,
                        DevPassword             = pDev.DevPassword,
                        ChannelNo               = pDev.ChannelNo,
                        IsPTZ                   = pDev.IsPTZ,
                        IsActive                = pDev.IsActive,
                        TransformerSubstationId = pDev.TransformerSubstationId,
                        VideoDevId              = pDev.VideoDevId,
                        Children                = ObjectMapper.Map <List <VideoDevOutput> >(cDev.OrderBy(dev => dev.SeqNo))
                    }).ToList();
                }
                else
                {
                    rstDatas = ObjectMapper.Map <List <VideoDevOutput> >(datas);
                }

                rst.ResultDatas = rstDatas;
                rst.Flag        = true;
            }
            catch //(Exception ex)
            {
                //throw new Exception(ex.ToString());
                rst.Flag = false;
            }
            return(rst);
        }
Esempio n. 26
0
 private IQueryable <VideoDevEquipmentInfo> GetRepositoryData(IQueryable <VideoDevEquipmentInfo> datas, PageSearchCondition <VideoDevEquipmentInfoSearchConditionInput> searchCondition)
 {
     if (datas == null)
     {
         return(null);
     }
     return(datas
            .WhereIf(searchCondition.SearchCondition.IsOnlyActive, dev => dev.IsActive)
            .WhereIf(searchCondition.SearchCondition.TransformerSubstationId.HasValue, dev => dev.TransformerSubstationId == searchCondition.SearchCondition.TransformerSubstationId)
            .WhereIf(searchCondition.SearchCondition.EquipmentInfoId.HasValue, dev => dev.EquipmentInfoId == searchCondition.SearchCondition.EquipmentInfoId)
            .WhereIf(searchCondition.SearchCondition.VideoDevId.HasValue, dev => dev.VideoDevId == searchCondition.SearchCondition.VideoDevId)
            .WhereIf(!searchCondition.SearchCondition.VideoDevName.IsNullOrWhiteSpace(), dev => dev.VideoDev.DevName.Contains(searchCondition.SearchCondition.VideoDevName))
            .WhereIf(!searchCondition.SearchCondition.EquipmentInfoName.IsNullOrWhiteSpace(), dev => dev.EquipmentInfo.Name.Contains(searchCondition.SearchCondition.EquipmentInfoName)));
 }
Esempio n. 27
0
        public RequestPageResult <PowerSupplyLineOutput> GetPowerSupplyLinesAndChildrenAsync(PageSearchCondition <PowerSupplyLineSearchConditionInput> searchCondition)
        {
            RequestPageResult <PowerSupplyLineOutput> rst = new RequestPageResult <PowerSupplyLineOutput>();

            if (searchCondition == null)
            {
                return(rst);
            }
            try
            {
                var datas = _powerSupplyLineRepository.GetAllIncluding(line => line.TransformerSubstations)
                            .WhereIf(!searchCondition.SearchCondition.LineName.IsNullOrEmpty(), line => line.LineName.Contains(searchCondition.SearchCondition.LineName, StringComparison.Ordinal))
                            .Where(line => line.IsActive);
                rst.TotalCount = datas.Count();
                //分页
                int skipCount = searchCondition.PageIndex <= 0 ? -1 : ((searchCondition.PageIndex - 1) * searchCondition.PageSize);
                if (skipCount != -1)
                {
                    datas.PageBy(skipCount, searchCondition.PageSize);
                }

                var devs     = _videoDevRepository.GetAll().Where(dev => dev.IsActive);
                var tempDevs = _videoDevRepository.GetAll().Where(dev => dev.IsActive);
                IQueryable <VideoDevOutput> devOuputs = devs.GroupJoin(tempDevs, pDev => pDev.Id, cDev => cDev.VideoDevId, (pDev, cDev) => new VideoDevOutput
                {
                    Id                      = pDev.Id,
                    SeqNo                   = pDev.SeqNo,
                    DevName                 = pDev.DevName,
                    DevType                 = pDev.DevType,
                    ManufacturerInfoId      = pDev.ManufacturerInfoId,
                    IP                      = pDev.IP,
                    Port                    = pDev.Port,
                    DevUserName             = pDev.DevUserName,
                    DevPassword             = pDev.DevPassword,
                    ChannelNo               = pDev.ChannelNo,
                    DevNo                   = pDev.DevNo,
                    IsPTZ                   = pDev.IsPTZ,
                    IsActive                = pDev.IsActive,
                    TransformerSubstationId = pDev.TransformerSubstationId,
                    VideoDevId              = pDev.VideoDevId,
                    Children                = ObjectMapper.Map <List <VideoDevOutput> >(cDev.OrderBy(devOuput => devOuput.SeqNo))
                }).OrderBy(devOuput => devOuput.SeqNo).AsQueryable();

                var subs = _transformerSubstationRepository.GetAll().Where(dev => dev.IsActive);
                IQueryable <TransformerSubstationOutput> subOuputs = subs.GroupJoin(devOuputs, sub => sub.Id, dev => dev.TransformerSubstationId, (sub, dev) => new TransformerSubstationOutput
                {
                    Id                = sub.Id,
                    SubstationName    = sub.SubstationName,
                    CommMgrIP         = sub.CommMgrIP,
                    Remark            = sub.Remark,
                    IsActive          = sub.IsActive,
                    PowerSupplyLineId = sub.PowerSupplyLineId,
                    VideoDevs         = dev
                }).AsQueryable();

                List <PowerSupplyLineOutput> rstDatas = datas.GroupJoin(subOuputs, line => line.Id, sub => sub.PowerSupplyLineId, (line, sub) => new PowerSupplyLineOutput
                {
                    Id       = line.Id,
                    LineName = line.LineName,
                    Remark   = line.Remark,
                    IsActive = line.IsActive,
                    TransformerSubstations = sub
                }).ToList();
#if DEBUG
                //Console.WriteLine("【GetPowerSupplyLinesAndChildrenAsync】SQL:"+ datas.ToString());
#endif
                rst.ResultDatas = rstDatas;
                rst.Flag        = true;
            }
            catch
            {
                rst.Flag = false;
            }
            return(rst);
        }