Example #1
0
        public async Task <List <ActiveSOSReports> > ActiveModeStats()
        {
            int rowCount = 1;

            //1: User Calls
            Dictionary <long, Tuple <short, DateTime> > liveSessionData =
                await _LiveSessionRepository.GetSOSLiveSessionData();

            Dictionary <long, Tuple <long, string> > UserAttributewithProfile =
                await _ReportRepository.GetAllUserwithProfileData(string.Join(",", liveSessionData.Keys.ToList()));


            //2: Group Calls
            // var groupListwithProfileIDs1 = await  _GroupRepository.GetAllGroupsWithProfileID1();
            Dictionary <string, long> groupListwithProfileIDs = await _GroupRepository.GetAllGroupsWithProfileID();

            Dictionary <int, string> groupListwithGroupNames = _GroupStorageAccess.GetAllGroupsWithGroupNames();


            //Method1
            IEnumerable <ActiveSOSReports> ActiveSOSReports = from p in liveSessionData
                                                              join q in UserAttributewithProfile on p.Key equals q.Value.Item1
                                                              join s in groupListwithProfileIDs on q.Value.Item1 equals s.Value
                                                              join t in groupListwithGroupNames on s.Key.Split(':')[0] equals t.Key.ToString()
                                                              orderby t.Value
                                                              select new ActiveSOSReports
            {
                SNo           = rowCount++,
                UserName      = q.Value.Item2.Split(',')[0],
                MobileNumber  = utility.Security.Decrypt(q.Value.Item2.Split(',')[2]),
                SOSAlertCount = p.Value.Item1.ToString(),
                StartTime     = p.Value.Item2.ToString(),
                GroupName     = t.Value,
                ProfileId     = p.Key.ToString()
            };


            //Method2

            return(ActiveSOSReports.ToList());
        }