Beispiel #1
0
        public async Task <RoomListDto> LoadRoomListAsync(string token)
        {
            var roomCodeList = await RoomCodeRep.LoadRoomSymbolListAsync(token);

            var sysCodeList = await SysCodeRep.GetCodeListByMutliTypesAsync(token, new string[] { SystemCodeTypes.ROOM_CATEGORY, SystemCodeTypes.ROOM_GALLERY_CODE, SystemCodeTypes.ROOM_FLOOR_CODE, SystemCodeTypes.ROOM_STATE_TYPE });

            var guestList = await GuestRepository.GetListByStatusAsync(token, GuestInfoState.I); //在住客人列表

            var customerNOArray = guestList.Select(x => x.Id).ToArray();                         //在住客人账号列表
            var guestAccList    = await AccRepository.GetListByGuestIdsAsync(token, customerNOArray);

            var guestBookingList = await GuestRepository.GetListByStatusAsync(token, GuestInfoState.N);

            guestBookingList = guestBookingList.Where(x => (x.CheckInDate.HasValue && x.CheckInDate == DateTime.Today) && !x.RoomNo.IsEmpty()).ToList();//今日预低客人信息

            RoomListDto roomListGuiDto = new RoomListDto();

            roomListGuiDto.RoomList = BuildRoomList(sysCodeList, roomCodeList, guestAccList, guestList, guestBookingList);

            roomListGuiDto.GalleryList   = BuildGalleryList(sysCodeList, roomCodeList);
            roomListGuiDto.RoomTypeList  = BuildRoomTypeList(sysCodeList);
            roomListGuiDto.RoomStateList = BuildRoomStateList(sysCodeList);
            roomListGuiDto.RoomStatistic = BuildRoomStatisticInfo(roomCodeList);

            return(roomListGuiDto);
        }
Beispiel #2
0
        public async Task <ActionResult> RoomList()
        {
            try
            {
                var operatorProvider = OperatorProvider.Provider.GetCurrent();
                var list             = await _roomService.LoadRoomListAsync(operatorProvider.ConnectToken);

                list.ResponseResult = new AjaxResult()
                {
                    Status = ResultType.Success.ToString()
                };
                var json = list.ToJson();
                return(Content(json));
            }
            catch (Exception ex)
            {
                RoomListDto obj = new RoomListDto();
                obj.ResponseResult = new AjaxResult()
                {
                    Status = ResultType.Error.ToString(), Message = ex.Message
                };
                return(Content(obj.ToJson()));
                //throw new Exception(ex.Message);
            }
        }
Beispiel #3
0
        public TableData GetList(int pageIndex, int pageSize, string key, string parentId, string communityId)
        {
            var query = _roomRepository.Table.Where(a => !a.Deleted);

            if (!communityId.IsBlank())
            {
                query = query.Where(a => a.CommunityUUID == communityId);
            }

            if (!parentId.IsBlank())
            {
                var parentArea = _areaRepository.GetById(parentId);
                if (parentArea != null)
                {
                    query = query.Where(a => a.Area.Code.StartsWith(parentArea.Code));
                }
            }

            if (!key.IsBlank())
            {
                query = query.Where(a => a.RoomName.Contains(key));
            }
            query = query.OrderByDescending(o => o.CreateTime);
            var pagedList = query.ToPagedList(pageIndex, pageSize);

            var roomList = new List <RoomListDto>();

            foreach (var item in pagedList)
            {
                var dto = new RoomListDto();
                dto.RoomUUID          = item.RoomUUID;
                dto.AreaCode          = item.Area.AreaCode;
                dto.RoomName          = item.RoomName;
                dto.OtherCode         = item.OtherCode;
                dto.ResidenceTypeName = item.ResidenceTypeDict?.DictName ?? "";
                //  dto.Code = item.Area.Code;
                dto.AreaTypeName = _dictRepository.TableNoTracking.Where(a => a.DictType == Pojo.Enum.DictTypeEnum.AreaType.ToString() && a.DictCode == item.Area.AreaType.ToString()).FirstOrDefault().DictName;
                roomList.Add(dto);
            }

            return(new TableData
            {
                currPage = pageIndex,
                pageSize = pageSize,
                pageTotal = pagedList.TotalPageCount,
                totalCount = pagedList.TotalItemCount,
                list = roomList
            });
        }
Beispiel #4
0
        public IList <RoomListDto> GetRoomList(string communityId, string areaId = null)
        {
            var query = _roomRepository.Table.Where(a => !a.Deleted);

            if (!communityId.IsBlank())
            {
                query = query.Where(a => a.CommunityUUID == communityId);
            }

            if (!areaId.IsBlank())
            {
                query = query.Where(a => a.AreaUUID == areaId);
            }

            query = query.OrderBy(o => o.RoomName);
            Stopwatch sw = new Stopwatch();

            sw.Start();
            var pagedList = query.ToList();

            sw.Stop();
            var       listTotal = sw.ElapsedMilliseconds;
            Stopwatch sw1       = new Stopwatch();

            sw1.Start();
            var roomList = new List <RoomListDto>();
            var areaList = _areaRepository.Table.ToList();

            foreach (var item in pagedList)
            {
                var area = areaList.Find(t => t.AreaUUID == item.AreaUUID);
                var dto  = new RoomListDto();
                dto.RoomUUID     = item.RoomUUID;
                dto.RoomName     = item.RoomName;
                dto.RoomFullName = GetFormattedBreadCrumb(area, areaList);
                //dto.RoomFullName = item.RoomFullName; //GetFormattedBreadCrumb(area);
                roomList.Add(dto);
            }
            sw1.Stop();
            var buTotal = sw1.ElapsedMilliseconds;

            return(roomList);
        }