protected void OrderButton_Click(object sender, EventArgs e) { //obtain personal details DTO.Customer current_customer = ObtainCustomer(); if (current_customer == null) { return; } DTO.Order current_order = (DTO.Order)ViewState["current_order"]; current_order.cost = Domain.OrderManager.CalculateAmountOwing(current_order); current_order.payment_type = GetPaymentType(); try { Domain.OrderManager.AddOrder(current_order, current_customer); } catch (Exception ex) { throw ex; } Response.Redirect("Success.aspx"); }
private DTO.Customer ObtainCustomer() { DTO.Customer current_customer = new DTO.Customer(); if (InputValidation()) { current_customer.name = nameTextBox.Text; current_customer.address = addressTextBox.Text; current_customer.zip_code = zipTextBox.Text; current_customer.phone_number = phoneTextBox.Text; } else { current_customer = null; } return(current_customer); }