protected override Control AddEditor(Control container)
        {
            IEnumerable <ProductBrief> productBriefs;

            try
            {
                ShopperApiClientHelperForN2Admin.AssureLimitedAuthentication(false);
                productBriefs = Context.Current.Container.Resolve <ICatalogApi>().GetProductBriefsAsync().Result;
            }
            catch
            {               // TODO - better error handling, e.g. show an input box
                productBriefs = new ProductBrief[0];
            }

            // here we create the editor control and add it to the page
            var list = new DropDownList
            {
                ID             = Name,
                DataTextField  = "IdAndName",
                DataValueField = "Id",
                DataSource     = productBriefs
            };

            list.DataBind();
            container.Controls.Add(list);
            return(list);
        }
Exemple #2
0
 private static IEnumerable <string> LoadPopNames()
 {
     try
     {
         ShopperApiClientHelperForN2Admin.AssureLimitedAuthentication(false);
         return(Context.Current.Container.Resolve <IOffersApi>().GetPointOfPromotionNamesAsync().Result);
     }
     catch
     {   // TODO - better error handling, e.g. show an input box
         return(new string[0]);
     }
 }