public static OrderVariables AssignShippingBillingToOrderVariables(OrderVariables oVariables, ShippingBillingOrder newShippingAddress) { if (newShippingAddress != null && newShippingAddress.stepNumber == 1) { CommonModels oComm = new CommonModels(); OrderProcess oProcess = new OrderProcess(); //OrderVariables oVariables = new OrderVariables(); oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = newShippingAddress.ShippingFirstName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = newShippingAddress.ShippingLastName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = newShippingAddress.ShippingAddress1; oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = newShippingAddress.ShippingAddress2; oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = newShippingAddress.ShippingCity; oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = newShippingAddress.ShippingState; oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = newShippingAddress.ShippingZipCode; oVariables.ShipVars[oVariables.default_shp_id].child_dob = newShippingAddress.ChildDOB != null ? newShippingAddress.ChildDOB.ToString() : ""; //oVariables.referring_url = HttpContext.Current.Request.Url.ToString(); #region Code for Child Name Gender and DOB //======================================== string chName = ""; chName = string.IsNullOrEmpty(newShippingAddress.ChildName) ? "" : newShippingAddress.ChildName.Trim(); string[] name = chName.Split(' '); int cnt = name.Count(); string fname = ""; for (int i = 0; i < name.Count() - 1; i++) { fname += name[i] + " "; } string lname = ""; if (cnt > 1) { lname = name[cnt - 1]; } if (fname.Trim().Length == 0) fname = name.Length > 0 ? name[0] : ""; if (lname.Trim().Length == 0) lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname; // oVariables.ShipVars[oVariables.default_shp_id].child_dob = oProcess.ValidateDateTime(newShippingAddress.ChildDOB.ToString()); oVariables.ShipVars[oVariables.default_shp_id].child_fname = fname.Trim(); oVariables.ShipVars[oVariables.default_shp_id].child_lname = lname.Trim(); if (string.IsNullOrEmpty(newShippingAddress.ChildGender) || newShippingAddress.ChildGender == "") oVariables.ShipVars[oVariables.default_shp_id].child_gender = "0"; else oVariables.ShipVars[oVariables.default_shp_id].child_gender = newShippingAddress.ChildGender; //oVariables.referring_url = HttpContext.Current.Request.Url.ToString(); #endregion //================================================= oVariables.ip_address = oComm.GetIPAddress(); oVariables.phone = newShippingAddress.ShippingPhone; oVariables.email = newShippingAddress.ShippingEmail; oVariables.bonus_option = false; if (newShippingAddress.isBonusSelected) { oVariables.bonus_option = true; } //Setting billing Address by default same as shipping address. // later on payment page it will be updated if shipping and biling not same oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname; oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname; oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1; oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt; oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city; oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state; oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode; return oVariables; } else if (newShippingAddress != null && newShippingAddress.stepNumber == 2) { //As we are setting billing and shipping address same on landing page if (newShippingAddress.isBillingSameToShipping == false) { oVariables.bill_to_fname = newShippingAddress.BillingFirstName.Trim(); oVariables.bill_to_lname = newShippingAddress.BillingLastName.Trim(); oVariables.bill_to_address1 = newShippingAddress.BillingAddress1.Trim(); oVariables.bill_to_apt = (!string.IsNullOrEmpty(newShippingAddress.BillingAddress2)) ? newShippingAddress.BillingAddress2.Trim() : ""; oVariables.bill_to_city = newShippingAddress.BillingCity.Trim(); oVariables.bill_to_state = newShippingAddress.BillingState.Trim(); oVariables.bill_to_zipcode = newShippingAddress.BillingZipCode.Trim(); } //Assigning Payment details to OVariable oVariables.credit_rule = "CCC"; oVariables.err = ""; if (oVariables.CCVars.Count > 0) { oVariables.CCVars[0].number = newShippingAddress.CreditCardNumber.Trim(); oVariables.CCVars[0].type = ""; oVariables.CCVars[0].expdate = newShippingAddress.CardExpiryMonth.Trim() + newShippingAddress.CardExpiryYear.Trim(); oVariables.CCVars[0].cvv = newShippingAddress.SecurityCode.Trim(); oVariables.CCVars[0].zipcode = newShippingAddress.CCBillZipCode.Trim(); // oVariables.bill_to_zipcode;// newShippingAddress.BillingZipCode.Trim(); oVariables.total_amt = 0.0; oVariables.total_sah = 0.0; } else { CCProperties oCCVars = new OrderEngine.CCProperties(); oVariables.payment_type = "CC"; oCCVars.number = newShippingAddress.CreditCardNumber.Trim(); oCCVars.type = ""; oCCVars.expdate = newShippingAddress.CardExpiryMonth.Trim() + newShippingAddress.CardExpiryYear.Trim(); oCCVars.cvv = newShippingAddress.SecurityCode.Trim(); oCCVars.zipcode = newShippingAddress.CCBillZipCode.Trim(); // oVariables.bill_to_zipcode;// (billingDetails.BillingZipCode != null && billingDetails.BillingZipCode != "") ? billingDetails.BillingZipCode.Trim() : oVariables.bill_to_zipcode; // billingDetails.BillingZipCode.Trim(); oVariables.credit_rule = "CCC"; oVariables.CCVars.Add(oCCVars); oVariables.total_amt = 0.0; oVariables.total_sah = 0.0; } return oVariables; } else return null; }
public static OrderVariables AssignShippingToOrderVariable(OrderVariables oVariables, ShippingAddress newShippingAddress) { CommonModels oComm = new CommonModels(); //OrderVariables oVariables = new OrderVariables(); oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = newShippingAddress.ShippingFirstName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = newShippingAddress.ShippingLastName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = newShippingAddress.ShippingAddress1; oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = newShippingAddress.ShippingAddress2; oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = newShippingAddress.ShippingCity; oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = newShippingAddress.ShippingState; oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = newShippingAddress.ShippingZipCode; oVariables.referring_url = HttpContext.Current.Request.Url.ToString(); oVariables.ip_address = oComm.GetIPAddress(); oVariables.phone = newShippingAddress.ShippingPhone; oVariables.email = newShippingAddress.ShippingEmail; oVariables.bonus_option = false; if (newShippingAddress.isBonusSelected) { oVariables.bonus_option = true; } //Setting billing Address by default same as shipping address. // later on payment page it will be updated if shipping and biling not same oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname; oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname; oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1; oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt; oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city; oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state; oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode; return oVariables; }
public static OrderVariables AssignShippingToOrderVariable(OrderVariables oVariables, ShippingAddress newShippingAddress) { CommonModels oComm = new CommonModels(); OrderProcess oProcess = new OrderProcess(); //OrderVariables oVariables = new OrderVariables(); oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = newShippingAddress.ShippingFirstName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = newShippingAddress.ShippingLastName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = newShippingAddress.ShippingAddress1; oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = newShippingAddress.ShippingAddress2; oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = newShippingAddress.ShippingCity; oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = newShippingAddress.ShippingState; oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = newShippingAddress.ShippingZipCode; oVariables.ShipVars[oVariables.default_shp_id].child_dob = newShippingAddress.ChildDOB != null ? newShippingAddress.ChildDOB.ToString() : ""; //oVariables.ShipVars[oVariables.default_shp_id].child_fname = newShippingAddress.ChildName; #region Code for Child Name Gender and DOB //======================================== string chName = ""; chName = string.IsNullOrEmpty(newShippingAddress.ChildName) ? "" : newShippingAddress.ChildName.Trim(); string[] name = chName.Split(' '); int cnt = name.Count(); string fname = ""; for (int i = 0; i < name.Count() - 1; i++) { fname += name[i] + " "; } string lname = ""; if (cnt > 1) { lname = name[cnt - 1]; } if (fname.Trim().Length == 0) fname = name.Length > 0 ? name[0] : ""; if (lname.Trim().Length == 0) lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname; //oVariables.ShipVars[oVariables.default_shp_id].child_dob = oProcess.ValidateDateTime(newShippingAddress.ChildDOB.ToString()); oVariables.ShipVars[oVariables.default_shp_id].child_fname = fname.Trim(); oVariables.ShipVars[oVariables.default_shp_id].child_lname = lname.Trim(); if (string.IsNullOrEmpty(newShippingAddress.ChildGender) || newShippingAddress.ChildGender == "") oVariables.ShipVars[oVariables.default_shp_id].child_gender = "0"; else oVariables.ShipVars[oVariables.default_shp_id].child_gender = newShippingAddress.ChildGender; //oVariables.referring_url = HttpContext.Current.Request.Url.ToString(); #endregion //================================================= oVariables.ip_address = oComm.GetIPAddress(); oVariables.phone = newShippingAddress.ShippingPhone; oVariables.email = newShippingAddress.ShippingEmail; oVariables.bonus_option = false; if (newShippingAddress.isBonusSelected) { oVariables.bonus_option = true; } //Setting billing Address by default same as shipping address. // later on payment page it will be updated if shipping and biling not same oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname; oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname; oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1; oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt; oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city; oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state; oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode; return oVariables; }
public static OrderVariables AssignShoppingDetailsToOrderVariable(OrderVariables oVariables, ShoppingOrder billingDetails) { CommonModels oComm = new CommonModels(); //OrderVariables oVariables = new OrderVariables(); oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname = billingDetails.ShippingFirstName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname = billingDetails.ShippingLastName; oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1 = billingDetails.ShippingAddress1; oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt = billingDetails.ShippingAddress2; oVariables.ShipVars[oVariables.default_shp_id].ship_to_city = billingDetails.ShippingCity; oVariables.ShipVars[oVariables.default_shp_id].ship_to_state = billingDetails.ShippingState; oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode = billingDetails.ShippingZipCode; oVariables.referring_url = HttpContext.Current.Request.Url.ToString(); oVariables.ip_address = oComm.GetIPAddress(); oVariables.phone = billingDetails.ShippingPhone; oVariables.email = billingDetails.ShippingEmail; oVariables.bonus_option = false; if (billingDetails.isBonusSelected) { oVariables.bonus_option = true; } //Assigning Billing Address details to OVariable if (billingDetails.isBillingSameToShipping) { oVariables.bill_to_fname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_fname; oVariables.bill_to_lname = oVariables.ShipVars[oVariables.default_shp_id].ship_to_lname; oVariables.bill_to_address1 = oVariables.ShipVars[oVariables.default_shp_id].ship_to_address1; oVariables.bill_to_apt = oVariables.ShipVars[oVariables.default_shp_id].ship_to_apt; oVariables.bill_to_city = oVariables.ShipVars[oVariables.default_shp_id].ship_to_city; oVariables.bill_to_state = oVariables.ShipVars[oVariables.default_shp_id].ship_to_state; oVariables.bill_to_zipcode = oVariables.ShipVars[oVariables.default_shp_id].ship_to_zipcode; } else { oVariables.bill_to_fname = billingDetails.BillingFirstName.Trim(); oVariables.bill_to_lname = billingDetails.BillingLastName.Trim(); oVariables.bill_to_address1 = billingDetails.BillingAddress1.Trim(); oVariables.bill_to_apt = (!string.IsNullOrEmpty(billingDetails.BillingAddress2)) ? billingDetails.BillingAddress2.Trim() : ""; oVariables.bill_to_city = billingDetails.BillingCity.Trim(); oVariables.bill_to_state = billingDetails.BillingState.Trim(); oVariables.bill_to_zipcode = billingDetails.BillingZipCode.Trim(); } //Assigning Payment details to OVariable oVariables.credit_rule = "CCC"; oVariables.err = ""; if (oVariables.CCVars.Count > 0) { oVariables.CCVars[0].number = billingDetails.CreditCardNumber.Trim(); oVariables.CCVars[0].type = ""; oVariables.CCVars[0].expdate = billingDetails.CardExpiryMonth.Trim() + billingDetails.CardExpiryYear.Trim(); oVariables.CCVars[0].cvv = billingDetails.SecurityCode.Trim(); oVariables.CCVars[0].zipcode = billingDetails.BillingZipCode.Trim(); oVariables.total_amt = 0.0; oVariables.total_sah = 0.0; } else { CCProperties oCCVars = new OrderEngine.CCProperties(); oVariables.payment_type = "CC"; oCCVars.number = billingDetails.CreditCardNumber.Trim(); oCCVars.type = ""; oCCVars.expdate = billingDetails.CardExpiryMonth.Trim() + billingDetails.CardExpiryYear.Trim(); oCCVars.cvv = billingDetails.SecurityCode.Trim(); oCCVars.zipcode = (billingDetails.BillingZipCode != null && billingDetails.BillingZipCode != "") ? billingDetails.BillingZipCode.Trim() : "";// billingDetails.BillingZipCode.Trim(); oVariables.credit_rule = "CCC"; oVariables.CCVars.Add(oCCVars); oVariables.total_amt = 0.0; oVariables.total_sah = 0.0; } return oVariables; }