Ejemplo n.º 1
0
        public SearchUI()
        {
            this.m_SearchList = new SearchList();
            this.m_SearchListCollectionView = new ListCollectionView(this.m_SearchList);
            this.m_PhysicianClientCollection = new Client.Model.PhysicianClientCollection();
            this.m_RDPhysicianClientCollection = new Client.Model.PhysicianClientCollection();
            this.m_PatientHistoryList = new YellowstonePathology.Business.Patient.Model.PatientHistoryList();

            this.m_ResultList = new SearchResultList();
        }
Ejemplo n.º 2
0
 public SearchResultList GetSearchResults(string searchString, SearchMode type, ref SearchResultList resultList)
 {
     try
     {
         SearchResultList result = CourseStorage.Search(searchString, type, ref resultList);
         return(result);
     }
     catch (KeyNotFoundException)
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
        private async void SearchBox_OnTextChanged(object sender, TextChangedEventArgs e)
        {
            var    textboxSender = (TextBox)sender;
            string searchText    = textboxSender.Text.Trim();

            if (string.IsNullOrWhiteSpace(searchText))
            {
                ClearAndHideSearchResultListBox();
                return;
            }

            IsLoading = true;
            try
            {
                var graphService = MicrosoftGraphService.Instance;
                await graphService.TryLoginAsync();

                GraphServiceClient graphClient = graphService.GraphProvider;

                if (graphClient != null)
                {
                    var options = new List <QueryOption>
                    {
                        new QueryOption("$search", $"\"{searchText}\""),
                        new QueryOption("$filter", "personType/class eq 'Person' and personType/subclass eq 'OrganizationUser'")
                    };
                    IUserPeopleCollectionPage peopleList = await graphClient.Me.People.Request(options).GetAsync();

                    if (peopleList.Any())
                    {
                        List <Person> searchResult = peopleList.ToList();

                        // Remove all selected items
                        foreach (Person selectedItem in Selections)
                        {
                            searchResult.RemoveAll(u => u.UserPrincipalName == selectedItem.UserPrincipalName);
                        }

                        SearchResultList.Clear();
                        var result = SearchResultLimit > 0
                            ? searchResult.Take(SearchResultLimit).ToList()
                            : searchResult;
                        foreach (var item in result)
                        {
                            SearchResultList.Add(item);
                        }

                        _searchResultListBox.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        ClearAndHideSearchResultListBox();
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                IsLoading = false;
            }
        }
Ejemplo n.º 4
0
 private void ClearAndHideSearchResultListBox()
 {
     SearchResultList.Clear();
     _searchResultListBox.Visibility = Visibility.Collapsed;
 }
Ejemplo n.º 5
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (Session.GetHabbo().UsersRooms.Count >= 500)
            {
                Session.SendMessage(new CanCreateRoomComposer(true, 500));
                return;
            }

            string Name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            string Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            string ModelName   = Packet.PopString();

            int Category      = Packet.PopInt();
            int MaxVisitors   = Packet.PopInt(); //10 = min, 25 = max.
            int TradeSettings = Packet.PopInt(); //2 = All can trade, 1 = owner only, 0 = no trading.

            if (Name.Length < 3)
            {
                return;
            }

            if (Name.Length > 25)
            {
                return;
            }

            RoomModel RoomModel = null;

            if (!PlusEnvironment.GetGame().GetRoomManager().TryGetModel(ModelName, out RoomModel))
            {
                return;
            }

            SearchResultList SearchResultList = null;

            if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(Category, out SearchResultList))
            {
                Category = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank)
            {
                Category = 36;
            }

            if (MaxVisitors < 10 || MaxVisitors > 25)
            {
                MaxVisitors = 10;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            RoomData NewRoom = PlusEnvironment.GetGame().GetRoomManager().CreateRoom(Session, Name, Description, ModelName, Category, MaxVisitors, TradeSettings);

            if (NewRoom != null)
            {
                Session.SendMessage(new FlatCreatedComposer(NewRoom.Id, Name));
            }
        }
Ejemplo n.º 6
0
 private void ClearSelectedFilesButton_Click(object sender, EventArgs e)
 {
     SearchResultList.UncheckAll();
 }
Ejemplo n.º 7
0
        void WebSearchCompleted(object sender, SearchCompletedEventArgs e)
        {
            progressBing.IsIndeterminate = false;
            progressBing.Visibility = Visibility.Collapsed;
            searchPivot.SelectedIndex = 1;

            SearchResponse response = e.Result;
            ImageResponse imageResponse = e.Result.Image;

            SearchResultList searchResult = new SearchResultList();

            if (response.Web.Results.Count() > 0)
            {
                foreach (WebResult result in response.Web.Results)
                {
                    searchResult.Add(new SearchResult
                    {
                        Title = result.Title,
                        URL = result.Url,
                        Description = result.Description
                    });
                }
            }

            webSearchResult.ItemsSource = searchResult;
            imagesSearchResult.Items.Clear();

            foreach (ImageResult bingImage in response.Image.Results)
            {
                Image image = new Image();
                image.Source = new BitmapImage(new Uri(bingImage.Thumbnail.Url));

                image.Width = bingImage.Thumbnail.Width;
                image.Height = bingImage.Thumbnail.Height;

                imagesSearchResult.Items.Add(image);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = BiosEmuThiago.GetGame().GetRoomManager().LoadRoom(Packet.PopInt());

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            string word;
            string Name = Packet.PopString();

            Name = BiosEmuThiago.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name;
            string Description = Packet.PopString();

            Description = BiosEmuThiago.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description;
            RoomAccess Access     = RoomAccessUtility.ToRoomAccess(Packet.PopInt());
            string     Password   = Packet.PopString();
            int        MaxUsers   = Packet.PopInt();
            int        CategoryId = Packet.PopInt();
            int        TagCount   = Packet.PopInt();

            List <string> Tags          = new List <string>();
            StringBuilder formattedTags = new StringBuilder();

            for (int i = 0; i < TagCount; i++)
            {
                if (i > 0)
                {
                    formattedTags.Append(",");
                }

                string tag = Packet.PopString().ToLower();

                Tags.Add(tag);
                formattedTags.Append(tag);
            }

            int TradeSettings       = Packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading.
            int AllowPets           = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean()));
            int AllowPetsEat        = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean()));
            int RoomBlockingEnabled = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean()));
            int Hidewall            = Convert.ToInt32(BiosEmuThiago.BoolToEnum(Packet.PopBoolean()));
            int WallThickness       = Packet.PopInt();
            int FloorThickness      = Packet.PopInt();
            int WhoMute             = Packet.PopInt(); // mute
            int WhoKick             = Packet.PopInt(); // kick
            int WhoBan = Packet.PopInt();              // ban

            int chatMode     = Packet.PopInt();
            int chatSize     = Packet.PopInt();
            int chatSpeed    = Packet.PopInt();
            int chatDistance = Packet.PopInt();
            int extraFlood   = Packet.PopInt();

            if (chatMode < 0 || chatMode > 1)
            {
                chatMode = 0;
            }

            if (chatSize < 0 || chatSize > 2)
            {
                chatSize = 0;
            }

            if (chatSpeed < 0 || chatSpeed > 2)
            {
                chatSpeed = 0;
            }

            if (chatDistance < 0)
            {
                chatDistance = 1;
            }

            if (chatDistance > 99)
            {
                chatDistance = 100;
            }

            if (extraFlood < 0 || extraFlood > 2)
            {
                extraFlood = 0;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            if (WhoMute < 0 || WhoMute > 1)
            {
                WhoMute = 0;
            }

            if (WhoKick < 0 || WhoKick > 1)
            {
                WhoKick = 0;
            }

            if (WhoBan < 0 || WhoBan > 1)
            {
                WhoBan = 0;
            }

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (Name.Length < 1)
            {
                return;
            }

            if (Name.Length > 60)
            {
                Name = Name.Substring(0, 60);
            }

            if (Access == RoomAccess.PASSWORD && Password.Length == 0)
            {
                Access = RoomAccess.OPEN;
            }

            if (MaxUsers < 0)
            {
                MaxUsers = 10;
            }

            if (MaxUsers > 50)
            {
                MaxUsers = 50;
            }

            SearchResultList SearchResultList = null;

            if (!BiosEmuThiago.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList))
            {
                CategoryId = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank || (Session.GetHabbo().Id != Room.OwnerId && Session.GetHabbo().Rank >= SearchResultList.RequiredRank))
            {
                CategoryId = 36;
            }

            if (TagCount > 2)
            {
                return;
            }

            Room.AllowPets           = AllowPets;
            Room.AllowPetsEating     = AllowPetsEat;
            Room.RoomBlockingEnabled = RoomBlockingEnabled;
            Room.Hidewall            = Hidewall;

            Room.RoomData.AllowPets           = AllowPets;
            Room.RoomData.AllowPetsEating     = AllowPetsEat;
            Room.RoomData.RoomBlockingEnabled = RoomBlockingEnabled;
            Room.RoomData.Hidewall            = Hidewall;

            Room.Name        = Name;
            Room.Access      = Access;
            Room.Description = Description;
            Room.Category    = CategoryId;
            Room.Password    = Password;

            Room.RoomData.Name        = Name;
            Room.RoomData.Access      = Access;
            Room.RoomData.Description = Description;
            Room.RoomData.Category    = CategoryId;
            Room.RoomData.Password    = Password;

            Room.WhoCanBan           = WhoBan;
            Room.WhoCanKick          = WhoKick;
            Room.WhoCanMute          = WhoMute;
            Room.RoomData.WhoCanBan  = WhoBan;
            Room.RoomData.WhoCanKick = WhoKick;
            Room.RoomData.WhoCanMute = WhoMute;

            Room.ClearTags();
            Room.AddTagRange(Tags);
            Room.UsersMax = MaxUsers;

            Room.RoomData.Tags.Clear();
            Room.RoomData.Tags.AddRange(Tags);
            Room.RoomData.UsersMax = MaxUsers;

            Room.WallThickness           = WallThickness;
            Room.FloorThickness          = FloorThickness;
            Room.RoomData.WallThickness  = WallThickness;
            Room.RoomData.FloorThickness = FloorThickness;

            Room.chatMode     = chatMode;
            Room.chatSize     = chatSize;
            Room.chatSpeed    = chatSpeed;
            Room.chatDistance = chatDistance;
            Room.extraFlood   = extraFlood;

            Room.TradeSettings = TradeSettings;

            Room.RoomData.chatMode     = chatMode;
            Room.RoomData.chatSize     = chatSize;
            Room.RoomData.chatSpeed    = chatSpeed;
            Room.RoomData.chatDistance = chatDistance;
            Room.RoomData.extraFlood   = extraFlood;

            Room.RoomData.TradeSettings = TradeSettings;

            string AccessStr = Password.Length > 0 ? "password" : "open";

            switch (Access)
            {
            default:
            case RoomAccess.OPEN:
                AccessStr = "open";
                break;

            case RoomAccess.PASSWORD:
                AccessStr = "password";
                break;

            case RoomAccess.DOORBELL:
                AccessStr = "locked";
                break;

            case RoomAccess.INVISIBLE:
                AccessStr = "invisible";
                break;
            }

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = " +
                                  CategoryId + ", state = '" + AccessStr + "', tags = @tags, users_max = " + MaxUsers +
                                  ", allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', room_blocking_disabled = '" +
                                  RoomBlockingEnabled + "', allow_hidewall = '" + Room.Hidewall + "', floorthick = " +
                                  Room.FloorThickness + ", wallthick = " + Room.WallThickness + ", mute_settings='" + Room.WhoCanMute +
                                  "', kick_settings='" + Room.WhoCanKick + "',ban_settings='" + Room.WhoCanBan + "', `chat_mode` = '" + Room.chatMode + "', `chat_size` = '" + Room.chatSize + "', `chat_speed` = '" + Room.chatSpeed + "', `chat_extra_flood` = '" + Room.extraFlood + "', `chat_hearing_distance` = '" + Room.chatDistance + "', `trade_settings` = '" + Room.TradeSettings + "' WHERE `id` = '" + Room.RoomId + "' LIMIT 1");
                dbClient.AddParameter("caption", Room.Name);
                dbClient.AddParameter("description", Room.Description);
                dbClient.AddParameter("password", Room.Password);
                dbClient.AddParameter("tags", formattedTags.ToString());
                dbClient.RunQuery();
            }

            Room.GetGameMap().GenerateMaps();

            if (Session.GetHabbo().CurrentRoom == null)
            {
                Session.SendMessage(new RoomSettingsSavedComposer(Room.RoomId));
                Session.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId));
                Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, BiosEmuThiago.EnumToBool(Room.Hidewall.ToString())));
            }
            else
            {
                Room.SendMessage(new RoomSettingsSavedComposer(Room.RoomId));
                Room.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId));
                Room.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, BiosEmuThiago.EnumToBool(Room.Hidewall.ToString())));
            }

            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModDoorModeSeen", 1);
            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModWalkthroughSeen", 1);
            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatScrollSpeedSeen", 1);
            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatFloodFilterSeen", 1);
            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatHearRangeSeen", 1);
        }
