Example #1
0
        public List <UIArea> GetAllAreas()
        {
            string cacheKey = PkPmCacheKeys.AllAreasFromSysDict;
            var    areas    = cacheAreas.Get(cacheKey);

            if (areas == null)
            {
                List <SysDict> result       = new List <SysDict>();
                var            dictCategory = dictRep.GetByCondition(r => r.KeyValue == "CustomArea" && r.CategoryId == -1 && r.Status == 1);
                if (dictCategory != null && dictCategory.Count > 0)
                {
                    result = dictRep.GetByConditionSort(r => r.CategoryId == dictCategory[0].Id, new SortingOptions <SysDict>(r => new { r.OrderNo }));
                }
                areas = result.Where(e => e.KeyValue != "500100" || !e.Name.Contains("重庆市")).Select(r => new UIArea()
                {
                    AreaCode = r.KeyValue, AreaName = r.Name
                }).ToList();
                cacheAreas.Put(cacheKey, areas);
                return(areas);
            }
            else
            {
                return(areas);
            }
        }
Example #2
0
        private SearchResult <CBRUnitUIModel> GetSearchResult(CBRUnitSearchModel searchModel)
        {
            var predicate = PredicateBuilder.True <t_D_UserTableTen>();

            int pos   = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0;
            int count = searchModel.count.HasValue ? searchModel.count.Value : 30;

            //if (!string.IsNullOrWhiteSpace(searchModel.CheckUnitName))
            //{
            //    predicate = predicate.And(t => t.unitCode == searchModel.CheckUnitName);
            //}

            string orderby      = string.Empty;
            string orderByAcs   = string.Empty;
            bool   isDes        = true;
            string sortProperty = "id";

            //string[] columns = { "CheckBox", "SeqNo", "NAME", "UNITNAME" };
            //if (searchModel.orderColInd.HasValue
            //    && !string.IsNullOrWhiteSpace(searchModel.direct)
            //    && searchModel.orderColInd.Value <= columns.Length)
            //{
            //    if (searchModel.direct == "asc")
            //    {
            //        sortProperty = orderby = columns[searchModel.orderColInd.Value];
            //        isDes = false;
            //    }
            //    if (searchModel.direct == "des")
            //    {
            //        sortProperty = orderByAcs = columns[searchModel.orderColInd.Value];
            //        isDes = true;
            //    }
            //}

            PagingOptions <t_D_UserTableTen> pagingOption = new PagingOptions <t_D_UserTableTen>(pos, count, sortProperty, isDes);

            var customs = repTen.GetByConditionSort <CBRUnitUIModel>(predicate, r => new
            {
                r.id,
                r.pid,
                r.zjsp1,
                r.zjsp2,
                r.slr,
                r.slbh,
                r.cbr,
                r.@static,
                r.outstaticinfo
            },
                                                                     pagingOption);

            return(new SearchResult <Models.CBRUnitUIModel>(pagingOption.TotalItems, customs));
        }
Example #3
0
        private SearchResult <t_sys_Version> GetSearchResult(SysSoftwareVersSearchModel model)
        {
            int pos       = model.posStart.HasValue ? model.posStart.Value : 0;
            int count     = model.count.HasValue ? model.count.Value : 30;
            var predicate = PredicateBuilder.True <t_sys_Version>();

            if (!string.IsNullOrEmpty(model.Name))
            {
                predicate = predicate.And(t => t.name.Contains(model.Name));//.Contains(t.name));
            }
            string sortProperty = "FileVersionDate";
            PagingOptions <t_sys_Version> pagingOption = new PagingOptions <t_sys_Version>(pos, count, sortProperty, true);

            var information = rep.GetByConditionSort <t_sys_Version>(predicate, r => new { r.id, r.usercode, r.name, r.FileVersion, r.FileVersionDate, r.EndDate }, pagingOption);

            return(new SearchResult <t_sys_Version>(pagingOption.TotalItems, information));
        }
Example #4
0
        private SearchResult <SysInfoSearchUIModel> GetSearchResult(SysInfoSearchModel model)
        {
            int pos       = model.posStart.HasValue ? model.posStart.Value : 0;
            int count     = model.count.HasValue ? model.count.Value : 30;
            var predicate = PredicateBuilder.True <t_bp_PkpmJCRU>();

            if (!string.IsNullOrEmpty(model.InformationName))
            {
                predicate = predicate.And(t => t.name.Contains(model.InformationName));//.Contains(t.name));
            }
            string sortProperty = "addtime";
            PagingOptions <t_bp_PkpmJCRU> pagingOption = new PagingOptions <t_bp_PkpmJCRU>(pos, count, sortProperty, true);

            var information = rep.GetByConditionSort <SysInfoSearchUIModel>(predicate, r => new { r.ID, r.name, r.content, r.addtime }, pagingOption);

            return(new SearchResult <SysInfoSearchUIModel>(pagingOption.TotalItems, information));
        }
