Example #1
0
        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;
        }
Example #2
0
 void OnCardReceived(string uid)
 {
     var ignored = this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         IgniteDataServices.SetLocatedProduct(uid);
         this.ViewModel.Update();
     });
 }
Example #3
0
        public CheckoutViewModel()
        {
            // Ideally, both customer and item should be recognized somehow, but here
            // intialize with unrecognized customer and default located product
            ItemGiveaway = new ProductViewModel();
            Product locatedProd = IgniteDataServices.GetLocatedProduct();

            ItemGiveaway.Reset(locatedProd, 1);  // one item at a time please
            TotalItems     = 1;
            ProductChoices = new ObservableCollection <Product>(ProductCatalog.Instance.Products);
            //  Limit choices to similar items
            //ProductChoices = new ObservableCollection<Product>(from prod in ProductCatalog.Instance.Products
            //                                                   where prod.ProductHierarchyName == locatedProd.ProductHierarchyName
            //                                                   select prod);
        }
Example #4
0
        private CustomerRegistrationInfo customerRegistrationInfo; // obtained form registration UI
        public void UpdateCustomer(CustomerRegistrationInfo info)
        {
            customerRegistrationInfo = info;

            if (info != null && info.CustomerName.Length > 0)
            {
                customerInfo = IgniteDataAccess.GetCustomerInfo(info.CustomerFaceHash);

                if (customerInfo == null)  // first visit
                {
                    IsRecognized       = true;
                    IsUnrecognized     = false;
                    CustomerName       = info.CustomerName;
                    VisitDateStr       = "";
                    PreviousPurchase   = "";
                    RecommendedActions = IgniteDataServices.GetRecommendedActions(customerInfo);

                    IsWarningNoCheckout = true;  // we want to avoid having registered customers without transactions
                }
                else  // second visit
                {
                    IsRecognized       = true;
                    IsUnrecognized     = false;
                    CustomerName       = customerInfo.CustomerName;
                    VisitDateStr       = customerInfo.PreviousVisitDate.ToString("MM/dd/yyyy");
                    PreviousPurchase   = ProductCatalog.Instance.GetProductById(customerInfo.SourceItemId).ItemDescription;
                    RecommendedActions = IgniteDataServices.GetRecommendedActions(customerInfo);
                }
            }
            else
            {
                customerInfo       = null;
                IsRecognized       = false;
                IsUnrecognized     = true;
                CustomerName       = "";
                VisitDateStr       = "";
                PreviousPurchase   = "";
                RecommendedActions = "";
            }
        }
        private async void OnResetCustomerCounterClicked(object sender, RoutedEventArgs e)
        {
            int resetVal = Util.ToIntSafely(SettingsHelper.Instance.CustomerCounterResetValue, 0);

            await IgniteDataServices.ResetCustomerCounter(resetVal);
        }
 public void Update()
 {
     FaqUri = new System.Uri(IgniteDataServices.GetLocatedProduct().ProductFaqSrc);
 }