예제 #1
0
        private Hull(Datamodel.Hull h)
        {
            id       = h.id;
            name     = h.series;
            symbol   = h.symbol;
            ordering = h.ordering;

            _roleId = h.role;
            Datamodel.HullRole hr = null;
            if (!Datamodel.HullRole.FetchById(ref hr, _roleId))
            {
                throw new ArgumentException(
                          "Hull does not have valid role ID");
            }
            role = hr.name;

            _vendorId = h.vendor;
            Datamodel.HullVendor hv = null;
            if (!Datamodel.HullVendor.FetchById(ref hv, _vendorId))
            {
                throw new ArgumentException(
                          "Hull does not have valid vendor ID");
            }
            vendor = hv.name;
        }
예제 #2
0
 /// <summary>
 /// Gets a hull by ID
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static Hull FetchById(int id)
 {
     Datamodel.Hull h = null;
     if (Datamodel.Hull.FetchById(ref h, id))
     {
         return(new Hull(h));
     }
     else
     {
         return(null);
     }
 }