Exemple #1
0
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(
                CurrentSubscription.SubscriptionId,
                ServiceEndpoint,
                CurrentSubscription.Certificate,
                text => this.WriteDebug(text),
                Channel);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);
            WindowsAzureAddOn addon;

            if (StoreClient.TryGetAddOn(Name, out addon))
            {
                string message  = StoreClient.GetConfirmationMessage(OperationType.Set, addon.AddOn, Plan);
                bool   purchase = CustomConfirmation.ShouldProcess(Resources.SetAddOnConformation, message);

                if (purchase)
                {
                    StoreClient.UpdateAddOn(Name, Plan, PromotionCode);
                    WriteVerbose(string.Format(Resources.AddOnUpdatedMessage, Name));

                    if (PassThru.IsPresent)
                    {
                        WriteObject(true);
                    }
                }
            }
        }
        public string AddCart(int itemId, int number)
        {
            string token = HttpContext.Session.GetString("token");

            if (string.IsNullOrWhiteSpace(token))
            {
                return("Please Login First");
            }
            string       username     = HttpContext.Session.GetString("username");
            ShoppingCart shoppingCart = new ShoppingCart
            {
                ItemId = itemId,
                Number = number
            };
            StoreClient         storeClient = new StoreClient(httpClientFactory.CreateClient());
            HttpResponseMessage result      = storeClient.AddCart(token, shoppingCart);

            if (result.IsSuccessStatusCode)
            {
                HttpContext.Session.SetString("token", result.Content.ReadAsStringAsync().Result);
                logger.LogInformation("User:"******" add item:" + itemId + " with number:" + number + " to cart");
                return("Add Success");
            }
            if (result.StatusCode == HttpStatusCode.BadRequest)
            {
                logger.LogError("User:"******" add item:" + itemId + " with number:" + number + " failed:out of stock");
                return("Out of Stock");
            }
            logger.LogError("User:"******" add item:" + itemId + " with number:" + number + " failed:" + result.StatusCode);
            return("Error");
        }
Exemple #3
0
        private void GetAddOn()
        {
            StoreClient = StoreClient ?? new StoreClient(CurrentSubscription);
            List <WindowsAzureAddOn> addOns = StoreClient.GetAddOn(new AddOnSearchOptions(Name, null, null));

            WriteObject(addOns, true);
        }
        public ActionResult Edit(StoreViewModel CVM, HttpPostedFileBase file)
        {
            StoreClient    CC = new StoreClient();
            StoreViewModel St = new StoreViewModel();

            St.store = CC.find(Convert.ToInt32(Session["userID"]));
            if (file == null)
            {
                CVM.store.Pictures = St.store.Pictures;
            }
            else
            {
                string ImageName    = Path.GetFileName(file.FileName);
                string physicalPath = Server.MapPath("~/Product_Images/" + ImageName);

                // save image in folder
                file.SaveAs(physicalPath);
                CVM.store.Pictures = ImageName;
            }
            CVM.store.Store_ID = St.store.Store_ID;
            CVM.store.UserID   = St.store.UserID;
            CC.Edit(CVM.store);

            return(RedirectToAction("Index"));
        }
