public bool PaddingPassengerInfo() { try { Utility.Transaction.CurrentTransactionObject.ClearPassenger(); DataListItem item; List<TERMS.Business.Centers.SalesCenter.Passenger> OrderPassengerInfos = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); int iAdult = dlAdult.Items.Count; int iChild = dlChild.Items.Count; List<string> list = new List<string>(); for (int i = 0; i < iAdult; i++) { item = dlAdult.Items[i]; if (!list.Contains(((TextBox)item.FindControl("txtAdultFirst")).Text.Trim().ToUpper() + ((TextBox)item.FindControl("txtAdultLast")).Text.Trim().ToUpper())) { list.Add(((TextBox)item.FindControl("txtAdultFirst")).Text.Trim().ToUpper() + ((TextBox)item.FindControl("txtAdultLast")).Text.Trim().ToUpper()); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('name repeat');</script>"); return false; } System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("^[A-Za-z.]+$"); if (!reg.IsMatch(((TextBox)item.FindControl("txtAdultFirst")).Text + ((TextBox)item.FindControl("txtAdultMiddle")).Text + ((TextBox)item.FindControl("txtAdultLast")).Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Name format error.');</script>"); return false; } TERMS.Business.Centers.SalesCenter.Passenger adultorderPassengerInfo = new TERMS.Business.Centers.SalesCenter.Passenger( ((TextBox)item.FindControl("txtAdultFirst")).Text, ((TextBox)item.FindControl("txtAdultLast")).Text, ((TextBox)item.FindControl("txtAdultMiddle")).Text, TERMS.Common.PassengerType.Adult); adultorderPassengerInfo.Salutationn = (Salutation)Convert.ToInt16(((RadioButtonList)item.FindControl("rbtnAdultGender")).SelectedValue); adultorderPassengerInfo.PassportNumber = ((TextBox)item.FindControl("txtAdultPassport")).Text; //adultorderPassengerInfo.Meal = (TERMS.Business.Centers.SalesCenter.Passenger.MealType)Convert.ToInt16(((DropDownList)item.FindControl("ddlAdultMeal")).SelectedValue); Utility.Transaction.CurrentTransactionObject.AddPassenger(adultorderPassengerInfo); Utility.Transaction.CurrentTransactionObject.Items[0].Passengers.Add(adultorderPassengerInfo); if (Utility.Transaction.CurrentSearchConditions is PackageSearchCondition) { ((OrderItem)Utility.Transaction.CurrentTransactionObject.Items[0].Items[0]).Passengers.Add(adultorderPassengerInfo); } } for (int i = 0; i < iChild; i++) { item = dlChild.Items[i]; if (!list.Contains(((TextBox)item.FindControl("txtChildFirst")).Text.Trim().ToUpper() + ((TextBox)item.FindControl("txtChildLast")).Text.Trim().ToUpper())) { list.Add(((TextBox)item.FindControl("txtChildFirst")).Text.Trim().ToUpper() + ((TextBox)item.FindControl("txtChildLast")).Text.Trim().ToUpper()); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('name repeat');</script>"); return false; } DateTime dateBirthday; try { dateBirthday = Convert.ToDateTime(((TextBox)item.FindControl("txtChildBirthday")).Text); DateTime dateOldTime = DateTime.Now; if (dateBirthday.AddYears(11) < dateOldTime) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Child " + (i + 1).ToString() + "# The age is bigger than 11 ');</script>"); return false; } if (dateBirthday.AddYears(2) > dateOldTime) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Child " + (i + 1).ToString() + "# The age is younger than 11 ');</script>"); return false; } } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Child " + (i + 1).ToString() + "# birthday format error.');</script>"); return false; } System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("^[A-Za-z.]+$"); if (!reg.IsMatch(((TextBox)item.FindControl("txtChildFirst")).Text + ((TextBox)item.FindControl("txtChildMiddle")).Text + ((TextBox)item.FindControl("txtChildLast")).Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Name format error.');</script>"); return false; } TERMS.Business.Centers.SalesCenter.Passenger childOrderPassengerInfo = new TERMS.Business.Centers.SalesCenter.Passenger( ((TextBox)item.FindControl("txtChildFirst")).Text, ((TextBox)item.FindControl("txtChildLast")).Text, ((TextBox)item.FindControl("txtChildMiddle")).Text, TERMS.Common.PassengerType.Child); childOrderPassengerInfo.Salutationn = (Salutation)Convert.ToInt16(((RadioButtonList)item.FindControl("rbtnChildGender")).SelectedValue); childOrderPassengerInfo.Birthday = dateBirthday; childOrderPassengerInfo.PassportNumber = ((TextBox)item.FindControl("txtChildPassport")).Text; //childOrderPassengerInfo.Meal = (TERMS.Business.Centers.SalesCenter.Passenger.MealType)Convert.ToInt16(((DropDownList)item.FindControl("ddlChildMeal")).SelectedValue); Utility.Transaction.CurrentTransactionObject.AddPassenger(childOrderPassengerInfo); Utility.Transaction.CurrentTransactionObject.Items[0].Passengers.Add(childOrderPassengerInfo); if (Utility.Transaction.CurrentSearchConditions is PackageSearchCondition) { ((OrderItem)Utility.Transaction.CurrentTransactionObject.Items[0].Items[0]).Passengers.Add(childOrderPassengerInfo); } } //创建HotelOrderItem列表 List<HotelOrderItem> hotelOrderItems = new List<HotelOrderItem>(); if (Utility.Transaction.CurrentSearchConditions is Terms.Sales.Business.PackageSearchCondition) { for (int i = 0; i < Utility.Transaction.CurrentTransactionObject.Items[0].Items.Count; i++) if (Utility.Transaction.CurrentTransactionObject.Items[0].Items[i] is HotelOrderItem) hotelOrderItems.Add((HotelOrderItem)Utility.Transaction.CurrentTransactionObject.Items[0].Items[i]); } else { for (int i = 0; i < Utility.Transaction.CurrentTransactionObject.Items.Count; i++) if (Utility.Transaction.CurrentTransactionObject.Items[i] is HotelOrderItem) hotelOrderItems.Add((HotelOrderItem)Utility.Transaction.CurrentTransactionObject.Items[i]); } List<TERMS.Business.Centers.SalesCenter.Passenger> passengers = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); for (int j = 0; j < Utility.Transaction.CurrentTransactionObject.GetPassengers().Count; j++) passengers.Add((TERMS.Business.Centers.SalesCenter.Passenger)Utility.Transaction.CurrentTransactionObject.GetPassengers()[j]); //将Passenger分配到OrderItem中 HotelOrderUtility.AssignPassengersToHotel(hotelOrderItems, passengers); return true; } catch(Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('" + ex.Message + "');</script>"); return false; } }
void HotelOrderPassengerInfoControl_InitializeControls(object sender, EventArgs e) { Utility.Transaction.IntKey = Convert.ToInt32(Request.Params["ConditionID"]); int iAdult = 0; int iChild = 0; GetNumberOfPeople(ref iAdult, ref iChild); List<TERMS.Business.Centers.SalesCenter.Passenger> m_OrderPassengerInfoAdults = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); for (int i = 0; i < iAdult; i++) { if (i == 0) { TERMS.Business.Centers.SalesCenter.Passenger pass = new TERMS.Business.Centers.SalesCenter.Passenger(TERMS.Common.PassengerType.Adult); if (Utility.Transaction.IsLogin) { //当是Subagent的时候 是不需要把subagent作为客人显示的 if (!Utility.IsSubAgent) { pass = new TERMS.Business.Centers.SalesCenter.Passenger(Utility.Transaction.Member.FirstName, Utility.Transaction.Member.LastName, Utility.Transaction.Member.MiddleName, TERMS.Common.PassengerType.Adult); } } m_OrderPassengerInfoAdults.Add(pass); } else { m_OrderPassengerInfoAdults.Add(new TERMS.Business.Centers.SalesCenter.Passenger(TERMS.Common.PassengerType.Adult)); } } this.dlAdult.DataSource = m_OrderPassengerInfoAdults; List<TERMS.Business.Centers.SalesCenter.Passenger> m_OrderPassengerInfoChilds = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); for (int i = 0; i < iChild; i++) { m_OrderPassengerInfoChilds.Add(new TERMS.Business.Centers.SalesCenter.Passenger(TERMS.Common.PassengerType.Child)); } this.dlChild.DataSource = m_OrderPassengerInfoChilds; this.dlAdult.DataBind(); this.dlChild.DataBind(); if (!this.IsPostBack) { if (dlAdult.Items != null && dlAdult.Items.Count > 0) { ((TextBox)(dlAdult.Items[0].FindControl("txtAdultFirst"))).Attributes.Add("onblur", "copytext(this)"); ((TextBox)(dlAdult.Items[0].FindControl("txtAdultLast"))).Attributes.Add("onblur", "copytext(this)"); ((TextBox)(dlAdult.Items[0].FindControl("txtAdultMiddle"))).Attributes.Add("onblur", "copytext(this)"); } } }
protected void btnBooking_Click(object sender, EventArgs e) { if (!cbIsAgree.Checked) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please read & confirm the Terms and Conditions to continue');</script>"); return; } if (ddlState.SelectedIndex == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select state');</script>"); return; } try { Utility.Transaction.CurrentTransactionObject.ClearPassenger(); string firstName = txtFrist.Text; string middleName = txtMiddle.Text; string lastName = txtLast.Text; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("^[A-Za-z.]+$"); if (!reg.IsMatch(firstName + middleName + lastName)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Name format error.');</script>"); return; } if (middleName == "Middle Name") { middleName = string.Empty; } TERMS.Business.Centers.SalesCenter.Passenger adultorderPassengerInfo = new TERMS.Business.Centers.SalesCenter.Passenger(firstName, lastName, middleName, TERMS.Common.PassengerType.Adult); adultorderPassengerInfo.PassengerType = TERMS.Common.PassengerType.Adult; switch (ddlSex.SelectedValue) { case "0": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.Dr; break; case "1": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.Miss; break; case "2": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.Mr; break; case "3": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.Mrs; break; case "4": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.Ms; break; case "99": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.None; break; case "5": adultorderPassengerInfo.Salutationn = TERMS.Common.Salutation.Rev; break; } Utility.Transaction.CurrentTransactionObject.AddPassenger(adultorderPassengerInfo); } catch { return; } Contact contact = new Contact(); string firstNameContact = txtContactFirst.Text; string middleNameContact = txtMiddle.Text; string lastNameContact = txtContactLast.Text; if (middleNameContact == "Middle Name") { middleNameContact = string.Empty; } contact.Person = new TERMS.Common.Person(firstNameContact, lastNameContact, middleNameContact); TERMS.Common.Country country = new TERMS.Common.Country(); country.Code = this.ddlCountry.SelectedValue; string Phone = string.Empty; if (txtExt.Text.Trim().Length > 0) { Phone = txtPhone.Text.Trim() + " " + txtExt.Text.Trim(); } else { Phone = txtPhone.Text.Trim(); } TERMS.Common.Phone phone = new TERMS.Common.Phone(country, this.ddlState.SelectedValue, Phone, string.Empty); phone.ContactOptions = TERMS.Common.ContactOptions.DayTime; contact.Person.AddPhone(phone); contact.Person.Email = this.txtEmail.Text; TERMS.Common.City city = new TERMS.Common.City(); city.Name = this.txtCity.Text; city.Country.Name = this.ddlCountry.SelectedItem.Text; city.ProvinceName = this.ddlState.SelectedItem.Text; string Address = string.Empty; if (txtAddress2.Text.Trim().Length > 0) { Address = txtAddress1.Text.Trim() + "-" + txtAddress2.Text.Trim(); } else { Address = txtAddress1.Text.Trim(); } TERMS.Common.Address address = new TERMS.Common.Address(city, Address, txtZip.Text.Trim()); contact.Person.AddAddress(address); if (Utility.Transaction.CurrentTransactionObject.GetContacts() != null && Utility.Transaction.CurrentTransactionObject.GetContacts().Count > 0) { Utility.Transaction.CurrentTransactionObject.ClearContact(); } Utility.Transaction.CurrentTransactionObject.AddContact(contact); VehcileOrderItem vehcileorderitem = new VehcileOrderItem(new PackageProfile("Car")); VehcileMerchandise m_SaleMerchandise = (VehcileMerchandise)this.OnSearch(); for (int i = 0; i < m_SaleMerchandise.Items.Count; i++) { VehcileMaterial vehcilematerial = (TERMS.Business.Centers.ProductCenter.Components.VehcileMaterial)m_SaleMerchandise.Items[i]; if (vehcilematerial.VendorCode == VendorCode && vehcilematerial.Vehciles.MakeModelCode == CarCode) { vehcileorderitem.Vehcile = vehcilematerial; } } Utility.Transaction.CurrentTransactionObject.Items.Add(vehcileorderitem); this.NewVehcileSendEamilControl1.AddItems(); //this.Response.Redirect("~/Page/Common/SaveOrderWaiting.aspx" + "?ConditionID=" + Request.Params["ConditionID"] + "&VendorCode=" + VendorCode + "&CarCode=" + CarCode); ClientScript.RegisterStartupScript(this.GetType(), "Searching", "<script>OnSearch();</script>"); }
private void SetPreBookingPassengers(AirMaterial airMaterial, ref IList<TERMS.Business.Centers.SalesCenter.Passenger> passengers) { for (int i = 0; i < Convert.ToInt32(airMaterial.Profile.GetParam("ADULT_NUMBER")); i++) { TERMS.Business.Centers.SalesCenter.Passenger passenger = new TERMS.Business.Centers.SalesCenter.Passenger(ProductConst.PASSFIRSTNAME, ProductConst.ADTPASSLASTNAME, ProductConst.PASSMIDDLENAME, TERMS.Common.PassengerType.Adult); passengers.Add(passenger); } for (int i = 0; i < Convert.ToInt32(airMaterial.Profile.GetParam("CHILD_NUMBER")); i++) { TERMS.Business.Centers.SalesCenter.Passenger passenger = new TERMS.Business.Centers.SalesCenter.Passenger(ProductConst.PASSFIRSTNAME, ProductConst.CHDPASSLASTNAME, ProductConst.PASSMIDDLENAME, TERMS.Common.PassengerType.Child); passengers.Add(passenger); } }
public bool PaddingPassengerInfo() { try { Utility.Transaction.CurrentTransactionObject.ClearPassenger(); DataListItem item; System.Text.RegularExpressions.Regex reg = new Regex("^[A-Za-z.]+$"); string firstName = txtPassengerFirst.Text; string middleName = txtPassengerMiddle.Text; string lastName = txtPassengerLast.Text; if (!reg.IsMatch(firstName + middleName + lastName)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Name format error.');</script>"); return false; } if (string.IsNullOrEmpty(firstName)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('First Name format error.');</script>"); return false; } if (string.IsNullOrEmpty(lastName)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Last Name format error.');</script>"); return false; } TERMS.Business.Centers.SalesCenter.Passenger adultorderPassengerInfo = new TERMS.Business.Centers.SalesCenter.Passenger(firstName, lastName, middleName, TERMS.Common.PassengerType.Adult); adultorderPassengerInfo.Salutationn = (TERMS.Common.Salutation)Convert.ToInt32(rbtPassengerGender.SelectedValue); adultorderPassengerInfo.PassengerType = TERMS.Common.PassengerType.Adult; Utility.Transaction.CurrentTransactionObject.AddPassenger(adultorderPassengerInfo); Utility.Transaction.CurrentTransactionObject.Items[0].Passengers.Add(adultorderPassengerInfo); return true; } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('" + ex.Message + "');</script>"); return false; } }