public async Task <bool> DumpOneStat()
        {
            var stat = InterferenceMatrixStats.Pop();

            if (stat == null)
            {
                return(false);
            }
            var item =
                _repository.FirstOrDefault(
                    x =>
                    x.ENodebId == stat.ENodebId && x.SectorId == stat.SectorId && x.DestPci == stat.DestPci && x.RecordTime == stat.RecordTime);

            if (item == null)
            {
                await _repository.InsertAsync(stat);
            }
            _repository.SaveChanges();
            return(true);
        }
        public async Task <bool> DumpOneStat()
        {
            var stat = InterferenceMatrixStats.Pop();

            if (stat == null)
            {
                return(false);
            }
            var cellId = stat.ENodebId + "-" + stat.SectorId;
            var item   =
                _repository.FirstOrDefault(
                    x => x.CellId == cellId && x.NeighborPci == stat.NeighborPci && x.StatDate == stat.StatDate);

            if (item == null)
            {
                await _repository.InsertAsync(stat);
            }
            _repository.SaveChanges();
            return(true);
        }
        public void UploadInterferenceStats(StreamReader reader, string path)
        {
            var container = InterferenceMatrixCsv.ReadInterferenceMatrixCsvs(reader, path);

            if (container == null)
            {
                return;
            }
            var time = container.RecordTime;
            var pcis = from info in
                       Mapper.Map <List <InterferenceMatrixCsv>, List <InterferenceMatrixPci> >(container.InterferenceMatrixCsvs)
                       join cell in PciCellList on new
            {
                info.ENodebId,
                Pci = info.SourcePci,
                info.Frequency
            }
            equals new
            {
                cell.ENodebId,
                cell.Pci,
                cell.Frequency
            }
            select new
            {
                Info = info,
                cell.SectorId
            };

            foreach (var matrixPci in pcis)
            {
                var stat = matrixPci.Info.MapTo <InterferenceMatrixStat>();
                stat.RecordTime = time;
                stat.SectorId   = matrixPci.SectorId;
                InterferenceMatrixStats.Push(stat);
            }
        }
 public void ClearStats()
 {
     InterferenceMatrixStats.Clear();
 }