/// <summary> /// Submits a shopping cart and converts /// the cart items into order items. /// </summary> public int Submit() { // Initialize command SqlConnection con = new SqlConnection(_connectionString); SqlCommand cmd = new SqlCommand("dev_OrderSubmit", con); cmd.CommandType = CommandType.StoredProcedure; // Initialize parameters cmd.Parameters.AddWithValue("@UserName", _userName); cmd.Parameters.AddWithValue("@CCName", _ccName); cmd.Parameters.AddWithValue("@CCType", _ccType); cmd.Parameters.AddWithValue("@CCNumber_Encrypted", Secret.Encrypt(_ccNumber)); cmd.Parameters.AddWithValue("@CCExpiryMonth", _ccExpiryMonth); cmd.Parameters.AddWithValue("@CCExpiryYear", _ccExpiryYear); cmd.Parameters.AddWithValue("@BillingStreet", _billingStreet); cmd.Parameters.AddWithValue("@BillingCity", _billingCity); cmd.Parameters.AddWithValue("@BillingState", _billingState); cmd.Parameters.AddWithValue("@BillingPostalCode", _billingPostalCode); cmd.Parameters.AddWithValue("@BillingCountry", _billingCountry); cmd.Parameters.AddWithValue("@Email", _email); cmd.Parameters.AddWithValue("@ShippingStreet", _shippingStreet); cmd.Parameters.AddWithValue("@ShippingCity", _shippingCity); cmd.Parameters.AddWithValue("@ShippingState", _shippingState); cmd.Parameters.AddWithValue("@ShippingPostalCode", _shippingPostalCode); cmd.Parameters.AddWithValue("@ShippingCountry", _shippingCountry); // Execute command int result; using (con) { con.Open(); result = Int32.Parse(cmd.ExecuteScalar().ToString()); } return(result); }