public void Checkout() { if (customerInfo == null) // no previous transactions { if (customerRegistrationInfo == null) // unregistered customer { IgniteDataAccess.CreateNewTransaction(ItemGiveaway.ItemId, ItemGiveaway.ProductQty, IgniteDataAccess.UNREGISTERED_CUSTOMERID); } else { IgniteDataAccess.CreateNewTransaction(ItemGiveaway.ItemId, ItemGiveaway.ProductQty, customerRegistrationInfo.CustomerFaceHash); } } else { IgniteDataAccess.CreateNewTransaction(ItemGiveaway.ItemId, ItemGiveaway.ProductQty, customerInfo.CustomerFaceHash); } // TODO: report transaction success status // Prepare for the next customer UpdateCustomer(null); ItemGiveaway.Reset(IgniteDataServices.GetLocatedProduct(), 1); TotalItems = 1; IsWarningNoCheckout = false; }
private void OnTestBackendFlyoutOpened(object sender, object e) { try { // Run DB tests var customers = IgniteDataAccess.GetCustomers(); string testGetCustomers = (customers != null) ? customers.Count.ToString() : "FAIL"; string unregCustomerGuid = "00000000-0000-0000-0000-000000000000"; bool createCustomerRes = IgniteDataAccess.CreateCustomerRecord(unregCustomerGuid, "UNREGISTERED"); string testCreateCustomerRecord = createCustomerRes ? "OK" : "FAIL"; bool createNewTransactionRes = IgniteDataAccess.CreateNewTransaction(11110, 1, unregCustomerGuid); string testCreateNewTransaction = createNewTransactionRes ? "OK" : "FAIL"; var customerInfo = IgniteDataAccess.GetCustomerInfo(unregCustomerGuid); string testGetCustomerInfo = (customerInfo?.CustomerName == "UNREGISTERED" && customerInfo?.SourceItemId == 11110) ? "OK" : "FAIL"; var inventoryStats = IgniteDataAccess.GetInventoryStats(); string testGetInventoryStats = "FAIL"; foreach (InventoryItemStats iist in inventoryStats) { if (iist.ItemId == 11110) { testGetInventoryStats = iist.RemainingInventory.ToString(); } } this.backendTestResultTextBox.Text = $"GetCustomers.Count: {testGetCustomers}\n" + $"CreateCutomerRecord: {testCreateCustomerRecord}\n" + $"CreateNewTransaction: {testCreateNewTransaction}\n" + $"GetCustomerInfo: {testGetCustomerInfo}\n" + $"GetInventoryStats.RemainingInventory: {testGetInventoryStats}"; } catch (Exception ex) { this.backendTestResultTextBox.Text = $"Exception: {ex.Message}"; } }