private void LoadParts() { DB_111206_scrapEntities db = new DB_111206_scrapEntities(); var sqllist = db.Parts.ToList(); List <DTO_Part> parts = new List <DTO_Part>(); foreach (var sqlObject in sqllist) { DTO_Part p = new DTO_Part(); p.manID = sqlObject.manID.Value; p.modelID = sqlObject.modelId.Value; p.partDesc = sqlObject.partDesc; p.partNum = sqlObject.partNum; p.partPic = string.Format("{0}{1}", @"http://www.jerrybhill.com/scrapimages/", sqlObject.partPic); p.partsID = sqlObject.partsID; // Missing import object DTO_Manufacture m = new DTO_Manufacture(); m.manID = sqlObject.manID.Value; m.manName = sqlObject.Manufacturer.manName; p.manufacture = m; parts.Add(p); } lv.ItemsSource = parts; }
public List <DTO_Offer> GetOffersByPartDesc(DTO_Part p) { //string partDesc = p.partDesc; DB_111206_scrapEntities db = new DB_111206_scrapEntities(); var listOffers = db.Offers.ToList(); var matches = listOffers.Where(x => x.Part.partDesc.Contains(p.Description)).ToList(); List <DTO_Offer> offers = new List <DTO_Offer>(); foreach (var offer in matches) { var o = new DTO_Offer { Id = offer.offerID, /* Parts = offer.partsID,// partsID), * Seller = Convert.ToInt32(offer.sellerID), */ Price = Convert.ToInt32(offer.price), Ostat = Convert.ToInt32(offer.ostat), DT = offer.offerDate }; offers.Add(o); } return(offers); }