public IHttpActionResult RetrieveSanctionsTypes()
        {
            try
            {
                var Mngr = new SanctionManager();
                ApiResp.Data = Mngr.RetrieveSanctionsTypes();

                return(Ok(ApiResp));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)));
            }
        }
        public IHttpActionResult RetrieveSanctionsByDateAndCompany(DateTime beginDate, DateTime endDate, int idCompany)
        {
            try
            {
                var Mngr = new SanctionManager();
                ApiResp.Data = Mngr.RetrieveSanctionsByDateRangeAndCompany(beginDate, endDate, idCompany);


                return(Ok(ApiResp));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)));
            }
        }
        public IHttpActionResult DeleteSanctionType(SanctionType type)
        {
            try
            {
                var Mngr = new SanctionManager();
                Mngr.DeleteSanctionType(type);

                ApiResp = new ApiResponse
                {
                    Message = "Tipo eliminado exitosamente"
                };

                return(Ok(ApiResp));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)));
            }
        }
        public IHttpActionResult Post(Sanction sanction)
        {
            try
            {
                var Mngr = new SanctionManager();
                Mngr.Create(sanction);

                ApiResponse ApiResp = new ApiResponse
                {
                    Message = "Sanción registrada exitosamente"
                };

                return(Ok(ApiResp));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)));
            }
        }
示例#5
0
        internal void Init(UserData data)
        {
            this.PresentBuyStopwatch = new Stopwatch();
            this.PresentBuyStopwatch.Start();

            this.FavoriteRooms      = data.favouritedRooms;
            this.InventoryComponent = new InventoryComponent(Id, mClient);
            this.InventoryComponent.SetActiveState(mClient);
            this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, mClient, data);
            this.chatMessageManager  = new ChatMessageManager();
            this.premiumManager      = PremiumManager.LoadPremiumData(Id);
            this.userclothingManager = new UserClothing(Id);
            clubManager     = new ClubManager(Id, data);
            sanctionManager = new SanctionManager(Id, data);

            if (HasFuse("fuse_chat_staff"))
            {
                data.friends.Add(EmuSettings.CHAT_USER_ID, StaffChat.MessengerStaff);
            }

            this.Messenger = new HabboMessenger(Id, data.friends, data.requests);
            this.UpdateRooms();
        }
