private void UpdateParcelDetails_Load(object sender, EventArgs e) { DataTable result = ParcelController.Get(trackNo); tbSenderName.Text = result.Rows[0].Field <string>(11); tbSenderContactNo.Text = result.Rows[0].Field <string>(14); cbIdtype.SelectedIndex = result.Rows[0].Field <byte>(12) - 1; idNumber.Text = result.Rows[0].Field <string>(13); tbSenderEmail.Text = result.Rows[0].Field <string>(15); tbSenderAddress.Text = result.Rows[0].Field <string>(16); tbSenderPosCode.Text = result.Rows[0].Field <string>(18); cbSenderLocation.Text = result.Rows[0].Field <string>(17); tbReceiverName.Text = result.Rows[0].Field <string>(19); tbReceiverContactNo.Text = result.Rows[0].Field <string>(20); tbReceiverEmail.Text = result.Rows[0].Field <string>(21); tbReceiverAddress.Text = result.Rows[0].Field <string>(22); tbReceiverPosCode.Text = result.Rows[0].Field <string>(24); cbReceiverLocation.Text = result.Rows[0].Field <string>(23); if (result.Rows[0].Field <bool>(2) == false) { rbParcel.Checked = true; } else { rbDocument.Checked = true; } tbPieces.Text = result.Rows[0].Field <byte>(3).ToString(); tbContent.Text = result.Rows[0].Field <string>(4); tbValueofContent.Text = result.Rows[0].Field <decimal>(5).ToString(); tbWeight.Text = result.Rows[0].Field <float>(6).ToString(); }
private void PopulateData(string trackingNo) { try { DataTable result = ParcelController.Get(Convert.ToInt32(trackingNo)); tNo.Text = result.Rows[0].Field <Int32>("tracking_number").ToString(); decimal deliveryFee = result.Rows[0].Field <decimal>("delivery_fee"); priceOrder.Text = deliveryFee.ToString(); decimal pickUpfee = result.Rows[0].Field <decimal>("pick_up_fee"); pickUpPriceOrder.Text = pickUpfee.ToString(); totalPayment.Text = (deliveryFee + pickUpfee).ToString(); SenderName.Text = result.Rows[0].Field <string>("sender_name"); SenderPhoneNo.Text = result.Rows[0].Field <string>("sender_phone"); byte SIDType = result.Rows[0].Field <byte>("sender_id_type"); if (SIDType == 1) { IDType.Text = "IC Number"; } else if (SIDType == 2) { IDType.Text = "Old IC Number"; } else { IDType.Text = "Passport"; } IDNo.Text = result.Rows[0].Field <string>("sender_id_number"); addressCheckout.Text = result.Rows[0].Field <string>("sender_address"); postcodeCheckout.Text = result.Rows[0].Field <string>("sender_postcode"); locationCheckout.Text = result.Rows[0].Field <string>("sender_location"); Repository repository = new Repository(); string[] arr = repository.GetCityAndStateFromPostCodeAndLocation(postcodeCheckout.Text, locationCheckout.Text); cityCheckout.Text = arr[0]; stateCheckout.Text = arr[1]; if (result.Rows[0].Field <bool>(1) == false) { ServiceType.Text = "Lodge In"; PickUpDateTitle.Visible = false; PickUpTimeTitle.Visible = false; RemarksTitle.Visible = false; } else { ServiceType.Text = "Pick Up"; DataTable result2 = ParcelController.GetPickUpInfo(Convert.ToInt32(trackingNo)); PickUpDate.Text = result2.Rows[0].Field <DateTime>("pick_up_date").ToShortDateString(); PickUpTime.Text = result2.Rows[0].Field <TimeSpan>("pick_up_time").ToString(); Remarks.Text = result2.Rows[0].Field <string>("remark"); } ReceiverName.Text = result.Rows[0].Field <string>(19); ReceiverPhoneNo.Text = result.Rows[0].Field <string>(20); ReceiverAddress.Text = result.Rows[0].Field <string>(22); ReceiverPostal.Text = result.Rows[0].Field <string>(24); ReceiverLocation.Text = result.Rows[0].Field <string>(23); string[] arr2 = repository.GetCityAndStateFromPostCodeAndLocation(ReceiverPostal.Text, ReceiverLocation.Text); ReceiverCity.Text = arr2[0]; ReceiverState.Text = arr2[1]; if (result.Rows[0].Field <bool>(2) == false) { ParcelType.Text = "Parcel"; } else { ParcelType.Text = "Document"; } Piece.Text = result.Rows[0].Field <byte>(3).ToString(); Content.Text = result.Rows[0].Field <string>(4); Value.Text = result.Rows[0].Field <decimal>(5).ToString(); Weight.Text = result.Rows[0].Field <float>(6).ToString(); } catch (NullReferenceException) { Response.Write("Payment Not Successfully!"); } }