/// <summary> /// Get the information from the user input /// and save it into a object to creat the quote /// </summary> /// <returns></returns> private DeskQuote getDeskQuoteFromInput() { // get customer name and desk from input string customerName = this.customerName.Text; Desk desk = getDeskFromInput(); // get shipping from input and convert to enum string shippingStr = this.delivery.SelectedItem.ToString(); Shipping shipping = EnumHelpers.GetValueFromDescription <Shipping>(shippingStr); // get current date DateTime date = DateTime.Today; return(new DeskQuote(customerName, shipping, desk, date)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddQuote_Load(object sender, EventArgs e) { // Fill "material" dropdown with enum values material.DataSource = Enum.GetValues(typeof(SurfaceMaterial)); material.SelectedItem = SurfaceMaterial.Pine; // Fill "shipping" dropdown with enum values // Make list of shipping descriptions List <string> shippingDescriptions = new List <string>(); foreach (int shippingOption in Shipping.GetValues(typeof(Shipping))) { shippingDescriptions.Add(EnumHelpers.GetDescription <Shipping>((Shipping)shippingOption)); } delivery.DataSource = shippingDescriptions; delivery.SelectedItem = EnumHelpers.GetDescription <Shipping>(Shipping.NoRush); }