public void ImportRainfall(string inFile, string rainrecordname, string monitoringpointid, int lnversionid) { DateTime [] d = GetTipTimes(inFile); DateTime [] RainTime; double [] RainIntensity; //call bindata to translate to 5 min BinData binData = new BinData(5,0.254); binData.Compute(d, out RainTime, out RainIntensity); //call RunoffManager to get runoff RunoffManager runoffManager = new RunoffManager(); runoffManager.InitGammaDistribution(1,40); double [] discharge = runoffManager.FillDischarge(RainIntensity, 0.0146, 1, 0.0429); //load into rsm_rainfall dsRSM1.EnforceConstraints = false; daData.Fill(dsRSM1.rsm_Rainfall); for(int i = 0; i < RainTime.Length; i++) { dsRSM.rsm_RainfallRow rainfall = dsRSM1.rsm_Rainfall.Newrsm_RainfallRow(); rainfall.BeginEdit(); rainfall.MonitoringPointID = monitoringpointid; rainfall.LNVersionID = lnversionid; rainfall.RainDateTime = RainTime[i]; rainfall.RainIntensity = RainIntensity[i]; rainfall.Runoff = discharge[i]; rainfall.RainRecordName = rainrecordname; rainfall.EndEdit(); dsRSM1.rsm_Rainfall.Addrsm_RainfallRow(rainfall); } int wrong = dsRSM1.rsm_Rainfall.Select("RainDateTime = '1/1/1'").Length; if(wrong > 0) { Debug.WriteLine("dates like 1/1/1: " + wrong); throw new Exception("date error"); } if(dsRSM1.rsm_Rainfall.HasErrors) { foreach(DataRow r in dsRSM1.rsm_Rainfall.GetErrors()) { Debug.WriteLine(r.RowError); r.RejectChanges(); } } daData.Update(dsRSM1.rsm_Rainfall); dsRSM1.rsm_Rainfall.AcceptChanges(); }