Exemple #5
0
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(
                CurrentSubscription.SubscriptionId,
                ServiceEndpoint,
                CurrentSubscription.Certificate,
                text => this.WriteDebug(text),
                Channel);
            WindowsAzureAddOn addon;

            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            if (!StoreClient.TryGetAddOn(Name, out addon))
            {
                string message  = StoreClient.GetConfirmationMessage(OperationType.New, AddOn, Plan);
                bool   purchase = CustomConfirmation.ShouldProcess(Resources.NewAddOnConformation, message);

                if (purchase)
                {
                    StoreClient.NewAddOn(Name, AddOn, Plan, Location, PromotionCode);
                    WriteVerbose(string.Format(Resources.AddOnCreatedMessage, Name));
                    WriteObject(true);
                }
            }
            else
            {
                throw new Exception(string.Format(Resources.AddOnNameAlreadyUsed, Name));
            }
        }
        // GET: Seller/Stores
        public ActionResult Index()
        {
            StoreClient    CC  = new StoreClient();
            StoreViewModel CVM = new StoreViewModel();

            CVM.store = CC.find(Convert.ToInt32(Session["userID"]));
            return(View(CVM));
        }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchController" /> class.
 /// </summary>
 /// <param name="marketing">The marketing.</param>
 /// <param name="priceListClient">The price list client.</param>
 /// <param name="storeClient">The store client.</param>
 /// <param name="catalogClient">The catalog client.</param>
 /// <param name="searchFilter">The search filter.</param>
 public SearchController(MarketingHelper marketing, PriceListClient priceListClient, StoreClient storeClient,
                         CatalogClient catalogClient, ISearchFilterService searchFilter)
 {
     _marketing       = marketing;
     _priceListClient = priceListClient;
     _storeClient     = storeClient;
     _catalogClient   = catalogClient;
     _searchFilter    = searchFilter;
 }
        protected string ListBeverages()
        {
            List<object> returns = new List<object>();
            StoreClient client = new StoreClient();

            foreach (Beverage beverage in client.ListBeverages())
                returns.Add(new { Id = beverage.Id, Name = beverage.Name, Price = beverage.Price });

            return Newtonsoft.Json.JsonConvert.SerializeObject(returns.ToArray());
        }
        protected string ListDesserts()
        {
            List<object> returns = new List<object>();
            StoreClient client = new StoreClient();

            foreach (Dessert dessert in client.ListDesserts())
                returns.Add(new { Id = dessert.Id, Name = dessert.Name, Price = dessert.Price });

            return Newtonsoft.Json.JsonConvert.SerializeObject(returns.ToArray());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheService"/> class.
 /// </summary>
 /// <param name="cacheRepository">The cache repository.</param>
 /// <param name="outputCacheManager">The output cache manager.</param>
 /// <param name="storeClient"></param>
 /// <param name="sessionService"></param>
 public CacheService(ICacheRepository cacheRepository,
                     IReadWriteOutputCacheManager outputCacheManager,
                     ICustomerSessionService sessionService,
                     StoreClient storeClient) : this()
 {
     _cacheRepository    = cacheRepository;
     _outputCacheManager = outputCacheManager;
     _storeClient        = storeClient;
     _sessionService     = sessionService;
 }
        protected string ListPizzas()
        {
            List<object> returns = new List<object>();
            StoreClient client = new StoreClient();

            foreach (Pizza pizza in client.ListPizzas())
                returns.Add(new { Id = pizza.Id, Flavor = pizza.Flavor, Description = pizza.Description, Price = pizza.Price });

            return Newtonsoft.Json.JsonConvert.SerializeObject(returns.ToArray());
        }
Exemple #12
0
        private void StoreClient(StoreClient storeClient)
        {
            var clientStored = new ClientStored(storeClient.Id);

            Persist(clientStored, @event => {
                ClientStored(@event);
                SaveSnapshot();
                Sender.Tell(clientStored);
            });
        }
Exemple #13
0
        private void GetAddOn()
        {
            StoreClient = StoreClient ?? new StoreClient(
                CurrentSubscription.SubscriptionId,
                ServiceEndpoint,
                CurrentSubscription.Certificate,
                text => this.WriteDebug(text),
                Channel);
            List <WindowsAzureAddOn> addOns = StoreClient.GetAddOn(new AddOnSearchOptions(Name, null, null));

            WriteObject(addOns, true);
        }
Exemple #14
0
        public ActionResult Edit(int id)
        {
            var expenseDataClient = new ExpenseDataClient(_url);
            var model             = new ExpenseCalculatorViewModel();

            model.ExpenseTypes = expenseDataClient.GetExpenseTypes();
            var storeClient = new StoreClient();

            model.Stores       = storeClient.GetStores();
            model.ExpenseDatas = expenseDataClient.GetExpenseDetails(id);
            return(View("Edit", model));
        }
Exemple #15
0
        public ActionResult Index()
        {
            var model             = new ExpenseCalculatorViewModel();
            var expenseTypeClient = new ExpenseDataClient(_url);

            model.ExpenseTypes = expenseTypeClient.GetExpenseTypes();

            var storeClient = new StoreClient();

            model.Stores = storeClient.GetStores();

            return(View("Index", model));
        }
Exemple #16
0
        private void ListAvailableAddOns()
        {
            StoreClient       = StoreClient ?? new StoreClient(CurrentSubscription);
            MarketplaceClient = MarketplaceClient ??
                                new MarketplaceClient(StoreClient.GetLocations().Select(l => l.Name));

            WriteVerbose(Resources.GetAllAddOnsWaitMessage);
            List <WindowsAzureOffer> result         = MarketplaceClient.GetAvailableWindowsAzureOffers(Country);
            List <WindowsAzureOffer> knownProviders = result.Where <WindowsAzureOffer>(
                o => MarketplaceClient.IsKnownProvider(o.ProviderId)).ToList <WindowsAzureOffer>();

            WriteObject(knownProviders, true);
        }
Exemple #17
0
 public BazzasBazaarService(StoreClient storeClient, ILogger <BazzasBazaarService> logger)
 {
     _storeClient = storeClient;
     _logger      = logger;
     _retryPolicy = Policy
                    .Handle <Exception>()
                    .WaitAndRetryAsync(
         5,
         retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
         (exception, timeSpan, context) => {
         var methodThatRaisedException = context["methodName"];
         _logger.LogError("Exception in " + methodThatRaisedException + " " + exception + exception.StackTrace);
     });
 }
        /// <summary>
        /// Validates the items.
        /// </summary>
        private void ValidateItems()
        {
            var orderForms     = CurrentOrderGroup.OrderForms.ToArray();
            var lineItems      = orderForms.SelectMany(x => x.LineItems.ToArray());
            var validLineItems = lineItems.Where(x => !String.IsNullOrEmpty(x.CatalogItemId) && !x.CatalogItemId.StartsWith("@")).ToArray();

            string catalogId = null;

            // get the store and compare
            if (validLineItems.Any())
            {
                var store = new StoreClient(StoreRepository, CustomerSessionService, CacheRepository).GetStoreById(CurrentOrderGroup.StoreId);
                catalogId = store.Catalog;
            }

            if (!String.IsNullOrEmpty(catalogId))
            {
                var catalogHelper  = new CatalogClient(CatalogRepository, null, CustomerSessionService, CacheRepository, InventoryRepository);
                var catalogItemIds = (from i in validLineItems select i.CatalogItemId).ToArray();
                var items          = catalogHelper.GetItems(catalogItemIds);

                foreach (var lineItem in validLineItems)
                {
                    var item = items.SingleOrDefault(i => i.ItemId.Equals(lineItem.CatalogItemId, StringComparison.OrdinalIgnoreCase));

                    if (item != null && catalogHelper.GetItemAvailability(item.ItemId, lineItem.FulfillmentCenterId).IsAvailable)
                    {
                        //Inventory Info
                        if (item.TrackInventory)
                        {
                            var inventory = catalogHelper.GetItemInventory(lineItem.CatalogItemId, lineItem.FulfillmentCenterId);
                            PopulateInventoryInfo(inventory, lineItem);
                        }

                        //Variation Info
                        PopulateVariationInfo(item, lineItem);
                    }
                    else // remove item from the list
                    {
                        RemoveLineItem(lineItem);
                    }
                }
            }
            else // since no catalog is associated with a store, remove all items
            {
                RemoveAllLineItems();
            }
        }
Exemple #19
0
        public List <Product_table2> buildlistwcf(int listlen)
        {
            StoreClient           wcf     = new StoreClient();
            int                   getbyid = 1;
            List <Product_table2> list    = new List <Product_table2>();
            Product_table2        product_Table2;

            do
            {
                try
                {
                    bazzasbazaar.Product product = wcf.GetProductById(getbyid);
                    product_Table2 = new Product_table2()
                    {
                        ID                  = product.Id + listlen,
                        BrandId             = 0,
                        BrandName           = "No Brand",
                        CategoryId          = product.CategoryId,
                        CategoryName        = product.CategoryName,
                        Product_Description = product.Description,
                        Ean                 = product.Ean,
                        ExpectedRestock     = true,
                        Original_Price      = product.PriceForOne,
                        Price               = product.PriceForOne,
                        Product_Name        = product.Name
                    };
                    list.Add(product_Table2);
                    getbyid++;
                }
                catch (Exception e)
                {
                    if (e is NullReferenceException)
                    {
                        Console.WriteLine("End of WCF Service Reached");
                        break;
                    }
                    else
                    {
                        Console.WriteLine("An error occured while creating the list");
                        wcf.Close();
                        return(null);
                    }
                }
            } while (true);

            wcf.Close();
            return(list);
        }
        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);
        }
