private void cmdRequest_Click(object sender, EventArgs e) { if (proxy == null || proxy.State != System.ServiceModel.CommunicationState.Opened) { proxy = new PharmacyClient("PharmacyServiceEndpoint"); } PharmacyService.Customer customer = new PharmacyService.Customer(); customer.FirstName = txtFirstName.Text; customer.LastName = txtLastName.Text; customer.CustomerID = Guid.Parse(lblCustomerID.Text); PharmacyService.GetBaseCost request = new PharmacyService.GetBaseCost(); request.Customer = customer; request.Drug = txtDrug.Text; try { PharmacyService.Order order = proxy.GetBaseCost(request); if (order != null) { lblOrderID.Text = order.OrderID.ToString(); lblBaseCost.Text = "$" + order.Cost.ToString(); txtFirstName.Enabled = false; txtLastName.Enabled = false; txtDrug.Enabled = false; } } catch { MessageBox.Show("Please make sure to call the operations in the correct order: \nGet both the BaseCost and InsuranceCoverage before trying to retrieve the AdjustedCost", "Invalid Operation"); } }
private void cmdRequest_Click(object sender, EventArgs e) { if (proxy == null || proxy.State != System.ServiceModel.CommunicationState.Opened) proxy = new PharmacyClient("PharmacyServiceEndpoint"); PharmacyService.Customer customer = new PharmacyService.Customer(); customer.FirstName = txtFirstName.Text; customer.LastName = txtLastName.Text; customer.CustomerID = Guid.Parse(lblCustomerID.Text); PharmacyService.GetBaseCost request = new PharmacyService.GetBaseCost(); request.Customer = customer; request.Drug = txtDrug.Text; try { PharmacyService.Order order = proxy.GetBaseCost(request); if (order != null) { lblOrderID.Text = order.OrderID.ToString(); lblBaseCost.Text = "$" + order.Cost.ToString(); txtFirstName.Enabled = false; txtLastName.Enabled = false; txtDrug.Enabled = false; } } catch { MessageBox.Show("Please make sure to call the operations in the correct order: \nGet both the BaseCost and InsuranceCoverage before trying to retrieve the AdjustedCost", "Invalid Operation"); } }