示例#6
0
        internal void OnDisconnect()
        {
            try
            {
                if (Disconnected)
                {
                    return;
                }

                Disconnected = true;

                if (Messenger != null)
                {
                    Messenger.AppearOffline = true;
                    Messenger.Destroy();
                    Messenger = null;
                }

                if (IsPremium())
                {
                    GetPremiumManager().Destroy();
                }

                saveWardrobe();
                SaveBadges();
                //HabboEnvironment.GetGame().GetMuteManager().RemoveUserMute(Id);

                var pollParticipation = "";
                if (this.PollParticipation.Count > 0)
                {
                    foreach (UInt32 value in this.PollParticipation)
                    {
                        pollParticipation += value + ";";
                    }
                    pollParticipation = pollParticipation.Remove(pollParticipation.Length - 1);
                }

                var votedRooms = "";
                if (this.RatedRooms.Count > 0)
                {
                    foreach (UInt32 value in this.RatedRooms)
                    {
                        votedRooms += value + ";";
                    }
                    votedRooms = votedRooms.Remove(votedRooms.Length - 1);
                }

                var actrewards = "";
                if (this.WiredRewards.Count > 0)
                {
                    foreach (WiredActReward wrd in this.WiredRewards.Values)
                    {
                        actrewards += wrd.ItemId + "," + wrd.LastUpdate + "," + wrd.ActualRewards + "," + wrd.OriginalInt + ";";
                    }
                    actrewards = actrewards.Remove(actrewards.Length - 1);
                }

                var navilogs = "";
                if (this.navigatorLogs.Count > 0)
                {
                    foreach (NaviLogs navi in this.navigatorLogs.Values)
                    {
                        navilogs += navi.Id + "," + navi.Value1 + "," + navi.Value2 + ";";
                    }
                    navilogs = navilogs.Remove(navilogs.Length - 1);
                }

                var targetedoffers = "";
                if (this.TargetedOffers.Count > 0)
                {
                    foreach (KeyValuePair <uint, uint> k in this.TargetedOffers)
                    {
                        targetedoffers += k.Key + "-" + k.Value + ";";
                    }
                    targetedoffers = targetedoffers.Remove(targetedoffers.Length - 1);
                }

                using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("UPDATE users SET namechanges = '" + NameChanges + "', respect = '" + Respect +
                                      "', daily_respect_points = '" + DailyRespectPoints +
                                      "', daily_pet_respect_points = '" + DailyPetRespectPoints + "'," +
                                      " diamonds = '" + Diamonds + "',  machine_last = @machineLast, currentquestid = '" + CurrentQuestId +
                                      "', block_trade = '" + ((BlockTrade) ? "1" : "0") + "'," +
                                      " block_newfriends = '" + ((HasFriendRequestsDisabled) ? "1" : "0") +
                                      "', look = @look, motto = @motto, gender = @gender, last_online = '" + LastOnline.ToString() + "'," +
                                      " achievement_points = '" + AchievementPoints + "', home_room = '" + HomeRoom + "', volumenSystem = '" +
                                      volumenSystem + "', prefer_old_chat = '" + ((preferOldChat) ? "1" : "0") + "'," +
                                      " last_purchase = '" + LastPurchase + "'," +
                                      " poll_participation = '" + pollParticipation + "', voted_rooms = '" + votedRooms + "'," +
                                      " lastfollowinglogin = '******', ignoreRoomInvitations = '" + ((IgnoreRoomInvitations) ? "1" : "0") + "'," +
                                      " citizenship_level = '" + CitizenshipLevel + "', helper_level = '" + HelperLevel + "', actrewards = '" + actrewards + "', dontfocususers = '" + ((DontFocusUser) ? "1" : "0") + "'," +
                                      " navilogs = @navilogs, targeted_offers = @targetedoffers, alertasAtivados = '" + ((alertasAtivados) ? "1" : "0") + "', frankJaApareceu = '" + ((frankJaApareceu) ? "1" : "0") + "', FavoriteGroup = '" + FavoriteGroup + "', moedas = '" + Moedas + "', corAtual = @coratual, coresjaTenho  = '" + coresjaTenho + "', new_identity = '" + NewIdentity + "', new_bot = '" + NewBot + "', coins_purchased = '" + CoinsPurchased + "' WHERE id = " + Id);
                    dbClient.addParameter("look", Look);
                    dbClient.addParameter("coratual", corAtual);
                    dbClient.addParameter("motto", Motto);
                    dbClient.addParameter("gender", Gender);
                    dbClient.addParameter("machineLast", MachineId);
                    dbClient.addParameter("navilogs", navilogs);
                    dbClient.addParameter("targetedoffers", targetedoffers);
                    dbClient.runQuery();

                    dbClient.runFastQuery("DELETE FROM users_online WHERE user_id = '" + Id + "'");
                }

                if (this.AlfaServiceEnabled)
                {
                    if (this.AlfaGuideEnabled)
                    {
                        OtanixEnvironment.GetGame().GetAlfaManager().GetTourManager().RemoveAlfa(this.Id);
                        this.AlfaGuideEnabled = false;
                    }
                    if (this.AlfaHelperEnabled)
                    {
                        Help help = null;
                        if (OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps.ContainsKey(AlfaServiceId))
                        {
                            help = OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps[AlfaServiceId];
                        }

                        if (help != null)
                        {
                            if (help.helpState == HelpState.TALKING)
                            {
                                help.helpState = HelpState.FINISHED;
                            }
                            else if (help.helpState == HelpState.SEARCHING_USER)
                            {
                                help.NeedUpdate = true;
                            }
                        }

                        OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().RemoveAlfa(this.Id);
                        this.AlfaHelperEnabled = false;
                    }
                    if (this.AlfaGuardianEnabled)
                    {
                        Bully bully = null;
                        if (OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies.ContainsKey(AlfaServiceId))
                        {
                            bully = OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies[AlfaServiceId];
                        }

                        if (bully != null)
                        {
                            if (bully.bullyState == BullyState.WAITING_RESPONSE)
                            {
                                bully.bullySolution = BullySolution.EXIT;
                                bully.bullyState    = BullyState.FINISHED;
                            }
                            else if (bully.bullyState == BullyState.SEARCHING_USER)
                            {
                                bully.NeedUpdate = true;
                            }
                        }

                        OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveGuardian(this.Id);
                        this.AlfaGuardianEnabled = false;
                    }
                }

                if (InRoom && CurrentRoom != null && CurrentRoom.GetRoomUserManager() != null)
                {
                    CurrentRoom.GetRoomUserManager().RemoveUserFromRoom(mClient, false, false, false);
                }

                if (AvatarEffectsInventoryComponent != null)
                {
                    AvatarEffectsInventoryComponent.Dispose();
                    AvatarEffectsInventoryComponent = null;
                }

                if (InventoryComponent != null)
                {
                    InventoryComponent.SetIdleState();
                    InventoryComponent.RunDBUpdate();
                    InventoryComponent.Destroy();
                    InventoryComponent = null;
                }

                if (BadgeComponent != null)
                {
                    BadgeComponentLoaded = false;
                    BadgeComponent.Destroy();
                    BadgeComponent = null;
                }

                if (RelationshipComposer != null)
                {
                    RelationsLoaded = false;
                    RelationshipComposer.Destroy();
                    RelationshipComposer = null;
                }

                if (Achievements != null && Achievements.Count > 0)
                {
                    AchievementsLoaded = false;
                    Achievements.Clear();
                    Achievements = null;
                }

                if (quests != null && quests.Count > 0)
                {
                    QuestsLoaded = false;
                    quests.Clear();
                    quests = null;
                }

                if (wardrobes != null && wardrobes.Count > 0)
                {
                    WardrobeLoaded = false;
                    wardrobes.Clear();
                    wardrobes = null;
                }

                if (clubManager != null)
                {
                    clubManager.Clear();
                    clubManager = null;
                }

                if (sanctionManager != null)
                {
                    sanctionManager.Clear();
                    sanctionManager = null;
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Disconnecting user " + e);
            }
            finally
            {
                OtanixEnvironment.GetGame().GetClientManager().UnregisterClient(Id, Username);
                Logging.WriteLine(Username + " has logged out.");
            }
        }