Exemple #21
0
        public IActionResult Index()
        {
            string token = HttpContext.Session.GetString("token");

            if (string.IsNullOrWhiteSpace(token))
            {
                return(RedirectToRoute(new { controller = "Login", action = "Index" }));
            }
            string                    username     = HttpContext.Session.GetString("username");
            StoreClient               storeClient  = new StoreClient(httpClientFactory.CreateClient());
            HttpResponseMessage       result       = storeClient.OrderList(token);
            string                    s            = result.Content.ReadAsStringAsync().Result;
            IEnumerable <OrderDetail> orderDetails = JsonConvert.DeserializeObject <IEnumerable <OrderDetail> >(s);

            logger.LogInformation("User:"******" viewed order list");
            return(View(orderDetails));
        }
Exemple #22
0
        private async Task MessageReceivedAsync(
            IDialogContext context,
            IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            if (message.AsMessageActivity() == null)
            {
                context.Wait(this.MessageReceivedAsync);

                return;
            }

            var apiClient = new StoreClient();
            var user      = await apiClient.FindUser(message.Text);

            await user.Match(
                async _ =>
            {
                await context.PostAsync(
                    $"Please, enter code we've sent to your phone number to confirm your identity.");

                context.Call(
                    new EnterVerificationCode(_),
                    this.AfterVerificationCodeEntered);
            },
                async() =>
            {
                --attempts;

                if (attempts > 0)
                {
                    await context.PostAsync(
                        $"Sorry, I cannot find you in our database. " +
                        $"Probably, you've entered number wrong. " +
                        $"Please, check your number for spelling errors.");

                    context.Wait(this.MessageReceivedAsync);
                }
                else
                {
                    context.Done(Option.None <User>());
                }
            });
        }
