예제 #1
0
        public void GetCustomer(Customer customer, SailsModule module)
        {
            ddlNationalities.DataSource     = module.NationalityGetAll();
            ddlNationalities.DataTextField  = "Name";
            ddlNationalities.DataValueField = "Id";
            ddlNationalities.DataBind();
            ddlNationalities.Items.Insert(0, "-- Nationality --");

            if (customer.Nationality != null)
            {
                ddlNationalities.SelectedValue = customer.Nationality.Id.ToString();
            }

            txtName.Text        = customer.Fullname;
            txtNationality.Text = customer.Country;
            if (customer.IsMale.HasValue)
            {
                if (customer.IsMale.Value)
                {
                    ddlGender.SelectedIndex = 1;
                }
                else
                {
                    ddlGender.SelectedIndex = 2;
                }
            }
            else
            {
                ddlGender.SelectedIndex = 0;
            }
            txtPassport.Text = customer.Passport;
            txtVisaNo.Text   = customer.VisaNo;
            if (customer.Birthday.HasValue)
            {
                txtBirthDay.Text = customer.Birthday.Value.ToString("dd/MM/yyyy");
            }

            if (customer.VisaExpired.HasValue)
            {
                txtVisaExpired.Text = customer.VisaExpired.Value.ToString("dd/MM/yyyy");
            }

            chkChild.Checked    = customer.IsChild;
            chkVietKieu.Checked = customer.IsVietKieu;
            txtCode.Text        = customer.Code;
            txtTotal.Text       = customer.Total.ToString();

            if (module.ModuleSettings(SailsModule.CUSTOMER_PRICE) == null || Convert.ToBoolean(module.ModuleSettings(SailsModule.CUSTOMER_PRICE)))
            {
                txtTotal.Visible = true;
            }
            else
            {
                txtTotal.Visible = false;
            }

            hiddenId.Value = customer.Id.ToString();

            switch (customer.Type)
            {
            case CustomerType.Adult:
                ddlCustomerType.SelectedIndex = 0;
                break;

            case CustomerType.Children:
                ddlCustomerType.SelectedIndex = 1;
                break;

            case CustomerType.Baby:
                ddlCustomerType.SelectedIndex = 2;
                break;
            }
        }