public ActionResult Index() { var stationRepository = new Paul.Repository.StationRepository(); var stations = stationRepository.FindAllStations(); var message = string.Format("共收到{0}筆監測站的資料<br/>", stations.Count); stations.ForEach(x => { message += string.Format("水庫名稱:{0}<br/>水庫編號:{1}<br/>有效容量:{2}<br/>呆水位:{3}<br/>滿水位:{4}<br/>集水區雨量:{5}<br/>進水量:{6}<br/>放流量合計:{7}<br/><br/>", x.ReservoirName, x.ReservoirIdentifier, x.EffectiveCapacity, x.DeadStorageLevel, x.FullWaterLevel, x.CatchmentAreaRainfall, x.InflowVolume, x.OutflowTotal); }); return(Content(message)); }
static void Main(string[] args) { setDBFilePath(); var import = new Paul.Service.ImportService(); var db = new Paul.Repository.StationRepository(); // var stations = import.FindStations(@"C:\Users\Paul\Desktop\xmlData.xml"); //var stations = import.FindStations(@"d:\THBRM.xml"); //stations // .ToList().ForEach(station => //{ // db.Create(station); //}); var stations = db.FindAllStations(); /* db.Create(stations); * * foreach (var data in stations) * { * //db.Create(stations); * * Console.WriteLine("水庫名稱: " + data.ReservoirName); * Console.WriteLine("水庫編號: " + data.ReservoirIdentifier); * //Console.WriteLine("紀錄時間: " + data.RecordTime); * Console.WriteLine("有效容量: " + data.EffectiveCapacity); * Console.WriteLine("呆水位: " + data.DeadStorageLevel); * Console.WriteLine("滿水位: " + data.FullWaterLevel); * Console.WriteLine("集水區雨量: " + data.CatchmentAreaRainfall); * Console.WriteLine("進水量: " + data.InflowVolume); * Console.WriteLine("放流量合計: " + data.OutflowTotal + "\n"); * * * }*/ ShowStation(stations); Console.ReadKey(); }