Ejemplo n.º 9
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session?.GetHabbo() == null)
            {
                return;
            }

            var room = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(packet.PopInt());

            if (room == null || !room.CheckRights(session, true))
            {
                return;
            }

            var name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            var description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            var access      = RoomAccessUtility.ToRoomAccess(packet.PopInt());
            var password    = packet.PopString();
            var maxUsers    = packet.PopInt();
            var categoryId  = packet.PopInt();
            var tagCount    = packet.PopInt();

            var tags          = new List <string>();
            var formattedTags = new StringBuilder();

            for (var i = 0; i < tagCount; i++)
            {
                if (i > 0)
                {
                    formattedTags.Append(",");
                }

                var tag = packet.PopString().ToLower();

                tags.Add(tag);
                formattedTags.Append(tag);
            }

            var tradeSettings       = packet.PopInt(); //2 = All can trade, 1 = owner only, 0 = no trading.
            var allowPets           = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var allowPetsEat        = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var roomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var hidewall            = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var wallThickness       = packet.PopInt();
            var floorThickness      = packet.PopInt();
            var whoMute             = packet.PopInt(); // mute
            var whoKick             = packet.PopInt(); // kick
            var whoBan = packet.PopInt();              // ban

            var chatMode     = packet.PopInt();
            var chatSize     = packet.PopInt();
            var chatSpeed    = packet.PopInt();
            var chatDistance = packet.PopInt();
            var extraFlood   = packet.PopInt();

            if (chatMode < 0 || chatMode > 1)
            {
                chatMode = 0;
            }

            if (chatSize < 0 || chatSize > 2)
            {
                chatSize = 0;
            }

            if (chatSpeed < 0 || chatSpeed > 2)
            {
                chatSpeed = 0;
            }

            if (chatDistance < 0)
            {
                chatDistance = 1;
            }

            if (chatDistance > 99)
            {
                chatDistance = 100;
            }

            if (extraFlood < 0 || extraFlood > 2)
            {
                extraFlood = 0;
            }

            if (tradeSettings < 0 || tradeSettings > 2)
            {
                tradeSettings = 0;
            }

            if (whoMute < 0 || whoMute > 1)
            {
                whoMute = 0;
            }

            if (whoKick < 0 || whoKick > 1)
            {
                whoKick = 0;
            }

            if (whoBan < 0 || whoBan > 1)
            {
                whoBan = 0;
            }

            if (wallThickness < -2 || wallThickness > 1)
            {
                wallThickness = 0;
            }

            if (floorThickness < -2 || floorThickness > 1)
            {
                floorThickness = 0;
            }

            if (name.Length < 1)
            {
                return;
            }

            if (name.Length > 60)
            {
                name = name.Substring(0, 60);
            }

            if (access == RoomAccess.PASSWORD && password.Length == 0)
            {
                access = RoomAccess.OPEN;
            }

            if (maxUsers < 0)
            {
                maxUsers = 10;
            }

            if (maxUsers > 50)
            {
                maxUsers = 50;
            }

            SearchResultList searchResultList = null;

            if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(categoryId, out searchResultList))
            {
                categoryId = 36;
            }

            if (searchResultList.CategoryType != NavigatorCategoryType.CATEGORY || searchResultList.RequiredRank > session.GetHabbo().Rank ||
                session.GetHabbo().Id != room.OwnerId && session.GetHabbo().Rank >= searchResultList.RequiredRank)
            {
                categoryId = 36;
            }

            if (tagCount > 2)
            {
                return;
            }

            room.AllowPets           = allowPets;
            room.AllowPetsEating     = allowPetsEat;
            room.RoomBlockingEnabled = roomBlockingEnabled;
            room.Hidewall            = hidewall;

            room.RoomData.AllowPets           = allowPets;
            room.RoomData.AllowPetsEating     = allowPetsEat;
            room.RoomData.RoomBlockingEnabled = roomBlockingEnabled;
            room.RoomData.Hidewall            = hidewall;

            room.Name        = name;
            room.Access      = access;
            room.Description = description;
            room.Category    = categoryId;
            room.Password    = password;

            room.RoomData.Name        = name;
            room.RoomData.Access      = access;
            room.RoomData.Description = description;
            room.RoomData.Category    = categoryId;
            room.RoomData.Password    = password;

            room.WhoCanBan           = whoBan;
            room.WhoCanKick          = whoKick;
            room.WhoCanMute          = whoMute;
            room.RoomData.WhoCanBan  = whoBan;
            room.RoomData.WhoCanKick = whoKick;
            room.RoomData.WhoCanMute = whoMute;

            room.ClearTags();
            room.AddTagRange(tags);
            room.UsersMax = maxUsers;

            room.RoomData.Tags.Clear();
            room.RoomData.Tags.AddRange(tags);
            room.RoomData.UsersMax = maxUsers;

            room.WallThickness           = wallThickness;
            room.FloorThickness          = floorThickness;
            room.RoomData.WallThickness  = wallThickness;
            room.RoomData.FloorThickness = floorThickness;

            room.chatMode     = chatMode;
            room.chatSize     = chatSize;
            room.chatSpeed    = chatSpeed;
            room.chatDistance = chatDistance;
            room.extraFlood   = extraFlood;

            room.TradeSettings = tradeSettings;

            room.RoomData.chatMode     = chatMode;
            room.RoomData.chatSize     = chatSize;
            room.RoomData.chatSpeed    = chatSpeed;
            room.RoomData.chatDistance = chatDistance;
            room.RoomData.extraFlood   = extraFlood;

            room.RoomData.TradeSettings = tradeSettings;

            var accessStr = password.Length > 0 ? "password" : "open";

            switch (access)
            {
            default:
            case RoomAccess.OPEN:
                accessStr = "open";
                break;

            case RoomAccess.PASSWORD:
                accessStr = "password";
                break;

            case RoomAccess.DOORBELL:
                accessStr = "locked";
                break;

            case RoomAccess.INVISIBLE:
                accessStr = "invisible";
                break;
            }

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    "UPDATE `rooms` SET `caption` = @caption, `description` = @description, `password` = @password, `category` = @categoryId, `state` = @state, `tags` = @tags, `users_max` = @maxUsers, `allow_pets` = @allowPets, `allow_pets_eat` = @allowPetsEat, `room_blocking_disabled` = @roomBlockingDisabled, `allow_hidewall` = @allowHidewall, `floorthick` = @floorThick, `wallthick` = @wallThick, `mute_settings` = @muteSettings, `kick_settings` = @kickSettings, `ban_settings` = @banSettings, `chat_mode` = @chatMode, `chat_size` = @chatSize, `chat_speed` = @chatSpeed, `chat_extra_flood` = @extraFlood, `chat_hearing_distance` = @chatDistance, `trade_settings` = @tradeSettings WHERE `id` = @roomId LIMIT 1");
                dbClient.AddParameter("categoryId", categoryId);
                dbClient.AddParameter("maxUsers", maxUsers);
                dbClient.AddParameter("allowPets", allowPets);
                dbClient.AddParameter("allowPetsEat", allowPetsEat);
                dbClient.AddParameter("roomBlockingDisabled", roomBlockingEnabled);
                dbClient.AddParameter("allowHidewall", room.Hidewall);
                dbClient.AddParameter("floorThick", room.FloorThickness);
                dbClient.AddParameter("wallThick", room.WallThickness);
                dbClient.AddParameter("muteSettings", room.WhoCanMute);
                dbClient.AddParameter("kickSettings", room.WhoCanKick);
                dbClient.AddParameter("banSettings", room.WhoCanBan);
                dbClient.AddParameter("chatMode", room.chatMode);
                dbClient.AddParameter("chatSize", room.chatSize);
                dbClient.AddParameter("chatSpeed", room.chatSpeed);
                dbClient.AddParameter("extraFlood", room.extraFlood);
                dbClient.AddParameter("chatDistance", room.chatDistance);
                dbClient.AddParameter("tradeSettings", room.TradeSettings);
                dbClient.AddParameter("roomId", room.Id);
                dbClient.AddParameter("caption", room.Name);
                dbClient.AddParameter("description", room.Description);
                dbClient.AddParameter("password", room.Password);
                dbClient.AddParameter("state", accessStr);
                dbClient.AddParameter("tags", formattedTags.ToString());
                dbClient.RunQuery();
            }

            room.GetGameMap().GenerateMaps();

            if (session.GetHabbo().CurrentRoom == null)
            {
                session.SendPacket(new RoomSettingsSavedComposer(room.RoomId));
                session.SendPacket(new RoomInfoUpdatedComposer(room.RoomId));
                session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));
            }
            else
            {
                room.SendPacket(new RoomSettingsSavedComposer(room.RoomId));
                room.SendPacket(new RoomInfoUpdatedComposer(room.RoomId));
                room.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));
            }

            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModDoorModeSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModWalkthroughSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatScrollSpeedSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatFloodFilterSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatHearRangeSeen", 1);
        }
