Exemple #1
0
        public Kv CheckoutAccount()
        {
            Kv          kv          = new Kv();
            string      VoucherNo   = Kv.Get("VoucherNo");
            UserVoucher UserVoucher = UserVoucher.CheckoutAccount(base.Kv.Cxt, VoucherNo);

            if (UserVoucher != null)
            {
                User User = User.GetUserByID(base.Kv.Cxt, UserVoucher.UserID);
                kv.Set("Payment", User.Fini);
                kv.Set("ExpiryDate", UserVoucher.ExpiryDate);
                if (UserVoucher.IsUsed == false)
                {
                    kv.Set("Message", "0");
                }
                else
                {
                    kv.Set("Message", "1");
                }
            }
            else
            {
                kv.Set("Message", "2");
            }
            return(kv);
        }
        public static DataSet SaveTournament(Kv kv)
        {
            kv.Set("MethodName", (int)MethodNameE.SaveTournament);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);

            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #3
0
        public DataTable AddUser()
        {
            base.Kv.Cxt.CurrentUserID = 1; // New users are added by Admin = 1
            User item = new User();

            item.Cxt = base.Kv.Cxt;
            if (CountryID != 0)
            {
                item.CountryID = CountryID;
            }
            item.NearestCityID = NearestCityID;
            item.GenderID      = GenderID;
            item.FideTitleID   = FideTitleID;
            item.IccfTitleID   = IccfTitleID;
            item.UserName      = UserName;
            item.Email         = Email;
            item.FirstName     = FirstName;
            item.LastName      = LastName;
            item.EngineID      = 1;
            item.PasswordHint  = PasswordHint;
            item.PersonalNotes = PersonalNotes;
            item.Url           = Url;
            if (DateLastLogin != string.Empty)
            {
                item.DateLastLogin = Convert.ToDateTime(DateLastLogin);
            }
            if (DateOfBirth != string.Empty)
            {
                item.DateOfBirth = Convert.ToDateTime(DateOfBirth);
            }
            item.Password              = Password;
            item.HumanRankIDE          = RankE.Pawn;
            item.EngineRankIDE         = RankE.Pawn;
            item.CentaurRankIDE        = RankE.Pawn;
            item.CorrespondenceRankIDE = RankE.Pawn;
            item.StatusIDE             = StatusE.Active;
            item.RoomID            = 3;
            item.SocialID          = 1;
            item.UserStatusIDE     = UserStatusE.Blank;
            item.IsIdle            = false;
            item.IsPause           = false;
            item.Cxt.CurrentUserID = base.Kv.Cxt.CurrentUserID;

            item.Save();

            if (!string.IsNullOrEmpty(UserImage))
            {
                SaveUserImage(Ap.WebFolderUserImages + item.UserID);
            }

            DataTable roles = User.GetRolesTable(item.UserID);

            Kv kv1 = new Kv();

            kv1.Set("MsgId", -1);
            kv1.Set("UserData", UData.ToString(item.DataRow.Table));
            kv1.Set("RolesData", UData.ToString(roles.Copy()));

            return(kv1.DataTable);
        }
        public static DataSet DeleteChallenge(int challengeID, int challengerID, ChallengeTypeE challengeType)
        {
            Kv kv = new Kv();

            if (challengerID == Ap.CurrentUserID)
            {
                kv.Set("MethodName", (int)MethodNameE.DeleteChallenge);
            }
            else
            {
                if (challengeType != ChallengeTypeE.Seek)
                {
                    kv.Set("MethodName", (int)MethodNameE.DeclineChallenge);
                }
                else
                {
                    return(null);
                }
            }
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("ChallengeID", challengeID);
            DataSet ds = SocketClient.Instance.Invoke(kv.DataTable.Copy());

            return(ds);
        }
        public static int GetGameIDByTournamentMatchID(int tournamentMatchID)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetGameIDByTournamentMatchID);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("TournamentMatchID", tournamentMatchID);

            DataSet ds = SocketClient.Instance.Invoke(kv.DataTable);

            if (ds == null)
            {
                return(0);
            }

            if (ds.Tables.Count == 0)
            {
                return(0);
            }

            if (ds.Tables[0].Rows.Count == 0)
            {
                return(0);
            }

            return(BaseItem.GetColInt32(ds.Tables[0].Rows[0], "GameID", 0));
        }
        public static void UpdateSession()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.UpdateSession);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
Exemple #7
0
        public static DataSet GetAllBlockedIPs()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetAllBlockedIPs);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
        public static void ClearLog()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.ClearLog);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            SocketClient.Instance.InvokeAsync(kv.DataTable.Copy());
        }
        public static void HeartbeatPing()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.HeartbeatPing);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
Exemple #10
0
        public static DataSet GetTournamentPrizeCategories()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetTournamentPrizeCategories);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);

            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #11
