Exemple #1
0
        internal static contract.HistoryList MakeContractSessionHistoryList(
            List <entity.SessionHistory> SessionHistoryEntityData)
        {
            if (SessionHistoryEntityData == null || SessionHistoryEntityData.Count < 0)
            {
                return(null);
            }

            var SessionHistoryData = new contract.HistoryList();

            foreach (entity.SessionHistory item in SessionHistoryEntityData)
            {
                var history = new contract.History();
                history.PeriodStartDate = item.SessionStartTime.Ticks.ToString();
                history.PeriodEndDate   = (item.SessionEndTime != null)
                    ? item.SessionEndTime.Value.Ticks.ToString()
                    : "Unknown";

                history.SessionID           = item.SessionID;
                history.IsEvidenceAvailable = item.IsEvidenceAvailable;

                SessionHistoryData.List.Add(history);
            }

            return(SessionHistoryData);
        }
Exemple #2
0
        internal static contract.HistoryList MakeContractHistoryList(List <entity.LocationHistory> HistoryEntityData,
                                                                     string MobileNumber)
        {
            if (HistoryEntityData == null || HistoryEntityData.Count < 0)
            {
                return(null);
            }

            var HistoryLocationData = new contract.HistoryList();

            List <IGrouping <string, entity.LocationHistory> > filteredList =
                HistoryEntityData.GroupBy(x => x.SessionID).ToList();

            int cnt = 1;

            foreach (var item in filteredList)
            {
                var history = new contract.History();
                history.PeriodStartDate = item.Min(s => s.ClientTimeStamp).ToString() == "0"
                    ? utility.Converter.GetSOSMinDateTime().Ticks.ToString()
                    : item.Min(s => s.ClientTimeStamp).ToString();
                history.PeriodEndDate = item.Max(s => s.ClientTimeStamp).ToString() == "0"
                    ? utility.Converter.GetSOSMaxDateTime().Ticks.ToString()
                    : item.Max(s => s.ClientTimeStamp).ToString();
                history.PhoneNumber  = utility.Security.Decrypt(MobileNumber);
                history.GeoInstances =
                    item.Select(
                        s =>
                        new contract.GeoTag
                {
                    SessionID    = s.SessionID,
                    IsSOS        = s.IsSOS,
                    Lat          = s.Lat,
                    Long         = s.Long,
                    Alt          = s.Alt,
                    GeoDirection = 0,
                    Speed        = s.Speed,
                    TimeStamp    = s.Timestamp.DateTime.Ticks,
                    ProfileID    = Convert.ToInt64(s.ProfileID),
                    MediaUri     = s.MediaUri,
                    Accuracy     = s.Accuracy
                }).ToList();

                HistoryLocationData.List.Add(history);
            }

            return(HistoryLocationData);
        }