Exemple #23
0
        public override void ExecuteCmdlet()
        {
            StoreClient        = StoreClient ?? new StoreClient(CurrentContext.Subscription);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            string message = StoreClient.GetConfirmationMessage(OperationType.Remove);
            bool   remove  = CustomConfirmation.ShouldProcess(Resources.RemoveAddOnConformation, message);

            if (remove)
            {
                StoreClient.RemoveAddOn(Name);
                WriteVerbose(string.Format(Resources.AddOnRemovedMessage, Name));
                if (PassThru.IsPresent)
                {
                    WriteObject(true);
                }
            }
        }
Exemple #24
0
        public IActionResult Index()
        {
            string token = HttpContext.Session.GetString("token");
            IEnumerable <ShoppingCart> shoppingCarts = null;

            if (string.IsNullOrWhiteSpace(token))
            {
                return(View(shoppingCarts));
            }
            string              username    = HttpContext.Session.GetString("username");
            StoreClient         storeClient = new StoreClient(httpClientFactory.CreateClient());
            HttpResponseMessage result      = storeClient.ShowCart(token);
            string              s           = result.Content.ReadAsStringAsync().Result;

            shoppingCarts = JsonConvert.DeserializeObject <IEnumerable <ShoppingCart> >(s);
            logger.LogInformation("User:"******" viewed cart");
            return(View(shoppingCarts));
        }
