public AddQuote() { InitializeComponent(); //load date DateTime dateTime = DateTime.Now; labDate.Text = dateTime.ToString("dd MMMM yyyy"); ///SURFACE MATERIAL DROP DOWN //Create array of enumerated SurfaceMaterial types from DeskQuote.cs, then cast to list List <SurfaceMaterial> materials = Enum.GetValues(typeof(SurfaceMaterial)) .Cast <SurfaceMaterial>().ToList(); //Populate surface material drop down with the list above comSurfaceMaterial.DataSource = materials; //Set default value of surface material to null comSurfaceMaterial.SelectedIndex = -1; //DELIVERY OPTION DROP DOWN //Create array of enum description strings List <string> shipDescs = new List <string>(); for (int i = 0; i < 4; i++) { string shipDesc = DeskQuote.GetEnumDescription((Shipping)i); shipDescs.Add(shipDesc); } comDeliveryOption.DataSource = shipDescs; //set drop down value to NoRush by default comDeliveryOption.SelectedIndex = 3; /////////////////////////OLD CODE/////////////////////////////////////////////////////////////////////// //List<Shipping> shopping = Enum.GetValues(typeof(Shipping)) // .Cast<Shipping>().ToList(); //comDeliveryOption.DataSource = shopping; ////set drop down value to NoRush by default //comDeliveryOption.SelectedIndex = 3; //////////////////////////////////////////////////////////////////////////////////////////////////////// //Replaces minimum accepted values in width depth and drawer fields with empty strings widthNum.Text = String.Empty; depthNum.Text = String.Empty; drawerNum.Text = String.Empty; //Set base price automatically, y'know, cuz its the base price lbBasePrice.Text = "" + _basePrice; //Disables Get Quote button, is enabled once all inputs have been verified btnGetQuote.Enabled = false; }
public DisplayQuote(DeskQuote deskQuote) { InitializeComponent(); //Populate all labels on DisplayQuote lbName.Text = "" + deskQuote.CustomerName; DateTime dateTime = DateTime.Now; lbDate.Text = dateTime.ToString("dd MMMM yyyy"); lbWidth.Text = "" + deskQuote.Desk.Width; lbDepth.Text = "" + deskQuote.Desk.Depth; lbDrawer.Text = "" + deskQuote.Desk.NumberofDrawer; lbMaterial.Text = "" + deskQuote.Desk.SurfaceMaterial; lbDelivery.Text = "" + deskQuote.Shipping; lbArea.Text = "" + deskQuote.Desk.GetArea(); lbBasePrice.Text = "" + deskQuote.GetBasePrice(); lbAreaPrice.Text = "" + deskQuote.GetAreaPrice(); lbDrawerPrice.Text = "" + deskQuote.GetDrawerPrice(); lbMaterialPrice.Text = "" + deskQuote.GetMaterialPrice(deskQuote.Desk.SurfaceMaterial); lbShippingPrice.Text = "" + deskQuote.GetShipping((int)deskQuote.Shipping); lbTotalPrice.Text = "" + deskQuote.GetQuotePrice(deskQuote.Desk.SurfaceMaterial, (int)deskQuote.Shipping); }