示例#1
0
        internal static async Task <string> DeleteInstrumentAsync(clsAllInstruments prInstrument)
        {
            using (HttpClient lcHttpClient = new HttpClient())
            {
                HttpResponseMessage lcRespMessage = await lcHttpClient.DeleteAsync
                                                        ($"http://localhost:60065/api/shop/DeleteInstrument?SerialNo={prInstrument.SerialNo}");

                return(await lcRespMessage.Content.ReadAsStringAsync());
            }
        }
 private void updatePage(clsAllInstruments prInstrument)
 {
     _Instrument        = prInstrument;
     txtInstrument.Text = _Instrument.InstrumentName.EmptyIfNull();
     txtPrice.Text      = _Instrument.Price.ToString().EmptyIfNull();
     txtTuning.Text     = _Instrument.Tuning.EmptyIfNull();
     (ctcNewUsed.Content as IInstrumentControl).UpdateControl(prInstrument);
     if (_Instrument.Quantity == 0)
     {
         btnOrder.IsEnabled = false;
         txtMessage.Text    = "Sorry - this instrument is out of Stock";
     }
 }
示例#3
0
        private async void BtnOrder_Click(object sender, RoutedEventArgs e)
        {
            if (Convert.ToInt16(txtOrderQuantity.Text) != 0 && txtCustName.Text != "" && txtCustPhone.Text != "" && txtCustMail.Text != "") {
                try
                {
                    if (await Customer.ServiceClient.UpdateInstrumentTestAsync(_Instrument) == "\"Instrument changed in DB\"")
                    {
                        _Instrument = await Customer.ServiceClient.GetInstrumentAsync(_Instrument.SerialNo);
                        UpdateDisplay();
                        txtMessage.Text = "Instrument changed - Please try your order again";
                    }
                    else
                    {
                        MessageDialog dialog = new MessageDialog("Do you want to confirm your Order?", "Confirm Order");
                        dialog.Commands.Add(new UICommand("Yes", null));
                        dialog.Commands.Add(new UICommand("No", null));
                        var result = await dialog.ShowAsync();

                        if (result.Label == "Yes")
                        {
                            try
                            {
                                pushData();

                                await Customer.ServiceClient.UpdateInstrumentAsync(_Instrument);
                                await Customer.ServiceClient.InsertOrderAsync(_Order);
                                UpdateDisplay();
                                txtMessage.Text = "Order placed";
                            }

                            catch (Exception)
                            {
                                txtMessage.Text = "An Error Occured";
                            }
                        }

                    }
                }
                catch (Exception)
                {
                    txtMessage.Text = "An Error Occured";
                }
            }
            else
            {
                txtMessage.Text = "At least one Field is empty or Quantity is 0";
            }
        }
        public void UpdateControl(clsAllInstruments prInstrument)
        {
            switch (prInstrument.MyCondition)
            {
            case "As New":
                rbtnNew.IsChecked = true;
                break;

            case "Poor":
                rbtnPoor.IsChecked = true;
                break;

            default:
                rbtnAverage.IsChecked = true;
                break;
            }
        }
示例#5
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     _Instrument = (clsAllInstruments)e.Parameter;
 }
示例#6
0
 internal static async Task <string> UpdateInstrumentTestAsync(clsAllInstruments prInstrument)
 {
     return(await InsertOrUpdateAsync(prInstrument, "http://localhost:60065/api/shop/PutInstrumentTest", "PUT"));
 }
 private void RunUsed(clsAllInstruments prInstrument)
 {
     ctcNewUsed.Content = new ucInstrumentUsed();
 }
 private void RunNew(clsAllInstruments prInstrument)
 {
     ctcNewUsed.Content = new ucInstrmentNew();
 }
 private void DispatchWorkContent(clsAllInstruments prInstrument)
 {
     _InstrumentsControl[prInstrument.InstrumentType].DynamicInvoke(prInstrument);
     updatePage(prInstrument);
 }
示例#10
0
 public void UpdateControl(clsAllInstruments prInstrument)
 {
     txtManufacturer.Text = prInstrument.Manufacturer;
 }