コード例 #1
0
        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");
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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;
 }
コード例 #4
0
 public bool RemoveOneDistribution(IndoorDistribution distribution)
 {
     return context.IndoorDistributions.Remove(distribution) != null;
 }
コード例 #5
0
 public IndoorDistribution AddOneDistribution(IndoorDistribution distributiion)
 {
     return context.IndoorDistributions.Add(distributiion);
 }
コード例 #6
0
 public bool RemoveOneDistribution(IndoorDistribution distribution)
 {
     return(context.IndoorDistributions.Remove(distribution) != null);
 }
コード例 #7
0
 public IndoorDistribution AddOneDistribution(IndoorDistribution distributiion)
 {
     return(context.IndoorDistributions.Add(distributiion));
 }