public List<TrainPerformanceControl> GetList() { List<TrainPerformanceControl> lvResult = new List<TrainPerformanceControl>(); DataSet ds = null; TrainPerformanceControl lvElement = null; ds = TrainperformanceDataAccess.GetData(this.lvtraintype, this.lvdirection, this.lvlocation, this.lvud, this.lvstop_location, this.lvtimemov, this.lvtimestop, this.lvtimeheadwaymov, this.lvtimeheadwaystop, this.DestinationTrack, ""); foreach (DataRow row in ds.Tables[0].Rows) { lvElement = new TrainPerformanceControl(); lvElement.Traintype = ((row["traintype"] == DBNull.Value) ? "" : row["traintype"].ToString()); lvElement.Direction = ((row["direction"] == DBNull.Value) ? Int16.MinValue : Convert.ToInt16(row["direction"])); lvElement.Location = ((row["location"] == DBNull.Value) ? Int32.MinValue : (int)row["location"]); lvElement.Ud = ((row["ud"] == DBNull.Value) ? "" : row["ud"].ToString()); lvElement.Stop_location = ((row["stop_location"] == DBNull.Value) ? Int32.MinValue : (int)row["stop_location"]); lvElement.TimeMov = ((row["timemov"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timemov"]); lvElement.TimeStop = ((row["timestop"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timestop"]); lvElement.TimeHeadWayMov = ((row["timeheadwaymov"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timeheadwaymov"]); lvElement.TimeHeadWayStop = ((row["timeheadwaystop"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timeheadwaystop"]); lvResult.Add(lvElement); lvElement = null; } return lvResult; }
public static void LoadDic() { mDicTrainPerformance = new Dictionary<string, TrainPerformanceControl>(); DataSet ds = null; TrainPerformanceControl lvElement = null; string lvStrKey = ""; ds = TrainperformanceDataAccess.GetAll(); foreach (DataRow row in ds.Tables[0].Rows) { lvElement = new TrainPerformanceControl(); lvElement.Traintype = ((row["traintype"] == DBNull.Value) ? "" : row["traintype"].ToString()); lvElement.Direction = ((row["direction"] == DBNull.Value) ? Int16.MinValue : Convert.ToInt16(row["direction"])); lvElement.Location = ((row["location"] == DBNull.Value) ? Int32.MinValue : (int)row["location"]); lvElement.Ud = ((row["ud"] == DBNull.Value) ? "" : row["ud"].ToString()); lvElement.Stop_location = ((row["stop_location"] == DBNull.Value) ? Int32.MinValue : (int)row["stop_location"]); lvElement.TimeMov = ((row["timemov"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timemov"]); lvElement.TimeStop = ((row["timestop"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timestop"]); lvElement.TimeHeadWayMov = ((row["timeheadwaymov"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timeheadwaymov"]); lvElement.TimeHeadWayStop = ((row["timeheadwaystop"] == DBNull.Value) ? ConnectionManager.DOUBLE_REF_VALUE : (double)row["timeheadwaystop"]); lvElement.DestinationTrack = ((row["destination_track"] == DBNull.Value) ? Int16.MinValue : Convert.ToInt16(row["destination_track"])); lvStrKey = lvElement.Traintype + ":" + lvElement.Direction + ":" + lvElement.Location + ":" + lvElement.Ud + ":" + lvElement.DestinationTrack; mDicTrainPerformance.Add(lvStrKey, lvElement); lvElement = null; } DebugLog.Logar("LoadDic.mDicTrainPerformance.Count = " + mDicTrainPerformance.Count); }