Ejemplo n.º 10
0
 public static void RefreshSearchResultList(SearchParam param)
 {
     SearchResultList?.StopLoading();
     SearchResultList = new SearchResultIllustsCollection(param.Word, param.SearchTarget, param.Sort, param.Duration);
 }
Ejemplo n.º 11
0
    public void LoadData()
    {
        if (RadTextBox1.Text != "")
        {
            string name            = RadTextBox1.Text;
            string GetSearchResult = @"SELECT     [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, 
                      [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image
FROM         [User] INNER JOIN
                      Propic ON [User].ID = Propic.UID
WHERE     ([User].Name LIKE '" + name + "%') AND (Propic.[Current] = 1)";
            dt = dbClass.ReturnDT(GetSearchResult);
            if (dt.Rows.Count > 0)
            {
                SearchResultList.DataSource = dt;
                SearchResultList.DataBind();
                SearchResultList.Visible = true;
                error0.Visible           = false;
            }
            else if (dt.Rows.Count == 0)
            {
                SearchResultList.Visible = false;
                error0.Visible           = true;
            }
        }
        if (RadTextBox2.Text != "")
        {
            string name            = RadTextBox1.Text;
            string GetSearchResult = @"SELECT     [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, 
                      [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image
FROM         [User] INNER JOIN
                      Propic ON [User].ID = Propic.UID
WHERE     ([User].Name LIKE '" + name + "') AND (Propic.[Current] = 1) AND Country like '" + RadTextBox2.Text + "'";
            dt = dbClass.ReturnDT(GetSearchResult);
            if (dt.Rows.Count > 0)
            {
                SearchResultList.DataSource = dt;
                SearchResultList.DataBind();
                SearchResultList.Visible = true;
                error0.Visible           = false;
            }
            else if (dt.Rows.Count == 0)
            {
                error0.Visible = true;
            }
        }
        if (RadTextBox3.Text != "")
        {
            string name            = RadTextBox1.Text;
            string GetSearchResult = @"SELECT     [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, 
                      [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image
FROM         [User] INNER JOIN
                      Propic ON [User].ID = Propic.UID
WHERE     ([User].Name LIKE '" + name + "') AND (Propic.[Current] = 1) AND Country like '" + RadTextBox2.Text + "%' AND Company like'" + RadTextBox3.Text + "%'";
            dt = dbClass.ReturnDT(GetSearchResult);
            if (dt.Rows.Count > 0)
            {
                SearchResultList.DataSource = dt;
                SearchResultList.DataBind();
                SearchResultList.Visible = true;
            }
            else if (dt.Rows.Count == 0)
            {
                error0.Visible = true;
            }
        }
        if (RadTextBox4.Text != "")
        {
            string name            = RadTextBox1.Text;
            string GetSearchResult = @"SELECT     [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, 
                      [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image
FROM         [User] INNER JOIN
                      Propic ON [User].ID = Propic.UID
WHERE     ([User].Name LIKE '" + name + "') AND (Propic.[Current] = 1) AND Country like '" + RadTextBox2.Text + "%' AND Company like '" + RadTextBox3.Text + "%' AND School like '" + RadTextBox4.Text + "%'";
            dt = dbClass.ReturnDT(GetSearchResult);
            if (dt.Rows.Count > 0)
            {
                SearchResultList.DataSource = dt;
                SearchResultList.DataBind();
                SearchResultList.Visible = true;
                error0.Visible           = false;
            }
            else if (dt.Rows.Count == 0)
            {
                error0.Visible = true;
            }
        }

        if (SearchResultList.Visible == true)
        {
            error0.Visible = false;
            error.Visible  = false;
        }
    }
Ejemplo n.º 12
0
 private void CloseSearch()
 {
     IsSearchAccountOpen = false;
     SearchResultList.Clear();
 }
Ejemplo n.º 13
0
 private void SelectOlderThanOneYearButton_Click(object sender, EventArgs e)
 {
     SearchResultList.UncheckAll();
     SearchResultList.CheckWhere(item => item.DateModified < DateTime.Now - TimeSpan.FromDays(365));
 }
Ejemplo n.º 14
0
        public ItemFPSearchViewModel()
        {
            Client.AccWithConfigAndSizeCompleted += (s, sv) =>
            {
                bool isSearchItem    = false;
                var  itemSearchModel = SearchResultList.FirstOrDefault(i => i.ItemId == sv.Result.Iserial && i.ItemType == sv.Result.ItemGroup);
                CRUDManagerService.ItemsDto item;
                if (itemSearchModel != null)
                {
                    item         = itemSearchModel.ItemPerRow ?? (itemSearchModel.ItemPerRow = new CRUDManagerService.ItemsDto());
                    isSearchItem = true;
                }
                else
                {
                    item = ItemPerRow;
                }

                item.AccConfigList   = sv.Result.AccConfigList;
                item.SizesList       = new ObservableCollection <string>();
                item.CombinationList = sv.Result.CombinationList;

                var tblAccessoryAttributesDetails = sv.Result.CombinationList.FirstOrDefault();
                if (tblAccessoryAttributesDetails != null)
                {
                    item.SizesList.Add(tblAccessoryAttributesDetails.Size);
                }
                if (item.CombinationList != null)
                {
                    item.SizesList = new ObservableCollection <string>();
                }
                if (isSearchItem)
                {
                    if (item.AccConfigList == null)
                    {
                        item.AccConfigList = new ObservableCollection <CRUDManagerService.TblColor>();
                    }
                    itemSearchModel.ColorPerRow = item.AccConfigList.FirstOrDefault(c => c.Iserial == itemSearchModel.ColorToId);
                }
            };
            CancelCommand = new RelayCommand((o) => // هقفل وارجع فولس يعرف انه كنسل
            {
                var view = (o as ChildWindowsOverride);
                if (view != null)
                {
                    view.DialogResult = false;
                    view.Close();
                }
            });
            ApplyCommand = new RelayCommand((o) =>
            {
                var view = (o as ItemFPSearchChildWindow);
                if (view != null)
                {
                    //هنا هاخد الى مختاره فى الجريد للشاشة الاصلية
                    ApplySelectedItem(view);
                }
            });
            OkCommand = new RelayCommand((o) =>
            {
                var view = (o as ItemFPSearchChildWindow);
                if (view != null)
                {
                    //هنا هاخد الى مختاره فى الجريد للشاشة الاصلية لو مكانش راح
                    //وهقفل الشاشة فى الاخر
                    try
                    {
                        var item = view.DataContext as ItemFPSearchViewModel;
                        ItemDimensionFPSearchViewModel newSearchData = new ItemDimensionFPSearchViewModel();
                        newSearchData.ItemPerRow  = item.ItemPerRow;
                        newSearchData.ColorPerRow = item.ColorPerRow;
                        item.FPAppliedSearchResultList.Add(newSearchData);
                        view.DialogResult = true;
                        view.Close();
                    } catch { }
                }
            });
            LoadingRow = new GalaSoft.MvvmLight.Command.RelayCommand <object>((o) =>
            {
                //var e = o as System.Windows.Controls.DataGridRowEventArgs;
                //if (SearchResultList.Count < PageSize)
                //{
                //    return;
                //}
                //if (SearchResultList.Count - 2 < e.Row.GetIndex() && !Loading)
                //{
                //    GetInspectionWarehouseRows();
                //}
            });
        }
Ejemplo n.º 15
0
        public SearchResultList Search(SearchQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            List <NpgsqlParameter> parameters = new List <NpgsqlParameter>();

            string sql = @"SELECT id,url,snippet,timestamp, COUNT(*) OVER() AS ___total_count___ FROM system_search ";

            if (query.ResultType == SearchResultType.Full)
            {
                sql = @"SELECT *,  COUNT(*) OVER() AS ___total_count___ FROM system_search ";
            }

            string textQuerySql = string.Empty;

            if (!string.IsNullOrWhiteSpace(query.Text))
            {
                if (query.SearchType == SearchType.Contains)
                {
                    var words = query.Text.ToLowerInvariant().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Distinct().ToArray();
                    foreach (var word in words)
                    {
                        string          parameterName = "@par_" + Guid.NewGuid().ToString().Replace("-", "");
                        NpgsqlParameter parameter     = new NpgsqlParameter(parameterName, $"%{word}%");
                        parameters.Add(parameter);
                        textQuerySql = textQuerySql + $"OR content ILIKE {parameterName} ";
                    }
                    if (textQuerySql.StartsWith("OR"))
                    {
                        textQuerySql = textQuerySql.Substring(2);                   //remove initial OR
                        textQuerySql = $"({textQuerySql})";                         //add brackets
                    }
                }
                else if (query.SearchType == SearchType.Fts)
                {
                    string parameterName = "@par_" + Guid.NewGuid().ToString().Replace("-", "");
                    string analizedText  = ftsAnalyzer.ProcessText(query.Text.ToLowerInvariant());
                    bool   singleWord    = analizedText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Count() == 1;
                    if (singleWord)
                    {
                        //search for all lexemes starting with this word
                        parameters.Add(new NpgsqlParameter(parameterName, analizedText + ":*"));
                        textQuerySql = textQuerySql + " to_tsvector( 'simple', stem_content ) @@ to_tsquery( 'simple', " + parameterName + ") ";
                    }
                    else
                    {
                        parameters.Add(new NpgsqlParameter(parameterName, analizedText));
                        textQuerySql = textQuerySql + " to_tsvector( 'simple', stem_content) @@ plainto_tsquery( 'simple', " + parameterName + ") ";
                    }
                }
            }

            string entityQuerySql = string.Empty;

            if (query.Entities.Any())
            {
                foreach (var id in query.Entities)
                {
                    string          parameterName = "@par_" + Guid.NewGuid().ToString().Replace("-", "");
                    NpgsqlParameter parameter     = new NpgsqlParameter(parameterName, $"%{id}%");
                    parameters.Add(parameter);
                    entityQuerySql = entityQuerySql + $"OR entities ILIKE {parameterName} ";
                }
                if (entityQuerySql.StartsWith("OR"))
                {
                    entityQuerySql = entityQuerySql.Substring(2);               //remove initial OR
                    entityQuerySql = $"({entityQuerySql})";                     //add brackets
                }
            }

            string appsQuerySql = string.Empty;

            if (query.Apps.Any())
            {
                foreach (var id in query.Apps)
                {
                    string          parameterName = "@par_" + Guid.NewGuid().ToString().Replace("-", "");
                    NpgsqlParameter parameter     = new NpgsqlParameter(parameterName, $"%{id}%");
                    parameters.Add(parameter);
                    appsQuerySql = appsQuerySql + $"OR entities ILIKE {parameterName} ";
                }
                if (appsQuerySql.StartsWith("OR"))
                {
                    appsQuerySql = entityQuerySql.Substring(2);             //remove initial OR
                    appsQuerySql = $"({appsQuerySql})";                     //add brackets
                }
            }

            string recordsQuerySql = string.Empty;

            if (query.Records.Any())
            {
                foreach (var id in query.Records)
                {
                    string          parameterName = "@par_" + Guid.NewGuid().ToString().Replace("-", "");
                    NpgsqlParameter parameter     = new NpgsqlParameter(parameterName, $"%{id}%");
                    parameters.Add(parameter);
                    recordsQuerySql = recordsQuerySql + $"OR entities ILIKE {parameterName} ";
                }
                if (recordsQuerySql.StartsWith("OR"))
                {
                    recordsQuerySql = entityQuerySql.Substring(2);                //remove initial OR
                    recordsQuerySql = $"({recordsQuerySql})";                     //add brackets
                }
            }

            string whereSql = string.Empty;

            if (!string.IsNullOrWhiteSpace(textQuerySql))
            {
                whereSql = $"WHERE {textQuerySql} ";
            }

            if (!string.IsNullOrWhiteSpace(entityQuerySql))
            {
                if (whereSql == string.Empty)
                {
                    whereSql = $"WHERE {entityQuerySql} ";
                }
                else
                {
                    whereSql = $"AND {entityQuerySql} ";
                }
            }
            if (!string.IsNullOrWhiteSpace(appsQuerySql))
            {
                if (whereSql == string.Empty)
                {
                    whereSql = $"WHERE {appsQuerySql} ";
                }
                else
                {
                    whereSql = $"AND {appsQuerySql} ";
                }
            }
            if (!string.IsNullOrWhiteSpace(recordsQuerySql))
            {
                if (whereSql == string.Empty)
                {
                    whereSql = $"WHERE {recordsQuerySql} ";
                }
                else
                {
                    whereSql = $"AND {recordsQuerySql} ";
                }
            }

            sql = sql + whereSql;

            if (query.SearchType != SearchType.Fts)
            {
                sql = sql + " ORDER BY timestamp DESC ";
            }

            string pagingSql = string.Empty;

            if (query.Limit != null || query.Skip != null)
            {
                pagingSql = "LIMIT ";
                if (query.Limit.HasValue && query.Limit != 0)
                {
                    pagingSql = pagingSql + query.Limit + " ";
                }
                else
                {
                    pagingSql = pagingSql + "ALL ";
                }

                if (query.Skip.HasValue)
                {
                    pagingSql = pagingSql + " OFFSET " + query.Skip;
                }

                sql = sql + pagingSql;
            }

            DataTable dt = new DataTable();

            using (var connection = DbContext.Current.CreateConnection())
            {
                var command = connection.CreateCommand(sql, parameters: parameters);
                command.CommandTimeout = 60;
                new NpgsqlDataAdapter(command).Fill(dt);

                SearchResultList resultList = new SearchResultList();
                foreach (DataRow dr in dt.Rows)
                {
                    resultList.Add(dr.MapTo <SearchResult>());
                    if (resultList.TotalCount == 0)
                    {
                        resultList.TotalCount = (int)((long)dr["___total_count___"]);
                    }
                }

                return(resultList);
            }
        }
Ejemplo n.º 16
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null)
            {
                return;
            }

            List <RoomData> rooms = RoomFactory.GetRoomsDataByOwnerSortByName(session.GetHabbo().Id);

            if (rooms.Count >= 500)
            {
                session.SendPacket(new CanCreateRoomComposer(true, 500));
                return;
            }

            string Name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            string Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            string ModelName   = packet.PopString();

            int Category      = packet.PopInt();
            int MaxVisitors   = packet.PopInt(); //10 = min, 25 = max.
            int TradeSettings = packet.PopInt(); //2 = All can trade, 1 = owner only, 0 = no trading.

            if (Name.Length < 3)
            {
                return;
            }

            if (Name.Length > 25)
            {
                return;
            }

            RoomModel model = null;

            if (!PlusEnvironment.GetGame().GetRoomManager().TryGetModel(ModelName, out model))
            {
                return;
            }

            SearchResultList SearchResultList = null;

            if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(Category, out SearchResultList))
            {
                Category = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.Category || SearchResultList.RequiredRank > session.GetHabbo().Rank)
            {
                Category = 36;
            }

            if (MaxVisitors < 10 || MaxVisitors > 25)
            {
                MaxVisitors = 10;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            RoomData NewRoom = PlusEnvironment.GetGame().GetRoomManager().CreateRoom(session, Name, Description, Category, MaxVisitors, TradeSettings, model);

            if (NewRoom != null)
            {
                session.SendPacket(new FlatCreatedComposer(NewRoom.Id, Name));
            }

            if (session.GetHabbo() != null && session.GetHabbo().GetMessenger() != null)
            {
                session.GetHabbo().GetMessenger().OnStatusChanged(true);
            }
        }
        public void TestCaseSensitive()
        {
            SearchResultList <String> results = _stringMatcher.Search("cat", 100.0f);

            Assert.IsTrue(results.ContainsKeyword("Cat"));
        }
Ejemplo n.º 18
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null)
            {
                return;
            }

            int roomId = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetRoomManager().TryLoadRoom(roomId, out Room room))
            {
                return;
            }

            string     Name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            string     Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            RoomAccess Access      = RoomAccessUtility.ToRoomAccess(packet.PopInt());
            string     Password    = packet.PopString();
            int        MaxUsers    = packet.PopInt();
            int        CategoryId  = packet.PopInt();
            int        TagCount    = packet.PopInt();

            List <string> Tags          = new List <string>();
            StringBuilder formattedTags = new StringBuilder();

            for (int i = 0; i < TagCount; i++)
            {
                if (i > 0)
                {
                    formattedTags.Append(",");
                }

                string tag = packet.PopString().ToLower();

                Tags.Add(tag);
                formattedTags.Append(tag);
            }

            int TradeSettings       = packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading.
            int AllowPets           = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int AllowPetsEat        = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int RoomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int Hidewall            = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int WallThickness       = packet.PopInt();
            int FloorThickness      = packet.PopInt();
            int WhoMute             = packet.PopInt(); // mute
            int WhoKick             = packet.PopInt(); // kick
            int WhoBan = packet.PopInt();              // ban

            int chatMode     = packet.PopInt();
            int chatSize     = packet.PopInt();
            int chatSpeed    = packet.PopInt();
            int chatDistance = packet.PopInt();
            int extraFlood   = packet.PopInt();

            if (chatMode < 0 || chatMode > 1)
            {
                chatMode = 0;
            }

            if (chatSize < 0 || chatSize > 2)
            {
                chatSize = 0;
            }

            if (chatSpeed < 0 || chatSpeed > 2)
            {
                chatSpeed = 0;
            }

            if (chatDistance < 0)
            {
                chatDistance = 1;
            }

            if (chatDistance > 99)
            {
                chatDistance = 100;
            }

            if (extraFlood < 0 || extraFlood > 2)
            {
                extraFlood = 0;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            if (WhoMute < 0 || WhoMute > 1)
            {
                WhoMute = 0;
            }

            if (WhoKick < 0 || WhoKick > 1)
            {
                WhoKick = 0;
            }

            if (WhoBan < 0 || WhoBan > 1)
            {
                WhoBan = 0;
            }

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (Name.Length < 1)
            {
                return;
            }

            if (Name.Length > 60)
            {
                Name = Name.Substring(0, 60);
            }

            if (Access == RoomAccess.Password && Password.Length == 0)
            {
                Access = RoomAccess.Open;
            }

            if (MaxUsers < 0)
            {
                MaxUsers = 10;
            }

            if (MaxUsers > 50)
            {
                MaxUsers = 50;
            }

            SearchResultList SearchResultList = null;

            if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList))
            {
                CategoryId = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.Category || SearchResultList.RequiredRank > session.GetHabbo().Rank || (session.GetHabbo().Id != room.OwnerId && session.GetHabbo().Rank >= SearchResultList.RequiredRank))
            {
                CategoryId = 36;
            }

            if (TagCount > 2)
            {
                return;
            }

            room.AllowPets           = AllowPets;
            room.AllowPetsEating     = AllowPetsEat;
            room.RoomBlockingEnabled = RoomBlockingEnabled;
            room.Hidewall            = Hidewall;

            room.Name        = Name;
            room.Access      = Access;
            room.Description = Description;
            room.Category    = CategoryId;
            room.Password    = Password;

            room.WhoCanBan  = WhoBan;
            room.WhoCanKick = WhoKick;
            room.WhoCanMute = WhoMute;

            room.ClearTags();
            room.AddTagRange(Tags);
            room.UsersMax = MaxUsers;

            room.WallThickness  = WallThickness;
            room.FloorThickness = FloorThickness;

            room.ChatMode     = chatMode;
            room.ChatSize     = chatSize;
            room.ChatSpeed    = chatSpeed;
            room.ChatDistance = chatDistance;
            room.ExtraFlood   = extraFlood;

            room.TradeSettings = TradeSettings;

            string AccessStr = Password.Length > 0 ? "password" : "open";

            switch (Access)
            {
            default:
            case RoomAccess.Open:
                AccessStr = "open";
                break;

            case RoomAccess.Password:
                AccessStr = "password";
                break;

            case RoomAccess.Doorbell:
                AccessStr = "locked";
                break;

            case RoomAccess.Invisible:
                AccessStr = "invisible";
                break;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `rooms` SET `caption` = @caption, `description` = @description, `password` = @password, `category` = @categoryId, `state` = @state, `tags` = @tags, `users_max` = @maxUsers, `allow_pets` = @allowPets, `allow_pets_eat` = @allowPetsEat, `room_blocking_disabled` = @roomBlockingDisabled, `allow_hidewall` = @allowHidewall, `floorthick` = @floorThick, `wallthick` = @wallThick, `mute_settings` = @muteSettings, `kick_settings` = @kickSettings, `ban_settings` = @banSettings, `chat_mode` = @chatMode, `chat_size` = @chatSize, `chat_speed` = @chatSpeed, `chat_extra_flood` = @extraFlood, `chat_hearing_distance` = @chatDistance, `trade_settings` = @tradeSettings WHERE `id` = @roomId LIMIT 1");
                dbClient.AddParameter("categoryId", CategoryId);
                dbClient.AddParameter("maxUsers", MaxUsers);
                dbClient.AddParameter("allowPets", AllowPets);
                dbClient.AddParameter("allowPetsEat", AllowPetsEat);
                dbClient.AddParameter("roomBlockingDisabled", RoomBlockingEnabled);
                dbClient.AddParameter("allowHidewall", room.Hidewall);
                dbClient.AddParameter("floorThick", room.FloorThickness);
                dbClient.AddParameter("wallThick", room.WallThickness);
                dbClient.AddParameter("muteSettings", room.WhoCanMute);
                dbClient.AddParameter("kickSettings", room.WhoCanKick);
                dbClient.AddParameter("banSettings", room.WhoCanBan);
                dbClient.AddParameter("chatMode", room.ChatMode);
                dbClient.AddParameter("chatSize", room.ChatSize);
                dbClient.AddParameter("chatSpeed", room.ChatSpeed);
                dbClient.AddParameter("extraFlood", room.ExtraFlood);
                dbClient.AddParameter("chatDistance", room.ChatDistance);
                dbClient.AddParameter("tradeSettings", room.TradeSettings);
                dbClient.AddParameter("roomId", room.Id);
                dbClient.AddParameter("caption", room.Name);
                dbClient.AddParameter("description", room.Description);
                dbClient.AddParameter("password", room.Password);
                dbClient.AddParameter("state", AccessStr);
                dbClient.AddParameter("tags", formattedTags.ToString());
                dbClient.RunQuery();
            }

            room.GetGameMap().GenerateMaps();

            if (session.GetHabbo().CurrentRoom == null)
            {
                session.SendPacket(new RoomSettingsSavedComposer(room.RoomId));
                session.SendPacket(new RoomInfoUpdatedComposer(room.RoomId));
                session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));
            }
            else
            {
                room.SendPacket(new RoomSettingsSavedComposer(room.RoomId));
                room.SendPacket(new RoomInfoUpdatedComposer(room.RoomId));
                room.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));
            }

            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModDoorModeSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModWalkthroughSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatScrollSpeedSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatFloodFilterSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatHearRangeSeen", 1);
        }
        public void TestMultipleWords()
        {
            SearchResultList <String> results = _stringMatcher.Search("This is a vest", 90.0f);

            Assert.IsTrue(results.ContainsKeyword("This is a test"));
        }
