예제 #1
0
        public IEnumerable <FoodMonitor> QueryFoodMonitorsByPage(FoodMonitor condition, int pageSize, int pageNo)
        {
            PriceService.PriceClient client = new PriceClient();
            var result = client.FindFoodMonitors(condition, "FoodName", true, pageSize, Math.Max(0, pageNo - 1));

            return(result);
        }
예제 #2
0
        public IEnumerable <KeyValuePair <string, string> > QueryFoodsByCategory(string category)
        {
            PriceService.PriceClient client = new PriceClient();
            var list = client.GetFoodName().Where(it => it.Value == category).ToList();

            return(list);
        }
예제 #3
0
        public int QueryMonitorsCountBy(FoodMonitor entity)
        {
            PriceService.PriceClient client = new PriceClient();
            var count = client.GetFoodMonitorsCounts(entity);

            return(count);
        }
예제 #4
0
        public string[] QueryAllCategorys()
        {
            PriceService.PriceClient client = new PriceClient();
            var categorys = client.GetCategorys();

            return(categorys);
        }
예제 #5
0
        public IEnumerable <KeyValuePair <string, string> > QueryAllMonitorSites()
        {
            PriceService.PriceClient client = new PriceClient();
            var sites = client.GetMonitorSites();

            return(sites);
        }
예제 #6
0
        //public void Query()
        //{
        //    try
        //    {
        //        PriceService.PriceClient client = new PriceService.PriceClient();
        //        var foods = client.GetFoods();
        //        var rfoods = foods.Where(it => !string.IsNullOrEmpty(it.Value)).ToList();
        //        var foodNames = client.GetFoodName();
        //        var categ = client.GetCategorys();
        //        var tables = client.GetTableNames();
        //        var dd = client.GetMonitorSites();
        //        PriceService.FoodMonitor monitor = new FoodMonitor();
        //        monitor.FoodID = foods[0].Key;
        //        monitor.FoodName = foods[0].Value;
        //        var result = client.FindFoodMonitors(null, null, true, 50, 0);
        //    }
        //    catch (Exception ex)
        //    {
        //        LogHelper.GetInstance().Error(ex.ToString());
        //        return;
        //    }
        //}

        public IEnumerable <KeyValuePair <string, string> > QueryAllFoods()
        {
            PriceService.PriceClient client = new PriceClient();
            var foods = client.GetFoodName();

            return(foods);
        }
예제 #7
0
        public void GetPrice(string setCode, string number)
        {
            var client = new PriceClient();
            var sid    = client.DownloadSid(setCode, number);

            Assert.That(sid, Is.Not.Null);

            var result = client.DownloadPrice(sid);

            Assert.That(result, Is.Not.Null);

            Assert.That(result.Mid, Is.Not.Null);
            Assert.That(result.Mid.Value, Is.GreaterThan(0));
        }
예제 #8
0
        private CommerceService()
        {
            this._listClient      = ClientContext.Clients.CreateListClient();
            this._browseClient    = ClientContext.Clients.CreateBrowseClient();
            this._storeClient     = ClientContext.Clients.CreateStoreClient();
            this._cartClient      = ClientContext.Clients.CreateCartClient();
            this._orderClient     = ClientContext.Clients.CreateOrderClient();
            this._priceClient     = ClientContext.Clients.CreatePriceClient();
            this._marketingClient = ClientContext.Clients.CreateMarketingClient();
            this._themeClient     = ClientContext.Clients.CreateThemeClient();
            this._reviewsClient   = ClientContext.Clients.CreateReviewsClient();

            _themesCacheStoragePath = ConfigurationManager.AppSettings["ThemeCacheFolder"];
            this._viewLocator       = new FileThemeViewLocator(_themesCacheStoragePath);
            this._cartHelper        = new CartHelper(this);
        }
예제 #9
0
 public void Query()
 {
     try
     {
         PriceService.PriceClient client = new PriceClient();
         var foods     = client.GetFoods();
         var rfoods    = foods.Where(it => !string.IsNullOrEmpty(it.Value)).ToList();
         var foodNames = client.GetFoodName();
         var categ     = client.GetCategorys();
         var tables    = client.GetTableNames();
         var dd        = client.GetMonitorSites();
         PriceService.FoodMonitor monitor = new FoodMonitor();
         monitor.FoodID   = foods[0].Key;
         monitor.FoodName = foods[0].Value;
         var result = client.FindFoodMonitors(null, null, true, 50, 0);
     }
     catch (Exception ex)
     {
         LogHelper.GetInstance().Error(ex.ToString());
         return;
     }
 }
예제 #10
0
        public CommerceService()
        {
            this._listClient      = ClientContext.Clients.CreateListClient();
            this._browseClient    = ClientContext.Clients.CreateBrowseClient();
            this._storeClient     = ClientContext.Clients.CreateStoreClient();
            this._cartClient      = ClientContext.Clients.CreateCartClient();
            this._orderClient     = ClientContext.Clients.CreateOrderClient();
            this._securityClient  = ClientContext.Clients.CreateSecurityClient();
            this._priceClient     = ClientContext.Clients.CreatePriceClient();
            this._marketingClient = ClientContext.Clients.CreateMarketingClient();
            this._inventoryClient = ClientContext.Clients.CreateInventoryClient();
            this._themeClient     = ClientContext.Clients.CreateThemeClient();
            this._pageClient      = ClientContext.Clients.CreatePageClient();
            this._reviewsClient   = ClientContext.Clients.CreateReviewsClient();

            _themesCacheStoragePath = ConfigurationManager.AppSettings["ThemeCacheFolder"];
            _pagesCacheStoragePath  = ConfigurationManager.AppSettings["PageCacheFolder"];

            this._viewLocator = new FileThemeViewLocator(HostingEnvironment.MapPath(_themesCacheStoragePath));

            this._cartHelper = new CartHelper(this);
        }
예제 #11
0
        public void GetPrice(string setCode, string name)
        {
            LoadCards();

            var card = Repo.SetsByCode[setCode].CardsByName[name].First();

            var client = new PriceClient();
            var sid    = client.DownloadSid(card);

            Assert.That(sid, Is.Not.Null);

            var result = client.DownloadPrice(sid.Sid);

            Assert.That(result, Is.Not.Null);

            Assert.That(result.Mid, Is.Not.Null);
            Assert.That(result.Mid.Value, Is.GreaterThan(0));

            Assert.That(result.Low, Is.Not.Null);
            Assert.That(result.Low.Value, Is.GreaterThan(0));

            Assert.That(result.High, Is.Not.Null);
            Assert.That(result.High.Value, Is.GreaterThan(0));
        }
        public static PriceClient CreatePriceClientWithUri(this CommerceClients source, string serviceUrl)
        {
            var client = new PriceClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());

            return(client);
        }
예제 #13
0
 public static PriceClient CreatePriceClient(this CommerceClients source, string serviceUrl, string appId, string secretKey)
 {
     var client = new PriceClient(new Uri(serviceUrl), appId, secretKey);
     return client;
 }
예제 #14
0
 public static PriceClient CreatePriceClientWithUri(this CommerceClients source, string serviceUrl)
 {
     var client = new PriceClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());
     return client;
 }
예제 #15
0
        public static PriceClient CreatePriceClient(this CommerceClients source, string serviceUrl, string appId, string secretKey)
        {
            var client = new PriceClient(new Uri(serviceUrl), appId, secretKey);

            return(client);
        }