Example #1
0
        public static DataTable LogoffUser(Cxt cxt, int userID)
        {
            Kv             Kv = new Kv();
            SqlTransaction t  = null;

            try
            {
                t = SqlHelper.BeginTransaction(Config.ConnectionString);
                Challenges.UpdateChallengesStatus(t, userID);
                User item = new User(cxt, userID);
                item.UserStatusIDE = UserStatusE.Gone;
                //item.StatusIDE = item.IsGuest ? StatusE.Inactive : item.StatusIDE;
                item.EngineID = 1;
                item.IsIdle   = false;
                item.IsPause  = false;
                item.Save(t); //Transaction also commited in this method
                Kv.Set("LogedOff", true);
            }
            catch (Exception ex)
            {
                SqlHelper.RollbackTransaction(t);
                throw ex;
            }

            return(Kv.DataTable);
        }
Example #2
0
        public static DataSet GetDataByRoomID(Cxt cxt, int roomID, int userID, int userStatus, int engineID, bool isFromTimer)
        {
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable();

            if (userID != 0 && !isFromTimer)
            {
                SqlTransaction t = null;
                try
                {
                    t = SqlHelper.BeginTransaction(Config.ConnectionString);
                    Challenges.UpdateChallengesStatus(t, userID);
                    User.UpdatedUserRoom(cxt, t, roomID, userStatus, engineID, userID); //Transaction also commited in this method
                }
                catch (Exception ex)
                {
                    SqlHelper.RollbackTransaction(t);

                    throw ex;
                }
            }

            ds = BaseCollection.ExecuteDataset("ApData", userID, roomID);
            ds.Tables[0].TableName = "Room";
            ds.Tables[1].TableName = "Users";
            ds.Tables[2].TableName = "Games";
            ds.Tables[3].TableName = "Challenges";
            ds.Tables[4].TableName = "RoomUsersCount";
            ds.Tables[5].TableName = "LoggedinUsers";
            ds.Tables[6].TableName = "UserMessages";
            ds.Tables[7].TableName = "Table7";

            dt           = new DataTable();
            dt           = Challenge.GetAcceptedChallenge(cxt, roomID, userID);
            dt.TableName = "AcceptedChallenge";
            ds.Tables.Add(dt.Copy());

            return(ds);
        }