Ejemplo n.º 20
0
        public ItemDimensionSearchViewModel()
        {
            Client.AccWithConfigAndSizeCompleted += (s, sv) =>
            {
                bool isSearchItem    = false;
                var  itemSearchModel = SearchResultList.FirstOrDefault(i => i.ItemId == sv.Result.Iserial && i.ItemType == sv.Result.ItemGroup);
                CRUDManagerService.ItemsDto item;
                if (itemSearchModel != null)
                {
                    item         = itemSearchModel.ItemPerRow ?? (itemSearchModel.ItemPerRow = new CRUDManagerService.ItemsDto());
                    isSearchItem = true;
                }
                else
                {
                    item = ItemPerRow;
                }

                item.AccConfigList   = sv.Result.AccConfigList;
                item.SizesList       = new ObservableCollection <string>();
                item.CombinationList = sv.Result.CombinationList;

                var tblAccessoryAttributesDetails = sv.Result.CombinationList.FirstOrDefault();
                if (tblAccessoryAttributesDetails != null)
                {
                    item.SizesList.Add(tblAccessoryAttributesDetails.Size);
                }
                if (item.CombinationList != null)
                {
                    item.SizesList = new ObservableCollection <string>();
                }
                if (isSearchItem)
                {
                    if (item.AccConfigList == null)
                    {
                        item.AccConfigList = new ObservableCollection <CRUDManagerService.TblColor>();
                    }
                    itemSearchModel.ColorPerRow = item.AccConfigList.FirstOrDefault(c => c.Iserial == itemSearchModel.ColorToId);
                }
            };
            Client.InspectionRouteCompleted += (o, e) =>
            {
                foreach (var batchNo in e.Result.Select(x => x.RollBatch))
                {
                    if (!BatchNoList.Contains(batchNo))
                    {
                        BatchNoList.Add(batchNo);
                    }
                }
            };
            // Client.SearchF
            WarehouseClient.GetAccWarehouseRowsCompleted += (s, e) =>
            {
                if (e.Result.Count <= 0)
                {
                    MessageBox.Show(strings.NoDataFound);
                }
                foreach (var iR in e.Result)
                {
                    // هشوف لو موجود مش هحطه
                    if (!SearchResultList.Any(sr => sr.ItemDimFromIserial == iR.ItemDimFromIserial))
                    {
                        var qtemp = iR.AvailableQuantity;
                        iR.AvailableQuantity = 0;
                        // iR.CountedQuantity = 0;
                        iR.AvailableQuantity = qtemp;
                        if (iR.PendingQuantity > 0)
                        {
                            iR.TransferredQuantity = iR.AvailableQuantity;
                        }
                        else
                        {
                            iR.TransferredQuantity = iR.AvailableQuantity + iR.PendingQuantity;
                        }
                        ItemDimensionSearchModel item = new ItemDimensionSearchModel();
                        item.InjectFrom(iR);
                        if (item.ItemPerRow == null)
                        {
                            item.ItemPerRow = new CRUDManagerService.ItemsDto();
                        }
                        if (ItemPerRow.Iserial > 0)
                        {
                            item.ItemPerRow.InjectFrom(ItemPerRow);
                        }
                        //else
                        //    Client.AccWithConfigAndSizeAsync(new CRUDManagerService.ItemsDto()
                        //    {
                        //        Iserial = item.ItemId,
                        //        ItemGroup = item.ItemType,
                        //        Code=item.ItemCode,
                        //    });
                        if (item.ItemPerRow.AccConfigList == null)
                        {
                            item.ItemPerRow.AccConfigList = new ObservableCollection <CRUDManagerService.TblColor>();
                        }
                        var colorRow = item.ItemPerRow.AccConfigList.FirstOrDefault(c => c.Iserial == iR.ColorPerRow.Iserial);
                        if (colorRow == null)
                        {
                            colorRow = new CRUDManagerService.TblColor()
                            {
                                Iserial = item.ColorFromId,
                                Code    = item.ColorFromCode
                            };
                        }
                        item.ColorPerRow = colorRow;

                        SearchResultList.Add(item);
                    }
                }
                Loading = false;
            };
            WarehouseClient.GetItemDimensionsOrCreteForTransferCompleted += (s, e) =>
            {
                SelectedSearchResultList.Clear();
                foreach (var item in e.Result)
                {
                    ItemDimensionSearchModel temp = new ItemDimensionSearchModel();
                    temp.InjectFrom(item);
                    temp.ItemPerRow = ItemPerRow;
                    temp.ColorPerRow.InjectFrom(item.ColorPerRow);
                    SelectedSearchResultList.Add(temp);
                }
                IsWorking = false;
            };
            CancelCommand = new RelayCommand((o) => // هقفل وارجع فولس يعرف انه كنسل
            {
                var view = (o as ChildWindowsOverride);
                if (view != null)
                {
                    view.DialogResult = false;
                    view.Close();
                }
            });
            ApplyCommand = new RelayCommand((o) =>
            {
                var view = (o as ItemDimensionSearchChildWindow);
                if (view != null)
                {
                    //هنا هاخد الى مختاره فى الجريد للشاشة الاصلية
                    ApplySelectedItem(view);
                }
            });
            OkCommand = new RelayCommand((o) =>
            {
                var view = (o as ItemDimensionSearchChildWindow);
                if (view != null)
                {
                    //هنا هاخد الى مختاره فى الجريد للشاشة الاصلية لو مكانش راح
                    //وهقفل الشاشة فى الاخر
                    ApplySelectedItem(view);
                    view.DialogResult = true;
                    view.Close();
                }
            });
            LoadingRow = new GalaSoft.MvvmLight.Command.RelayCommand <object>((o) =>
            {
                var e = o as System.Windows.Controls.DataGridRowEventArgs;
                if (SearchResultList.Count < PageSize)
                {
                    return;
                }
                if (SearchResultList.Count - 2 < e.Row.GetIndex() && !Loading)
                {
                    GetInspectionWarehouseRows();
                }
            });
            DetailSelectionChanged = new GalaSoft.MvvmLight.Command.RelayCommand <object>(
                (o) => {
                var e    = o as System.Windows.Controls.SelectionChangedEventArgs;
                var temp = new Web.DataLayer.ItemDimensionSearchModel();
                if (e.AddedItems != null && e.AddedItems.Count > 0)
                {
                    temp.InjectFrom(e.AddedItems[0]);
                    WarehouseClient.GetItemToQuantitiesAsync(temp, WarehouseToCode);
                }
            });
            WarehouseClient.GetItemToQuantitiesCompleted += (s, e) =>
            {
                var item = SearchResultList.FirstOrDefault(rl =>
                                                           rl.ItemId == e.Result.ItemId && rl.ItemType == e.Result.ItemType &&
                                                           rl.ItemDimFromIserial == e.Result.ItemDimFromIserial &&
                                                           rl.ColorFromId == e.Result.ColorFromId &&
                                                           rl.SizeFrom == e.Result.SizeFrom && rl.BatchNoFrom == e.Result.BatchNoFrom &&
                                                           rl.ColorToId == e.Result.ColorToId && rl.SizeTo == e.Result.SizeTo &&
                                                           rl.BatchNoTo == e.Result.BatchNoTo);
                if (item != null)
                {
                    item.ItemDimToIserial    = e.Result.ItemDimToIserial;
                    item.AvailableToQuantity = e.Result.AvailableToQuantity;
                    item.PendingToQuantity   = e.Result.PendingToQuantity;
                }
                else
                {
                    //item.AvailableToQuantity = 0;
                    //item.PendingToQuantity = 0;
                }
            };

            WarehouseClient.GetItemGroupCompleted += (s, e) =>
            {
                foreach (var item in e.Result)
                {
                    ItemTypes.Add(item);
                }
            };
            WarehouseClient.GetItemGroupAsync();
        }
Ejemplo n.º 21
0
 private void SelectAllFilesButton_Click(object sender, EventArgs e)
 {
     SearchResultList.CheckAll();
 }