public void TestConstructor(string name, double longtitute, double lattitute) { var info = new IndoorDistributionExcel { Name = name, Range = "range", SourceName = "source", SourceType = "type", Longtitute = longtitute, Lattitute = lattitute }; var item = IndoorDistribution.ConstructItem(info); Assert.AreEqual(item.Name, name); Assert.AreEqual(item.Range, "range"); Assert.AreEqual(item.SourceName, "source"); Assert.AreEqual(item.SourceType, "type"); }
private int SaveIndoorDistributions(IEnumerable <CollegeIndoorExcel> indoorExcels, IIndoorDistributioinRepository distributioinRepository, InfrastructureType type) { int count = 0; foreach (CollegeIndoorExcel excel in indoorExcels) { IndoorDistribution distribution = distributioinRepository.IndoorDistributions.FirstOrDefault(x => x.Name == excel.Name && x.Range == excel.Range && x.SourceName == excel.SourceName); if (distribution == null) { distribution = new IndoorDistribution { Name = excel.Name, Range = excel.Range, SourceName = excel.SourceName, SourceType = excel.SourceType, Longtitute = excel.Longtitute, Lattitute = excel.Lattitute }; distribution = distributioinRepository.AddOneDistribution(distribution); distributioinRepository.SaveChanges(); } InfrastructureInfo infrastructure = _repository.InfrastructureInfos.FirstOrDefault(x => x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College && x.InfrastructureType == type && x.InfrastructureId == distribution.Id); if (infrastructure == null) { infrastructure = new InfrastructureInfo { HotspotName = excel.CollegeName, HotspotType = HotspotType.College, InfrastructureType = type, InfrastructureId = distribution.Id }; _repository.AddOneInfrastructure(infrastructure); _repository.SaveChanges(); } count++; } return(count); }
private int SaveIndoorDistributions(IEnumerable<CollegeIndoorExcel> indoorExcels, IIndoorDistributioinRepository distributioinRepository, InfrastructureType type) { int count = 0; foreach (CollegeIndoorExcel excel in indoorExcels) { IndoorDistribution distribution = distributioinRepository.IndoorDistributions.FirstOrDefault(x => x.Name == excel.Name && x.Range == excel.Range && x.SourceName == excel.SourceName); if (distribution == null) { distribution = new IndoorDistribution { Name = excel.Name, Range = excel.Range, SourceName = excel.SourceName, SourceType = excel.SourceType, Longtitute = excel.Longtitute, Lattitute = excel.Lattitute }; distribution = distributioinRepository.AddOneDistribution(distribution); distributioinRepository.SaveChanges(); } InfrastructureInfo infrastructure = _repository.FirstOrDefault(x => x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College && x.InfrastructureType == type && x.InfrastructureId == distribution.Id); if (infrastructure == null) { infrastructure = new InfrastructureInfo { HotspotName = excel.CollegeName, HotspotType = HotspotType.College, InfrastructureType = type, InfrastructureId = distribution.Id }; _repository.Insert(infrastructure); } count++; } return count; }
public bool RemoveOneDistribution(IndoorDistribution distribution) { return context.IndoorDistributions.Remove(distribution) != null; }
public IndoorDistribution AddOneDistribution(IndoorDistribution distributiion) { return context.IndoorDistributions.Add(distributiion); }
public bool RemoveOneDistribution(IndoorDistribution distribution) { return(context.IndoorDistributions.Remove(distribution) != null); }
public IndoorDistribution AddOneDistribution(IndoorDistribution distributiion) { return(context.IndoorDistributions.Add(distributiion)); }