コード例 #1
0
        protected override BaseEntity CreateModel(BaseEntity entity)
        {
            Location loc = entity as Location;

            loc.ID        = (int)reader["ID"];
            loc.Longitude = (double)reader["Longtidue"];
            loc.Altitude  = (double)reader["Altitude"];
            loc.Des       = reader["Des"].ToString();
            loc.Name      = reader["Name"].ToString();
            LTypeDB db = new LTypeDB();

            loc.Type = db.SelectByID((int)reader["Type"]);
            return(loc);
        }
コード例 #2
0
        //public static LType SelectByID(int id)
        //{
        //    if (lTypes==null)
        //    {
        //        LTypeDB db = new LTypeDB();
        //        Types = db.SelectAll();
        //    }
        //    LType lTypes = lTypes.Find(c => c.ID == id);
        //    return lTypes;
        //}

        public LType SelectByID(int id)
        {
            if (Ltypes == null)
            {
                LTypeDB db = new LTypeDB();
                Ltypes = db.SelectAll();
            }
            //    LType xx=null;
            //    foreach (LType lt in Ltypes)
            //    {
            //        if ( lt.ID == id)
            //            xx = lt;
            //}

            LType fl = Ltypes.Find(lt => lt.ID == id);

            return(fl);
        }