예제 #1
0
        private void UpdateBtn_Click(object sender, EventArgs e)
        {
            const string message = "Are you confirm to update the parcel infomation? ";
            const string caption = "Update Information";
            var          result  = MessageBox.Show(message, caption,
                                                   MessageBoxButtons.YesNo,
                                                   MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.Yes)
            {
                PersonInfo senderUpdated = new PersonInfo(tbSenderName.Text, tbSenderEmail.Text, tbSenderContactNo.Text, tbSenderAddress.Text,
                                                          tbSenderPosCode.Text, cbSenderLocation.Text, tbSenderCity.Text, tbSenderState.Text);
                PersonInfo receiverUpdated = new PersonInfo(tbReceiverName.Text, tbReceiverEmail.Text, tbReceiverContactNo.Text, tbReceiverAddress.Text,
                                                            tbReceiverPosCode.Text, cbReceiverLocation.Text, tbReceiverCity.Text, tbReceiverState.Text);
                ParcelController.Update(trackNo, Convert.ToByte((cbIdtype.SelectedIndex) + 1), idNumber.Text, senderUpdated, receiverUpdated);
                MessageBox.Show("Update Success!");
                // cancel the closure of the form.
                this.Close();
                admin.registerHereLoad();
            }
        }