partial void DeleteSS_Retailer(SS_Retailer instance);
 partial void InsertSS_Retailer(SS_Retailer instance);
 partial void UpdateSS_Retailer(SS_Retailer instance);
Ejemplo n.º 4
0
        public static void DownloadRetailers()
        {
            ShopStyle api = new ShopStyle("uid8409-24047347-36",ShopStyle.US_API_HOSTNAME);

            var retailerResponse = api.getRetailers();
            using (CatalogDataContext dc = new CatalogDataContext())
            {
                foreach (Retailer retailer in retailerResponse.getRetailers())
                {
                    SS_Retailer obj =  dc.SS_Retailers.SingleOrDefault(r => r.retailer_id == (int)retailer.getId());

                    if (obj == null)
                    {
                        SS_Retailer ssRetailer = new SS_Retailer() { id = System.Guid.NewGuid(), name = retailer.getName(), retailer_id = (int)retailer.getId(), url = retailer.getUrl() };
                        dc.SS_Retailers.InsertOnSubmit(ssRetailer);
                    }

                }

                dc.SubmitChanges();
            }
        }