protected void Page_Load(object sender, EventArgs e) { customers = client.GetCustomers().ToList(); parts = client.GetItems().ToList(); if (!IsPostBack) { CustomerDropDownList.DataSource = customers; CustomerDropDownList.DataTextField = "Name"; CustomerDropDownList.DataValueField = "ID"; CustomerDropDownList.DataBind(); PartDropDownList1.DataSource = parts; PartDropDownList1.DataTextField = "Description"; PartDropDownList1.DataValueField = "ID"; PartDropDownList1.DataBind(); PartDropDownList1.Items.Add("-"); PartDropDownList1.SelectedValue = "-"; } }
protected void Page_Load(object sender, EventArgs e) { quote = client.GetQuote(Convert.ToInt32(Request.QueryString["quote"])); QuoteNumberLabel.Text = quote.ID.ToString(); customers = client.GetCustomers().ToList(); parts = client.GetItems().ToList(); if (!IsPostBack) { CustomerDropDownList.DataSource = customers; CustomerDropDownList.DataTextField = "Name"; CustomerDropDownList.DataValueField = "ID"; CustomerDropDownList.DataBind(); CustomerDropDownList.SelectedValue = quote.CustomerID.ToString(); PartDropDownList1.DataSource = parts; PartDropDownList1.DataTextField = "Description"; PartDropDownList1.DataValueField = "ID"; PartDropDownList1.DataBind(); PartDropDownList1.SelectedValue = quote.Items[0].ID.ToString(); QuantityTextBox1.Text = quote.Items[0].Quantity.ToString(); LabourPriceTextBox.Text = quote.LabourPrice.ToString(); LabourTextArea.InnerText = quote.ServiceDescription; ETALabel.Text = quote.PartsETA.ToShortDateString(); for (int i = 0; i < statusNames.Length; i++) { ListItem item = new ListItem(Convert.ToString(statusNames.GetValue(i)), Convert.ToString(i)); StatusDropDownList.Items.Add(item); } StatusDropDownList.SelectedValue = Convert.ToInt32(quote.Status).ToString(); } #region Display appropriate LinkButtons switch (quote.Status) { case SalesSvc.StatusCode.New: ApproveLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedCheckStock: CheckStockLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedBookService: BookLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedNotInStock: GetETALinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ETAPendingApproval: ApproveLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedETA: BookLinkButton.Visible = true; BookLinkButton.Text = "Book & send purchase order"; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.Booked: RejectLinkButton.Visible = true; break; default: break; } #endregion }