Exemple #1
0
        public static bool isPlayerLost(int PlayerID, ToilluminateEntities db)
        {
            Dictionary <int, string> playerHeartBeatDic = (Dictionary <int, string>)HttpContext.Current.Application["playerHeartBeat"];

            if (playerHeartBeatDic != null)
            {
                if (playerHeartBeatDic.Keys.Contains(PlayerID))
                {
                    TimeSpan ts = DateTime.Now - DateTime.Parse(playerHeartBeatDic[PlayerID]);
                    if (ts.TotalMinutes < 1)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemple #2
0
        public static string GetInheritGroupStatus(int GroupID, PlayerStatusType statusType, ToilluminateEntities db)
        {
            GroupMaster gm = db.GroupMaster.Find(GroupID);

            switch (statusType)
            {
            case PlayerStatusType.Active:
                if (gm.ActiveFlag != "2")
                {
                    return(gm.ActiveFlag);
                }
                else
                {
                    return(GetInheritGroupStatus((int)gm.GroupParentID, PlayerStatusType.Active, db));
                }

            case PlayerStatusType.Online:
                if (gm.OnlineFlag != "2")
                {
                    return(gm.OnlineFlag);
                }
                else
                {
                    return(GetInheritGroupStatus((int)gm.GroupParentID, PlayerStatusType.Online, db));
                }

            default:
                return("");
            }
        }
Exemple #3
0
        public static string GetPlayerStatusByID(PlayerMaster pm, PlayerStatusType statusType, ToilluminateEntities db)
        {
            switch (statusType)
            {
            case PlayerStatusType.Active:
                if (pm.ActiveFlag != "2")
                {
                    return(pm.ActiveFlag);
                }
                else
                {
                    return(GetInheritGroupStatus((int)pm.GroupID, PlayerStatusType.Active, db));
                }

            case PlayerStatusType.Online:
                if (pm.OnlineFlag != "2")
                {
                    return(pm.OnlineFlag);
                }
                else
                {
                    return(GetInheritGroupStatus((int)pm.GroupID, PlayerStatusType.Online, db));
                }

            default:
                return("");
            }
        }
Exemple #4
0
        public static void GetChildFolderIDs(int selfFolderID, ref List <int> FolderIDList, ToilluminateEntities db)
        {
            List <FolderMaster> fmChildList = db.FolderMaster.Where(a => a.FolderParentID == selfFolderID).ToList();

            foreach (FolderMaster fm in fmChildList)
            {
                FolderIDList.Add(fm.FolderID);
                GetChildFolderIDs(fm.FolderID, ref FolderIDList, db);
            }
        }
Exemple #5
0
        public static void GetChildGroupIDs(int selfGroupID, ref List <int> GroupIDList, ToilluminateEntities db)
        {
            List <GroupMaster> gmChildList = db.GroupMaster.Where(a => a.GroupParentID == selfGroupID).ToList();

            foreach (GroupMaster gm in gmChildList)
            {
                GroupIDList.Add(gm.GroupID);
                GetChildGroupIDs(gm.GroupID, ref GroupIDList, db);
            }
        }
Exemple #6
0
 public static bool isPlayerOnline(PlayerMaster pm, ToilluminateEntities db)
 {
     return(GetPlayerStatusByID(pm, PlayerStatusType.Online, db) == "1");
 }
Exemple #7
0
        public static void GetParentGroupIDs(int selfGroupID, ref List <int> GroupIDList, ToilluminateEntities db)
        {
            int?parentGroupID = db.GroupMaster.Where(a => a.GroupID == selfGroupID).First().GroupParentID;

            if (parentGroupID > 0)
            {
                GroupIDList.Add((int)parentGroupID);
                GetParentGroupIDs((int)parentGroupID, ref GroupIDList, db);
            }
        }