コード例 #1
0
 int compare(DBTrack a, DBTrack b)
 {
     return(a.Index.CompareTo(b.Index));
 }
コード例 #2
0
        public List <DBTrack> Fill(DataSet ds)
        {
            List <DBTrack> list = new List <DBTrack>();
            int            row  = ds.Tables[0].Rows.Count;

            if (row > 0)
            {
                for (int i = 0; i < row; i++)
                {
                    DBTrack track = new DBTrack();
                    if (ds.Tables[0].Rows[i]["Index"] != null && ds.Tables[0].Rows[i]["Index"].ToString() != "")
                    {
                        track.Index = int.Parse(ds.Tables[0].Rows[i]["Index"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["ID"] != null)
                    {
                        track.ID = ds.Tables[0].Rows[i]["ID"].ToString();
                    }
                    if (ds.Tables[0].Rows[i]["roundID"] != null)
                    {
                        track.roundID = ds.Tables[0].Rows[i]["roundID"].ToString();
                    }
                    if (ds.Tables[0].Rows[i]["touchdown_p1"] != null)
                    {
                        track.touchdown_p1 = ds.Tables[0].Rows[i]["touchdown_p1"].ToString();
                    }
                    if (ds.Tables[0].Rows[i]["touchdown_p2"] != null)
                    {
                        track.touchdown_p2 = ds.Tables[0].Rows[i]["touchdown_p2"].ToString();
                    }
                    if (ds.Tables[0].Rows[i]["maxSpeed"] != null && ds.Tables[0].Rows[i]["maxSpeed"].ToString() != "")
                    {
                        track.maxSpeed = decimal.Parse(ds.Tables[0].Rows[i]["maxSpeed"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["maxRotateSpeed"] != null && ds.Tables[0].Rows[i]["maxRotateSpeed"].ToString() != "")
                    {
                        track.maxRotateSpeed = decimal.Parse(ds.Tables[0].Rows[i]["maxRotateSpeed"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["xRotateSpeed"] != null && ds.Tables[0].Rows[i]["xRotateSpeed"].ToString() != "")
                    {
                        track.xRotateSpeed = int.Parse(ds.Tables[0].Rows[i]["xRotateSpeed"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["yRotateSpeed"] != null && ds.Tables[0].Rows[i]["yRotateSpeed"].ToString() != "")
                    {
                        track.yRotateSpeed = int.Parse(ds.Tables[0].Rows[i]["yRotateSpeed"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["direction"] != null && ds.Tables[0].Rows[i]["direction"].ToString() != "")
                    {
                        track.direction = int.Parse(ds.Tables[0].Rows[i]["direction"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["overNetHeight"] != null && ds.Tables[0].Rows[i]["overNetHeight"].ToString() != "")
                    {
                        track.overNetHeight = decimal.Parse(ds.Tables[0].Rows[i]["overNetHeight"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["traceString"] != null)
                    {
                        track.traceString = ds.Tables[0].Rows[i]["traceString"].ToString();
                    }
                    if (ds.Tables[0].Rows[i]["shadowLenght"] != null && ds.Tables[0].Rows[i]["shadowLenght"].ToString() != "")
                    {
                        track.shadowLenght = decimal.Parse(ds.Tables[0].Rows[i]["shadowLenght"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["shadowWidth"] != null && ds.Tables[0].Rows[i]["shadowWidth"].ToString() != "")
                    {
                        track.shadowWidth = decimal.Parse(ds.Tables[0].Rows[i]["shadowWidth"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["shadowAngle"] != null && ds.Tables[0].Rows[i]["shadowAngle"].ToString() != "")
                    {
                        track.shadowAngle = decimal.Parse(ds.Tables[0].Rows[i]["shadowAngle"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["createtime"] != null && ds.Tables[0].Rows[i]["createtime"].ToString() != "")
                    {
                        track.createtime = DateTime.Parse(ds.Tables[0].Rows[i]["createtime"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["trackResult"] != null && ds.Tables[0].Rows[i]["trackResult"].ToString() != "")
                    {
                        track.trackResult = int.Parse(ds.Tables[0].Rows[i]["trackResult"].ToString());
                    }
                    if (ds.Tables[0].Rows[i]["ownerID"] != null)
                    {
                        track.ownerID = ds.Tables[0].Rows[i]["ownerID"].ToString();
                    }
                    list.Add(track);
                }
            }
            list.Sort(compare);
            return(list);
        }