public bool PaddingContactInfo()
    {
        Contact contact = new Contact();

        contact.Person = new TERMS.Common.Person(this.txtFirst.Text, this.txtLast.Text, this.txtMiddle.Text);
        contact.Person.Salutationn = (TERMS.Common.Salutation)Convert.ToInt16(this.rbtContactGender.SelectedValue);

        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;

        TERMS.Common.Address address = new TERMS.Common.Address(city, this.txtStreet.Text, this.txtZip.Text);

        contact.Person.AddAddress(address);

        TERMS.Common.Country country = new TERMS.Common.Country();

        country.Code = this.ddlCountry.SelectedValue;

        Phone phone = new Phone(country, this.ddlState.SelectedValue, this.txtPhoneDay.Text, string.Empty);
        phone.ContactOptions = ContactOptions.DayTime;
        contact.Person.AddPhone(phone);

        phone = new Phone(country, this.ddlState.SelectedValue, this.txtPhoneNight.Text, string.Empty);
        phone.ContactOptions = ContactOptions.NightTime;
        contact.Person.AddPhone(phone);

        contact.Person.Email = this.txtEmail.Text;

        phone = new Phone(country, this.ddlState.SelectedValue, this.txtFax.Text, string.Empty);
        phone.ContactOptions = ContactOptions.Office;
        contact.Person.AddFax(phone);

        if (Utility.Transaction.CurrentTransactionObject.GetContacts() != null && Utility.Transaction.CurrentTransactionObject.GetContacts().Count > 0)
        {
            Utility.Transaction.CurrentTransactionObject.ClearContact();
        }

        Utility.Transaction.CurrentTransactionObject.AddContact(contact);

        return true;
    }
    public bool PaddingPassengerInfo()
    {
        //if (string.IsNullOrEmpty(ddlCountry.SelectedValue))
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select Country.');</script>");
        //    return false;
        //}

        //if (string.IsNullOrEmpty(ddlState.SelectedValue))
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select State.');</script>");
        //    return false;
        //}

        Contact contact = new Contact();

        contact.Person = new TERMS.Common.Person(this.txtFirst.Text, this.txtLast.Text, this.txtMiddle.Text);
        contact.Person.Salutationn = (TERMS.Common.Salutation)Convert.ToInt16(this.rbtnGender.SelectedValue);

        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;

        TERMS.Common.Address address = new TERMS.Common.Address(city, this.txtStreet.Text, this.txtZip.Text);

        contact.Person.AddAddress(address);

        TERMS.Common.Country country = new TERMS.Common.Country();

        country.Code = this.ddlCountry.SelectedValue;

        Phone phone = new Phone(country, this.ddlState.SelectedValue, this.txtPhoneDay.Text, string.Empty);
        phone.ContactOptions = ContactOptions.DayTime;
        contact.Person.AddPhone(phone);

        phone = new Phone(country, this.ddlState.SelectedValue, this.txtPhoneNight.Text, string.Empty);
        phone.ContactOptions = ContactOptions.NightTime;
        contact.Person.AddPhone(phone);

        contact.Person.Email = this.txtEmail.Text;

        phone = new Phone(country, this.ddlState.SelectedValue, this.txtFax.Text, string.Empty);
        phone.ContactOptions = ContactOptions.Office;
        contact.Person.AddFax(phone);

        if (Utility.Transaction.CurrentTransactionObject.GetContacts() != null && Utility.Transaction.CurrentTransactionObject.GetContacts().Count > 0)
        {
            Utility.Transaction.CurrentTransactionObject.ClearContact();
        }
        Utility.Transaction.CurrentTransactionObject.AddContact(contact);

        return true;
    }
    public bool PaddingPassengerInfo()
    {
        if (ddlPaymentType.SelectedValue == "2" && this.ddlCardType.SelectedIndex == 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select Card Type.');</script>");
            return false;
        }

        if (Utility.Transaction.CurrentTransactionObject.GetPayments() != null && Utility.Transaction.CurrentTransactionObject.GetPayments().Count > 0)
        {
            Utility.Transaction.CurrentTransactionObject.GetPayments().Clear();
        }

        if (ddlPaymentType.SelectedValue == "2" && Utility.IsSubAgent)
        {
            if (string.IsNullOrEmpty(txtStreet.Text.Trim()))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter Street.');</script>");
                return false;
            }

            if (string.IsNullOrEmpty(txtCity.Text.Trim()))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter City.');</script>");
                return false;
            }

            if (string.IsNullOrEmpty(txtZip.Text.Trim()))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter Zip/Postal Code.');</script>");
                return false;
            }

            if (string.IsNullOrEmpty(txtTel.Text.Trim()))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter Phone Number Associated With This Billing Address.');</script>");
                return false;
            }

            if (string.IsNullOrEmpty(ddlCountry.SelectedValue))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select country.');</script>");
                return false;
            }

            if (string.IsNullOrEmpty(ddlState.SelectedValue))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select state.');</script>");
                return false;
            }

        }

        Payment payment = null;

        if (ddlPaymentType.SelectedValue == "1" && ddlPaymentType.Visible == true)
        {
            payment = new Check();
        }
        if (ddlPaymentType.SelectedValue == "2" || ddlPaymentType.Visible == false)
        {
            if (this.ddlCardType.SelectedIndex == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select Card Type.');</script>");
                return false;
            }

            bool passengers = false;

            for (int i = 0; i < Utility.Transaction.CurrentTransactionObject.GetPassengers().Count; i++)
            {
                if (Utility.Transaction.CurrentTransactionObject.GetPassengers()[i].FirstName.Trim().ToUpper() == this.txtFirst.Text.Trim().ToUpper() &&
                    Utility.Transaction.CurrentTransactionObject.GetPassengers()[i].LastName.Trim().ToUpper() == this.txtLast.Text.Trim().ToUpper() &&
                    Utility.Transaction.CurrentTransactionObject.GetPassengers()[i].PassengerType == TERMS.Common.PassengerType.Adult )
                {
                    passengers = true;
                }
            }
            if (!passengers)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Credit card holder should be one of passengers.');</script>");
                return false;
            }
            payment = new CreditCard();
            ((CreditCard)payment).CardExpirationDate = new DateTime(Convert.ToInt32(this.ddlYear.SelectedValue), Convert.ToInt32(this.ddlMonth.SelectedValue), 1);
            ((CreditCard)payment).CardIdentificationNumber = this.txtCardIdentification.Text;
            ((CreditCard)payment).CardNumber = this.txtCardNumber1.Text + "-" + this.txtCardNumber2.Text + "-" + this.txtCardNumber3.Text + "-" + this.txtCardNumber4.Text;
            ((CreditCard)payment).CardType = (TERMS.Business.Centers.SalesCenter.CreditCardType)Convert.ToInt16(this.ddlCardType.SelectedValue);
            ((CreditCard)payment).CreditCardBankName = txtCreditCardBankName.Text;
            ((CreditCard)payment).CreditCardBankTollFreeNumber = txtCreditCardCustomerServicePhoneNumber.Text;
            //add zyl 2009-9-16
            ((CreditCard)payment).CardHolderFirstName = txtFirst.Text;
            ((CreditCard)payment).CardHolderLastName = txtLast.Text;
        }

        payment.Payer = new Payer();

        payment.Payer.Person = new TERMS.Common.Person(this.txtPayerFirst.Text, this.txtPayerLast.Text);

        TERMS.Common.City city = new TERMS.Common.City();
        city.Name = this.txtCity.Text;
        city.Country.Code = this.ddlCountry.SelectedValue;
        city.ProvinceName = this.ddlState.SelectedValue;

        //if (this.txtStreet.Text.Length > 200)
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Street length can not exceed 200 characters.');</script>");
        //    return false;
        //}

        payment.Payer.Person.AddAddress(new TERMS.Common.Address(city, this.txtStreet.Text, this.txtZip.Text));

        Phone phoneDay = new Phone(new TERMS.Common.Country(),"", this.txtTel.Text, this.txtExt.Text);
        phoneDay.ContactOptions = ContactOptions.DayTime;
        payment.Payer.Person.AddPhone(phoneDay);

        //if (this.txtCompany.Text.Length > 50)
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Company Name length can not exceed 50 characters.');</script>");
        //    return false;
        //}

        payment.Payer.CompanyName = this.txtCompany.Text;

        Utility.Transaction.CurrentTransactionObject.AddPayment(payment);

        return true;
    }
    public bool PaddingPassengerInfo()
    {
        if (string.IsNullOrEmpty(txtFirst.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter first name.');</script>");
            return false;
        }

        if (string.IsNullOrEmpty(txtLast.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter last name.');</script>");
            return false;
        }

        if (string.IsNullOrEmpty(txtEmail.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter email.');</script>");
            return false;
        }

        if (!System.Text.RegularExpressions.Regex.IsMatch(txtEmail.Text.Trim(), @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Email Format error. Choose another');</script>");
            return false;
        }

        if (string.IsNullOrEmpty(txtPhoneDay.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter phone number.');</script>");
            return false;
        }

        if (string.IsNullOrEmpty(txtStreet.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter address.');</script>");
            return false;
        }

        if (string.IsNullOrEmpty(txtCity.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter city.');</script>");
            return false;
        }

        if (string.IsNullOrEmpty(txtZip.Text.Trim()))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please enter zip code.');</script>");
            return false;
        }
        //if (string.IsNullOrEmpty(ddlState.SelectedValue))
        //{
        //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select State.');</script>");
        //    return false;
        //}

        Contact contact = new Contact();

        contact.Person = new TERMS.Common.Person(this.txtFirst.Text, this.txtLast.Text, this.txtMiddle.Text);
        contact.Person.Salutationn = (TERMS.Common.Salutation)Convert.ToInt16(this.rbtnGender.SelectedValue);

        TERMS.Common.City city = new TERMS.Common.City();

        city.Name = this.txtCity.Text;

        city.Country.Name = this.ddlCountry.SelectedItem.Text;
        city.ProvinceName = this.ddlState.SelectedValue;

        TERMS.Common.Address address = new TERMS.Common.Address(city, this.txtStreet.Text, this.txtZip.Text);

        contact.Person.AddAddress(address);

        TERMS.Common.Country country = new TERMS.Common.Country();

        country.Code = this.ddlCountry.SelectedValue;

        Phone phone = new Phone(country, this.ddlState.SelectedValue, this.txtPhoneDay.Text, string.Empty);
        phone.ContactOptions = ContactOptions.DayTime;
        contact.Person.AddPhone(phone);

        phone = new Phone(country, this.ddlState.SelectedValue, this.txtPhoneNight.Text, string.Empty);
        phone.ContactOptions = ContactOptions.NightTime;
        contact.Person.AddPhone(phone);

        contact.Person.Email = this.txtEmail.Text;

        phone = new Phone(country, this.ddlState.SelectedValue, this.txtFax.Text, string.Empty);
        phone.ContactOptions = ContactOptions.Office;
        contact.Person.AddFax(phone);

        Utility.Transaction.CurrentTransactionObject.AddContact(contact);

        return true;
    }