Exemple #25
0
        static void Main(string[] args)
        {
            const string baseUrl    = "http://localhost:59801/";
            IRestClient  restClient = new RestClient()
            {
                BaseUrl = new Uri(baseUrl)
            };

            var storeClient = new StoreClient(restClient);
            var items       = storeClient.GetItems();

            var firstItem  = storeClient.GetItem(1);
            var secondItem = storeClient.GetItem(2);

            long newOrderId = storeClient.CreateOrder();
            var  newOrder   = storeClient.GetOrder(newOrderId);

            newOrderId = storeClient.CreateOrder();
            var oneMoreOrder = storeClient.GetOrder(newOrderId);

            var orders = storeClient.GetOrders();

            newOrder.QuantityByItemId = new Dictionary <long, int>()
            {
                { 1, 11 }, { 2, 22 }
            };
            var orderUpdated = storeClient.PatchOrder(newOrder);

            storeClient.DeleteOrder(newOrderId);
            orders = storeClient.GetOrders();

            newOrderId = storeClient.CreateOrder();
            newOrder   = storeClient.GetOrder(newOrderId);

            storeClient.AddQuantityToOrder(firstItem, newOrder, 7);
            storeClient.AddQuantityToOrder(secondItem, newOrder, 3);

            orders = storeClient.GetOrders();

            storeClient.UpdateQuantityInOrder(firstItem, newOrder, 77);

            orders = storeClient.GetOrders();
        }
        public IActionResult Index(int id)
        {
            StoreClient         storeClient = new StoreClient(httpClientFactory.CreateClient());
            HttpResponseMessage result      = storeClient.Item(id);

            if (result.IsSuccessStatusCode)
            {
                string s        = result.Content.ReadAsStringAsync().Result;
                Item   item     = JsonConvert.DeserializeObject <Item>(s);
                string username = HttpContext.Session.GetString("username");
                if (!string.IsNullOrWhiteSpace(username))
                {
                    logger.LogInformation("User:"******" viewed item:" + id + " " + item.Name);
                }
                return(View(item));
            }
            logger.LogError("item:" + id + " not found");
            return(new NotFoundResult());
        }
Exemple #27
0
        static void Main(string[] args)
        {
            var channel = new Channel("127.0.0.1:50052", ChannelCredentials.Insecure);
            var client  = new StoreClient(new Store.StoreClient(channel));

            // Look for a valid beer
            client.GetItem("Stout", "Mocha Merlin", "Firestone Walker Brewing Company");

            // Look for an beer which doesn't exist
            client.GetItem("IPA", "90 Minute IPA", "Dogfish Head");

            // Look for a list of stores which sells a valid beer
            client.ListStores("Stout", "Mocha Merlin", "Firestone Walker Brewing Company").Wait();

            // Create Beer objects to get a total cost
            List <Beer> beers = new List <Beer>()
            {
                new Beer()
                {
                    Style = "Stout", Name = "Mocha Merlin", Brewery = "Firestone Walker Brewing Company"
                },
                new Beer()
                {
                    Style = "Stout", Name = "Chicory Stout", Brewery = "Dogfish Head"
                },
                new Beer()
                {
                    Style = "Imperial IPA", Name = "Fake Beer", Brewery = "My Awesome Brewing Company"
                },
                new Beer()
                {
                    Style = "Imperial IPA", Name = "Double Trouble IPA", Brewery = "Founders Brewing Company"
                }
            };

            client.GetTotalCost(beers).Wait();

            client.GetEachItemCost(beers).Wait();

            channel.ShutdownAsync().Wait();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Exemple #28
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            var info = new StoreInfo();

            info.Code     = TxtCode.Text;
            info.Password = TxtPassword.Text;
            info.IP       = System.Environment.MachineName;
            string Msg = string.Empty;

            info = new StoreClient().Login(info, out Msg);
            if (null == info)
            {
                MessageBox.Show(Msg);
                return;
            }
            info.Password = string.Empty;
            var JsonText = Newtonsoft.Json.JsonConvert.SerializeObject(info);

            Tool.DocHelper.Write(System.IO.Directory.GetCurrentDirectory() + "/登录信息", JsonText);
            this.Close();
        }
