예제 #1
0
        private MapElementCollectionsViewModel LoadMark(string tenantCode, int pageIndex, int pageSize, EnumMapType mapType)
        {
            IMapElementService service = new MapElementService();
            MapElementCollectionsViewModel returnValue = new MapElementCollectionsViewModel();
            int markTotal = 0;
            IList<EMarkElement> ltMarkEntity = service.Search<EMarkElement>(tenantCode, string.Empty, pageIndex, pageSize, out markTotal);
            if (ltMarkEntity != null)
            {
                try
                {
                    ConvertLatLonHelper.ConvertToWebLatLon<EMarkElement>(ltMarkEntity, mapType);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.Message, ex);
                }

                returnValue.MapElementCount = markTotal;
                foreach (var e in ltMarkEntity)
                {
                    returnValue.MapElementCollections.Add(ConvertEMarkElementForBind(e));
                }
            }
            return returnValue;
        }
예제 #2
0
        private MapElementCollectionsViewModel LoadMarkAndArea(string tenantCode, int pageIndex, int pageSize, EnumMapType mapType)
        {
            IMapElementService service = new MapElementService();
            MapElementCollectionsViewModel returnValue = new MapElementCollectionsViewModel();
            int markTotal = 0;
            List<EBaseElement> ltBaseEle = new List<EBaseElement>();
            IList<EMarkElement> markEntity = service.Search<EMarkElement>(tenantCode, string.Empty, 0, 50000, out markTotal);
            if (markEntity != null && markEntity.Count > 0)
            {
                foreach (var item in markEntity)
                {
                    ltBaseEle.Add(item);
                }
            }
            int areaTotal = 0;
            IList<EAreaElement> areaEntity = service.Search<EAreaElement>(tenantCode, string.Empty, 0, 50000, out areaTotal);
            if (areaEntity != null && areaEntity.Count > 0)
            {
                foreach (var item in areaEntity)
                {
                    ltBaseEle.Add(item);
                }
            }
            ltBaseEle = ltBaseEle.OrderByDescending(o => o.CreateTime).ToList();
            if (ltBaseEle.Count >= pageSize)
            {
                pageIndex = ConvertCommon.ProcessPageIndex(ltBaseEle.Count, pageIndex, pageSize);
                ltBaseEle = ltBaseEle.Skip(pageIndex * pageSize).ToList();
                if (ltBaseEle.Count > pageSize)
                {
                    ltBaseEle = ltBaseEle.Take(pageSize).ToList();
                }
            }
            returnValue.MapElementCollections = ConvertMapElementVM(ltBaseEle, mapType);

            returnValue.MapElementCount = markTotal + areaTotal;
            return returnValue;
        }
예제 #3
0
        private MapElementCollectionsViewModel LoadArea(string tenantCode, int pageIndex, int pageSize, EnumMapType mapType)
        {
            IMapElementService service = new MapElementService();
            MapElementCollectionsViewModel returnValue = new MapElementCollectionsViewModel();
            int areaTotal = 0;
            IList<EAreaElement> ltAreaEntity = service.Search<EAreaElement>(tenantCode, string.Empty, pageIndex, pageSize, out areaTotal);
            if (!ltAreaEntity.IsNullOrEmpty())
            {
                returnValue.MapElementCount = areaTotal;

                ConvertToWebLatLon(ltAreaEntity, mapType);

                foreach (var e in ltAreaEntity)
                {
                    returnValue.MapElementCollections.Add(ConvertEAreaElementForBind(e));
                }
            }
            return returnValue;
        }