private void ConfirmBtn_Click(object sender, EventArgs e) { string message = "Do you want to confirm the parcel details?"; string caption = "Confirmation"; MessageBoxButtons buttons = MessageBoxButtons.OKCancel; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.Cancel) { // Closes the parent form. this.Close(); } else { int senderIDType = 0; if (cbIdtype.Text == "IC Number") { senderIDType = 1; } else if (cbIdtype.Text == " Old IC Number") { senderIDType = 2; } else { senderIDType = 3; } bool parcelTypeResult; if (rbParcel.Checked) { parcelTypeResult = false; } else { parcelTypeResult = true; } PersonInfo sender1 = new PersonInfo(tbSenderName.Text, tbSenderEmail.Text, tbSenderContactNo.Text, tbSenderAddress.Text, tbSenderPosCode.Text, cbSenderLocation.Text, tbSenderCity.Text, tbSenderState.Text); PersonInfo receiver1 = new PersonInfo(tbReceiverName.Text, tbReceiverEmail.Text, tbReceiverContactNo.Text, tbReceiverAddress.Text, tbReceiverPosCode.Text, cbReceiverLocation.Text, tbReceiverCity.Text, tbReceiverState.Text); ParcelInfo parcelInfo = new ParcelInfo(false, parcelTypeResult, Convert.ToByte(tbPieces.Text), tbContent.Text, Convert.ToDecimal(tbValueofContent.Text), Convert.ToSingle(tbWeight.Text), Convert.ToDecimal(price.Text), 0); ParcelController.Create(Convert.ToByte(senderIDType), tbSenderidNumber.Text, sender1, receiver1, parcelInfo, Authentication.CurrentStaff.BranchId); MessageBox.Show("Add Success!"); this.Close(); admin.registerHereLoad(); } }
private void Button1_Click(object sender, EventArgs e) { branchId = staff.BranchId; int trackingNum = Convert.ToInt32(textBox1.Text); if (ParcelController.RegisterOnlineLodgeIn(trackingNum, branchId) == true) { MessageBox.Show("Successful Added"); textBox1.Text = ""; home.registerHereLoad(); } else { MessageBox.Show("Fail to add, please check again the tracking number"); textBox1.Text = ""; } }
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(); } }