Exemple #29
0
        static void Main(string[] args)
        {
            var client = new StoreClient();

            var result = client.AddNewBook(new Book()
            {
                ID = 1, Author = "Ando", Price = 10.5, Title = "Title", Year = 2015
            });

            Console.WriteLine(result.Message);

            result = client.GetAllBooks();

            Console.WriteLine(result.Message);

            result = client.UpdateBookPrice(1, 20);

            Console.WriteLine(result.Message);

            Console.WriteLine(result.Books[0].Price);
        }
Exemple #30
0
        public IActionResult Index(string username, string password)
        {
            if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
            {
                return(View());
            }
            User user = new User
            {
                Username = username,
                Password = password
            };
            StoreClient    storeClient = new StoreClient(httpClientFactory.CreateClient());
            HttpStatusCode result      = storeClient.Register(user);

            if (result == HttpStatusCode.Created)
            {
                logger.LogInformation("User:"******" registered");
                return(RedirectToRoute(new { controller = "Login", action = "Index" }));
            }
            logger.LogError("User:"******" register failed:" + result);
            return(View());
        }
        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);
        }
Exemple #32
0
        private void SendStoreItem(ListViewItem item)
        {
            StoreFailure failure = item.Tag as StoreFailure;

            using (ProgressDialog progress = new ProgressDialog())
            {
                progress.Title         = "Retrying";
                progress.CancelMessage = "Please wait...";
                progress.Line1         = failure.Dataset.GetValue <string>(DicomTag.PatientName, string.Empty) + "(" + failure.Dataset.GetValue <string>(DicomTag.StudyID, string.Empty) + ")";
                progress.ShowDialog(this, DialogFlags.Modal | DialogFlags.NoMinimize | DialogFlags.AutoTime | DialogFlags.NoProgressBar);
                foreach (ResendServer server in failure.Scps.ToArray())
                {
                    string status = string.Empty;

                    progress.Line2         = server.Scp.AETitle + " - " + server.IPAddress + ":" + server.Scp.Port.ToString();
                    server.Scp.PeerAddress = IPAddress.Parse(server.IPAddress);
                    if (!StoreClient.Store(ProcessorConfiguration.Settings.AETitle, server.Scp, failure.Dataset, ref status))
                    {
                        UpdateServerStatus(server, status);
                    }
                    else
                    {
                        failure.Scps.Remove(server);
                        RemoveServer(server);
                    }
                }
            }

            if (failure.Scps.Count > 0)
            {
                failure.Save();
            }
            else
            {
                listViewDatasets.Items.Remove(item);
                failure.Delete();
            }
        }
Exemple #33
0
        public IActionResult Index(string id)
        {
            string token = HttpContext.Session.GetString("token");

            if (string.IsNullOrWhiteSpace(token))
            {
                return(RedirectToRoute(new { controller = "Login", action = "Index" }));
            }
            string              username    = HttpContext.Session.GetString("username");
            StoreClient         storeClient = new StoreClient(httpClientFactory.CreateClient());
            HttpResponseMessage result      = storeClient.OrderDetail(token, id);

            if (result.IsSuccessStatusCode)
            {
                string      s           = result.Content.ReadAsStringAsync().Result;
                OrderDetail orderDetail = JsonConvert.DeserializeObject <OrderDetail>(s);
                HttpContext.Session.SetString("token", orderDetail.User.Password);
                logger.LogInformation("User:"******" viewed order:" + id);
                return(View(orderDetail));
            }
            logger.LogError("Order:" + id + " not found for user:" + username);
            return(new NotFoundResult());
        }
 public static StoreClient CreateStoreClient(this CommerceClients source, string serviceUrl, string appId, string secretKey)
 {
     var client = new StoreClient(new Uri(serviceUrl), appId, secretKey);
     return client;
 }
 public static StoreClient CreateStoreClient(this CommerceClients source, string serviceUrl)
 {
     var client = new StoreClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());
     return client;
 }