本文整理汇总了C#中Cell.Import方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.Import方法的具体用法?C# Cell.Import怎么用?C# Cell.Import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cell
的用法示例。
在下文中一共展示了Cell.Import方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public override void Save(IEnumerable<CellExcel> cellInfoList, ParametersDumpInfrastructure infrastructure)
{
IEnumerable<CellExcel> distinctInfos
= cellInfoList.Distinct(p => new { p.ENodebId, p.SectorId, p.Frequency });
IEnumerable<CellExcel> _validInfos
= from d in distinctInfos
join e in _eNodebRepository.GetAll()
on d.ENodebId equals e.ENodebId
select d;
var updateCells
= (from v in _validInfos
join c in _repository.GetAll()
on new { v.ENodebId, v.SectorId, v.Frequency }
equals new { c.ENodebId, c.SectorId, c.Frequency }
select new { Info = v, Data = c }).ToList();
infrastructure.CellsUpdated = 0;
infrastructure.NeighborPciUpdated = 0;
if (_updateExisted)
{
foreach (var cell in updateCells.Where(x=>x.Data.Pci!=x.Info.Pci))
{
cell.Info.CloneProperties(cell.Data);
_repository.Update(cell.Data);
infrastructure.CellsUpdated++;
}
if (_updatePci)
infrastructure.NeighborPciUpdated = SaveLteCellRelationService.UpdateNeighborPci(_validInfos);
}
IEnumerable<Cell> insertInfos = _validInfos.Except(updateCells.Select(x => x.Info)).Select(x =>
{
Cell cell = new Cell();
cell.Import(x);
return cell;
}).ToList();
_repository.AddCells(insertInfos);
infrastructure.CellsInserted = insertInfos.Count();
}
示例2: SaveWhenENodebNotExisted
protected override bool SaveWhenENodebNotExisted()
{
CellBase cellBase = _baseRepository.QueryCell(_cellInfo.ENodebId, _cellInfo.SectorId);
if (cellBase == null)
{
Cell cell = new Cell();
cell.Import(_cellInfo);
_repository.Insert(cell);
return true;
}
if (_updateExisted)
{
Cell cell = _repository.GetAll().FirstOrDefault(x =>
x.ENodebId == _cellInfo.ENodebId && x.SectorId == _cellInfo.SectorId);
if (cell == null) return false;
cell.Import(_cellInfo);
_repository.Update(cell);
return true;
}
return false;
}