コード例 #1
0
        protected void cbDefaultAddress_CheckedChanged(object sender, EventArgs e)
        {
            if (Authentication.GetUid() != null)
            {
                if (cbDefaultAddress.Checked)
                {
                    Repository repository    = new Repository();
                    User       senderDefault = repository.GetUser(Authentication.GetUid());
                    SenderName.Text      = senderDefault.Name;
                    SenderContactNo.Text = senderDefault.PhoneNumber;

                    switch (senderDefault.IdType)
                    {
                    case 1:
                        IDType.Text = "IC Number";
                        break;

                    case 2:
                        IDType.Text = "Old IC Number";
                        break;

                    case 3:
                        IDType.Text = "Passport";
                        break;
                    }

                    //IDType.SelectedValue = (senderDefault.IdType + 1).ToString();

                    SenderIDNo.Text   = senderDefault.IdNumber;
                    SenderEmail.Text  = senderDefault.Email;
                    SenderAdd.Text    = senderDefault.Address;
                    SenderPostal.Text = senderDefault.Postcode;

                    ArrayList arr = repository.GetAreaFromPostCode(senderDefault.Postcode);
                    SenderLocation.Items.Clear();
                    SenderLocation.DataSource = arr;
                    SenderLocation.DataBind();
                    string[] arr2 = repository.GetCityAndStateFromPostCodeAndLocation(SenderPostal.Text, SenderLocation.Text);
                    SenderCity.Text  = arr2[0];
                    SenderState.Text = arr2[1];
                }
                else
                {
                    SenderName.Text      = "";
                    SenderContactNo.Text = "";
                    SenderIDNo.Text      = "";
                    SenderEmail.Text     = "";
                    SenderAdd.Text       = "";
                    SenderPostal.Text    = "";
                    SenderLocation.Items.Clear();
                    SenderCity.Text  = "";
                    SenderState.Text = "";
                }
            }
        }
コード例 #2
0
        protected void SenderPostal_TextChanged(object sender, EventArgs e)
        {
            SenderCity.Text  = "";
            SenderState.Text = "";
            TextBox textbox = sender as TextBox;

            if (textbox != null)
            {
                Repository repository = new Repository();
                ArrayList  arr        = repository.GetAreaFromPostCode(textbox.Text);
                SenderLocation.Items.Clear();
                SenderLocation.DataSource = arr;
                SenderLocation.DataBind();
                SenderLocation.Items.Insert(0, new ListItem(""));
            }
        }