0
        public static void BlockIP(int SelectedUserId)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.BlockIP);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("UserID", SelectedUserId);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
        public static void DeclineChallenges(DataTable dt)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.DeclineChallenges);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("ChallengesData", UData.ToString(dt));
            SocketClient.Instance.InvokeAsync(kv.DataTable.Copy());
        }
        public static DataSet GetAllTournamentsByStatus(TournamentStatusE ts)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetAllTournaments);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("TournamentStatusId", (int)ts);
            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #14
0
        public static void UnBlockIPs(string blockedIPIds)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.UnBlockIPs);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("BlockedIPID", blockedIPIds);
            SocketClient.Instance.InvokeAsync(kv.DataTable.Copy());
        }
        public static DataSet GetRecentTournamentTeam(int tournamentID)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetRecentTournamentTeam);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("TournamentID", tournamentID);
            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #16
0
        public static void QueryUpgrade()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.QueryUpgrade);
            kv.Set("VersionNo", String.Empty);
            kv.Set("PatchUrl", String.Empty);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
        public static DataSet GetAllTournaments(bool isAdmin)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetAllTournaments);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("IsAdmin", isAdmin);
            kv.Set("TournamentStatusId", (int)TournamentStatusE.Unknown);
            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #18
0
        public static void AddAudience(int gameID)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.AddAudience);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("UserID", Ap.CurrentUserID);
            kv.Set("GameID", gameID);
            SocketClient.Instance.Invoke(kv.DataTable.Copy());
        }
        public static DataSet GetAllLog()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.GetAllLog);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            DataSet ds = SocketClient.Instance.Invoke(kv.DataTable.Copy());

            return(ds);
        }
Exemple #20
0
        public static void UserLeaveGame(UserStatusE userStatus, int gameID)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.UserLeaveGame);
            kv.Set("GameID", gameID);
            kv.Set("UserStatus", (int)userStatus);
            kv.Set(StdKv.CurrentUserID, App.Model.Ap.CurrentUserID);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
        public static void ForceLogoff(int userId)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.ForceLogoff);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("UserId", userId);

            SocketClient.Instance.InvokeAsync(kv.DataTable.Copy());
        }
Exemple #22
0
        public static void SaveBlockedIP(string ipAddress, int blockedIPID)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.SaveBlockedIP);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("IPAddress", ipAddress);
            kv.Set("BlockedIPID", blockedIPID);
            SocketClient.Instance.Invoke(kv.DataTable);
        }
Exemple #23
0
        public static void SystemInformation(int opponentUserID, ChatTypeE chatType)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.SystemInformation);
            kv.Set("ChatType", (int)chatType);
            kv.Set("FromUserID", Ap.CurrentUserID);
            kv.Set("ToUserID", opponentUserID);
            SocketClient.Instance.InvokeAsync(kv.DataTable);
        }
        public static DataSet StartTournamentRound(int tId)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.StartTournamentRound);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("TId", tId);

            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #25
0
        public static void IdleUser(bool chkIdle)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.IdleUser);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("UserID", Ap.CurrentUserID);
            kv.Set("IsIdle", chkIdle);
            SocketClient.Instance.InvokeAsync(kv.DataTable.Copy());
        }
        public static void LogoffUser()
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.LogoffUser);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("UserId", Ap.CurrentUserID);

            SocketClient.Instance.Invoke(kv.DataTable.Copy());
        }
        public static DataSet DeleteTournament(string ids)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.DeleteTournament);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("Ids", ids);

            return(SocketClient.Instance.Invoke(kv.DataTable));
        }
Exemple #28
0
        public static DataSet HighestRankingPlayerGame()
        {
            Kv kvPlayer = new Kv();

            kvPlayer.Set("MethodName", (int)MethodNameE.HighestRankingPlayerGame);
            kvPlayer.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            DataSet dsPlayer = SocketClient.Instance.Invoke(kvPlayer.DataTable.Copy());

            return(dsPlayer);
        }
Exemple #29
0
        public static void UpdateTeamStatus(StatusE statusID, string teamIds)
        {
            Kv kv = new Kv();

            kv.Set("MethodName", (int)MethodNameE.UpdateTeamStatus);
            kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID);
            kv.Set("TeamIds", teamIds);
            kv.Set("StatusID", statusID.ToString("d"));
            SocketClient.Instance.InvokeAsync(kv.DataTable.Copy());
        }
Exemple #30
0
        public static DataSet CheckUserId(string txtLoginId)
        {
            Kv kv1 = new Kv();

            kv1.Set("MethodName", (int)MethodNameE.CheckUserId);
            kv1.Set("LoginId", txtLoginId);
            DataSet ds = SocketClient.Instance.Invoke(kv1.DataTable.Copy());

            return(ds);
        }