コード例 #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());
            }
        }
コード例 #2
0
 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
ファイル: pgOrder.xaml.cs プロジェクト: winnermaker/Musicshop
        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";
            }
        }
コード例 #4
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
ファイル: pgOrder.xaml.cs プロジェクト: winnermaker/Musicshop
 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"));
 }
コード例 #7
0
 private void RunUsed(clsAllInstruments prInstrument)
 {
     ctcNewUsed.Content = new ucInstrumentUsed();
 }
コード例 #8
0
 private void RunNew(clsAllInstruments prInstrument)
 {
     ctcNewUsed.Content = new ucInstrmentNew();
 }
コード例 #9
0
 private void DispatchWorkContent(clsAllInstruments prInstrument)
 {
     _InstrumentsControl[prInstrument.InstrumentType].DynamicInvoke(prInstrument);
     updatePage(prInstrument);
 }
コード例 #10
0
 public void UpdateControl(clsAllInstruments prInstrument)
 {
     txtManufacturer.Text = prInstrument.Manufacturer;
 }