示例#1
0
        private async void updateDisplayOnDatabaseChanage()
        {
            _DatabaseProduct = await ServiceClient.GetProductAsync(_CustomerProduct.DVDName);

            if (_DatabaseProduct.QuanityInStock >= 1)
            {
                btnBuy.IsEnabled = true;
            }
            else
            {
                btnBuy.IsEnabled = false;
                lblError.Text    = "We are Currently Out Of Stock Please Check Back Later";
            }
            if (_DatabaseProduct.QuanityInStock < _CustomerProduct.QuanityOrdered)
            {
                btnBuy.IsEnabled = false;
                lblError.Text    = "You Are Trying To Order More Than We Have In Stock. Please Go Back And Change " +
                                   "The Quanity You Wish Or Order To Match Or Be Less Than We Have In Stock";
            }
            else
            {
                btnBuy.IsEnabled = true;
            }
            updateDisplay();
        }
示例#2
0
        private async System.Threading.Tasks.Task ErrorCheckingStockAvalibility(NavigationEventArgs e)
        {
            _CustomerProduct = e.Parameter as clsProducts;
            _DatabaseProduct = await ServiceClient.GetProductAsync(_CustomerProduct.DVDName);

            if (_DatabaseProduct.QuanityInStock >= 1)
            {
                btnBuy.IsEnabled = true;
            }
            else
            {
                btnBuy.IsEnabled = false;
                lblError.Text    = "We are Currently Out Of Stock Please Check Back Later";
            }
            if (_DatabaseProduct.QuanityInStock < _CustomerProduct.QuanityOrdered)
            {
                btnBuy.IsEnabled = false;
                lblError.Text    = "You Are Trying To Order More Than We Have In Stock. Please Go Back And Change " +
                                   "The Quanity You Wish Or Order To Match Or Be Less Than We Have In Stock";
            }
            else
            {
                btnBuy.IsEnabled = true;
            }
            updateDisplay();
        }
示例#3
0
 //Error Check Customer Input Fields
 private async void BtnBuy_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(txtName.Text) || string.IsNullOrWhiteSpace(txtName.Text))
     {
         lblError.Text = "Please Enter Your Name";
     }
     else
     {
         if (string.IsNullOrEmpty(txtAddress.Text) || string.IsNullOrWhiteSpace(txtAddress.Text))
         {
             lblError.Text = "Please Enter Your Address";
         }
         else
         {
             if (string.IsNullOrEmpty(txtPhoneNumber.Text) || string.IsNullOrWhiteSpace(txtPhoneNumber.Text))
             {
                 lblError.Text = "Please Enter Your PhoneNumber";
             }
             else
             {
                 MessageDialog lcMessageBox = new MessageDialog("Confirm Order?");
                 lcMessageBox.Commands.Add(new UICommand("Yes", async x =>
                 {
                     _DatabaseProduct = await ServiceClient.GetProductAsync(_CustomerProduct.DVDName);
                     if (_DatabaseProduct.QuanityInStock != _CustomerProduct.QuanityInStock)
                     {
                         MessageDialog lcCheckDatabaseForChanage = new MessageDialog("Stock On Hand Has Changed. The Form Will Now Refresh");
                         lcCheckDatabaseForChanage.Commands.Add(new UICommand("Reload", async z =>
                         {
                             int lcCustomerQuanityOrdered;
                             lcCustomerQuanityOrdered        = _CustomerProduct.QuanityOrdered;
                             _CustomerProduct                = await ServiceClient.GetProductAsync(_DatabaseProduct.DVDName);
                             _CustomerProduct.QuanityOrdered = lcCustomerQuanityOrdered;
                             updateDisplayOnDatabaseChanage();
                         }));
                         await lcCheckDatabaseForChanage.ShowAsync();
                     }
                     else
                     {
                         pushData();
                         await ServiceClient.CreateOrder(_Order);
                         _CustomerProduct = await ServiceClient.GetProductAsync(_Order.ProductName);
                         _CustomerProduct.QuanityInStock = _CustomerProduct.QuanityInStock - _Order.Quanity;
                         await ServiceClient.UpdateQuanityInStock(_CustomerProduct);
                         MessageDialog lcConfirmOrder = new MessageDialog("Thank You Your Order Has Been Placed. We Will Now Redirect You Back To The Main Screen");
                         lcConfirmOrder.Commands.Add(new UICommand("OK", y =>
                         {
                             Frame.Navigate(typeof(pgCustomerPanel));
                         }));
                         await lcConfirmOrder.ShowAsync();
                     }
                 }));
                 lcMessageBox.Commands.Add(new UICommand("No"));
                 await lcMessageBox.ShowAsync();
             }
         }
     }
 }
示例#4
0
 private void updatePage(clsProducts prProduct)
 {
     _Products                   = prProduct;
     lblDVDName.Text             = _Products.DVDName.EmptyIfNull();
     lblDescriptionResult.Text   = _Products.Description.ToString();
     lblQuanityOnHandResult.Text = _Products.QuanityInStock.ToString();
     lblPriceResult.Text         = _Products.Price.ToString();
     lblTypeResult.Text          = _Products.DVDType.ToString();
     (ctcProductSpecs.Content as
      IWorkControl).UpdateControl(prProduct);
 }
示例#5
0
 public void UpdateControl(clsProducts prProduct)
 {
 }
示例#6
0
 public void PushData(clsProducts prProduct)
 {
     //Not Needed
     prProduct.QuanityOrdered = Convert.ToInt32(txtQuanity.Text);
 }
示例#7
0
 private void dispatchProductContent(clsProducts prProduct)
 {
     _ProductContent[prProduct.DVDType].DynamicInvoke(prProduct);
     updatePage(prProduct);
 }
示例#8
0
 private void RunUsed(clsProducts prProduct)
 {
     ctcProductSpecs.Content = new ucUsed();
 }
示例#9
0
 private void RunNew(clsProducts prProduct)
 {
     ctcProductSpecs.Content = new ucNew();
 }
示例#10
0
 internal async static Task <string> UpdateQuanityInStock(clsProducts prProduct)
 {
     return(await InsertOrUpdateAsync(prProduct, "http://localhost:60064/api/admin/UpdateQuanityInStock", "PUT"));
 }
示例#11
0
 public void UpdateControl(clsProducts prProduct)
 {
     lblConditionResult.Text = prProduct.DVDCondition.ToString();
     //txtQuanity.Text = prProduct.QuanityOrdered.ToString();
 }
示例#12
0
 public void PushData(clsProducts prProduct)
 {
     prProduct.DVDCondition   = lblCondition.Text.ToString();
     prProduct.QuanityOrdered = Convert.ToInt32(txtQuanity.Text);
 }