コード例 #1
0
    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;
    }
コード例 #2
0
    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;
    }
コード例 #3
0
    public bool PaddingPassengerInfo()
    {
        if (string.IsNullOrEmpty(ddlState.SelectedValue))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Please select state.');</script>");
            return false;
        }

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

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

        Payment payment = null;

        if (ddlPaymentType.SelectedValue == "1")
        {
            payment = new Check();
        }

        if (ddlPaymentType.SelectedValue == "2")
        {
            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.CompanyName = this.txtCompany.Text;

        payment.Payer.Person = new TERMS.Common.Person(this.txtFirst.Text, this.txtLast.Text);

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

        city.Name = this.txtCity.Text;

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

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

        payment.Payer.Person.AddAddress(address);

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

        country.Code = this.ddlState.SelectedValue;

        Phone phone = new Phone(country, "", this.txtTel.Text, this.txtExt.Text);

        phone.ContactOptions = ContactOptions.DayTime;

        payment.Payer.Person.AddPhone(phone);

        Utility.Transaction.CurrentTransactionObject.AddPayment(payment);

        return true;
    }
コード例 #4
0
    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;
    }