Example #5
0
        public List <SysDict> GetDictsByKey(string key)
        {
            string cachekey     = PkPmCacheKeys.SysDictByKeyFmt.Fmt(key);
            var    dictCategory = cache.Get(cachekey);

            if (dictCategory != null)
            {
                return(dictCategory);
            }
            else
            {
                List <SysDict> result = new List <SysDict>();
                dictCategory = rep.GetByCondition(r => r.KeyValue == key && r.CategoryId == -1 && r.Status == 1);
                if (dictCategory != null && dictCategory.Count > 0)
                {
                    result = rep.GetByConditionSort(r => r.CategoryId == dictCategory[0].Id, new SortingOptions <SysDict>(r => new { r.OrderNo }));
                }
                cache.Remove(cachekey);
                cache.Add(cachekey, result);
                return(result);
            }
        }
Example #6
0
        private SearchResult <DistributeExpertUIModel> GetSearchResult(DistributeExpertSearchModel searchModel)
        {
            var predicate = PredicateBuilder.True <t_D_UserTableTen>();

            #region 动态查询

            //var instFilter = GetCurrentInstFilter();
            //if (instFilter.NeedFilter && instFilter.FilterInstIds.Count() > 0)
            //{
            //    predicate = predicate.And(t => instFilter.FilterInstIds.Contains(t.unitcode));
            //}

            //if (IsCurrentSuperVisor())
            //{
            //    var area = GetCurrentAreas();
            //    var userInArea = checkUnitService.GetUnitByArea(area);
            //    var insts = userInArea.Select(t => t.Key).ToList();
            //    if (insts != null && insts.Count >= 0)
            //    {
            //        predicate = predicate.And(t => insts.Contains(t.unitcode));
            //    }
            //}

            #endregion

            int pos   = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0;
            int count = searchModel.count.HasValue ? searchModel.count.Value : 30;

            string orderby      = string.Empty;
            string orderByAcs   = string.Empty;
            bool   isDes        = true;
            string sortProperty = "id";

            //string[] columns = { "CheckBox", "SeqNo", "NAME", "UNITNAME" };
            //if (searchModel.orderColInd.HasValue
            //    && !string.IsNullOrWhiteSpace(searchModel.direct)
            //    && searchModel.orderColInd.Value <= columns.Length)
            //{
            //    if (searchModel.direct == "asc")
            //    {
            //        sortProperty = orderby = columns[searchModel.orderColInd.Value];
            //        isDes = false;
            //    }
            //    if (searchModel.direct == "des")
            //    {
            //        sortProperty = orderByAcs = columns[searchModel.orderColInd.Value];
            //        isDes = true;
            //    }
            //}

            PagingOptions <t_D_UserTableTen> pagingOption = new PagingOptions <t_D_UserTableTen>(pos, count, sortProperty, isDes);

            var customs = rep.GetByConditionSort <DistributeExpertUIModel>(predicate, r => new
            {
                r.id,
                r.pid,
                r.zjsp1,
                r.zjsp2,
                r.@static
            },
                                                                           pagingOption);

            return(new SearchResult <Models.DistributeExpertUIModel>(pagingOption.TotalItems, customs));
        }
Example #7
0
        private SearchResult <ApplyQualityUIModel> GetSearchResult(ApplyQualifySearchModel searchModel)
        {
            var predicate = PredicateBuilder.True <t_D_UserTableOne>();

            //获取分配给当前用户专家审批的资质机构
            var expertUnits = repExp.GetByCondition(p => p.userid == GetCurrentUserId());

            #region 动态查询

            if (expertUnits != null && expertUnits.Count > 0)
            {
                var pids = expertUnits.Select(e => e.pid).ToList();
                predicate = predicate.And(t => pids.Contains(t.id));
            }

            if (searchModel.Area != "-1" && !string.IsNullOrWhiteSpace(searchModel.Area))
            {
                predicate = predicate.And(t => t.area == searchModel.Area);
            }
            if (!string.IsNullOrWhiteSpace(searchModel.CheckUnitName))
            {
                predicate = predicate.And(t => t.unitCode == searchModel.CheckUnitName);
            }
            if (searchModel.CMADStartDt.HasValue)
            {
                predicate = predicate.And(t => t.time >= searchModel.CMADStartDt.Value);
            }
            if (searchModel.CMADEndDt.HasValue)
            {
                predicate = predicate.And(t => t.time <= searchModel.CMADEndDt.Value);
            }

            #endregion

            int pos   = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0;
            int count = searchModel.count.HasValue ? searchModel.count.Value : 30;

            string[] columns      = { "CheckBox", "SeqNo", "NAME", "UNITNAME" };
            string   orderby      = string.Empty;
            string   orderByAcs   = string.Empty;
            bool     isDes        = true;
            string   sortProperty = "addtime";

            PagingOptions <t_D_UserTableOne> pagingOption = new PagingOptions <t_D_UserTableOne>(pos, count, sortProperty, isDes);

            var customs = repOne.GetByConditionSort <ApplyQualityUIModel>(predicate, r => new
            {
                r.id,
                r.name,
                r.unitname,
                r.unitCode,
                r.onepath_zl,
                r.twopath_zl,
                r.threepath_zl,
                r.Fourpath_zl,
                r.fivepath_zl,
                r.Sixpath_zl,
                r.Sevenpath_zl,
                r.type
            },
                                                                          pagingOption);

            return(new SearchResult <Models.ApplyQualityUIModel>(pagingOption.TotalItems, customs));
        }