コード例 #1
0
        /// <summary>
        /// Handles the Click event of the btnRateMyShipment control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnRateMyShipment_Click(object sender, EventArgs e)
        {
            QuoteInfo quoteInfo = new QuoteInfo();
            QuoteItemsInfo[] quoteItemsInfo;

            FillQuoteDetails(out quoteInfo, out quoteItemsInfo);

            RateQuoteWebServiceReference.Service rateQuoteWebService = new RateQuoteWebServiceReference.Service();
            QuoteRates[] quoteRates = null;
            quoteRates = rateQuoteWebService.RateMyShipment(quoteInfo, quoteItemsInfo);
            if (quoteRates != null)
            {
                dgvRateMyShipment.DataSource = quoteRates;
            }
            else
            {
                dgvRateMyShipment.DataSource = null;
                MessageBox.Show("No carriers Found");
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the Click event of the btnConfirmShipment control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnConfirmShipment_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtIndex.Text))
            {
                MessageBox.Show("Carrier Index is Empty.");
                txtIndex.Focus();
            }
            else
            {
                RateQuoteWebServiceReference.Service rateQuoteWebService = new RateQuoteWebServiceReference.Service();

                Int32 productsCount;
                productsCount = 1;

                QuoteItemsInfo[] quoteItemsInfo = new QuoteItemsInfo[productsCount];
                quoteItemsInfo = InsertIntoQuoteItems(productsCount, quoteItemsInfo);

                ConfirmQuoteRequestInfo confirmation = new ConfirmQuoteRequestInfo();
                confirmation.AgreementAcceptance = true;
                confirmation.DeliveryRemarks = "test remark";
                confirmation.PickUpRemarks = "test remark";
                confirmation.PONo = "1000000";
                confirmation.QuoteItems = quoteItemsInfo;
                string RedayTime = string.Concat("07:00 PM");
                string CloseTime = string.Concat("09:00 PM");
                confirmation.ShipmentCloseTime = CloseTime;
                confirmation.ShipmentReadyTime = RedayTime;
                confirmation.ShipmentDate = DateTime.Now.AddDays(1);

                int index = Convert.ToInt32(txtIndex.Text);
                confirmation.SelectedCarrierCodeForShipment = dgvRateMyShipment.Rows[index].Cells[1].Value.ToString();
                confirmation.ServiceTransactionId = dgvRateMyShipment.Rows[index].Cells["ServiceTransactionId"].Value.ToString();
                confirmation.RefrenceNumber = "";
                confirmation.CustomerBOL = "";
                confirmation.ConsigneeAddress = new ShipmentAddress();
                confirmation.ConsigneeAddress.CompanyName = "Asik comp 1";
                confirmation.ConsigneeAddress.ContactPerson = "Asik AMjad 1";
                confirmation.ConsigneeAddress.Street = "1st street";
                confirmation.ConsigneeAddress.Fax = "";
                confirmation.ConsigneeAddress.Phone = "1234567890";
                confirmation.ConsigneeAddress.PhoneExtention = "1234";
                confirmation.ConsigneeAddress.City = "Auburn";
                confirmation.ConsigneeAddress.State = "WA";
                confirmation.ConsigneeAddress.ZipCode = "980001";
                confirmation.ConsigneeAddress.Country = "USA";

                confirmation.ShipperAddress = new ShipmentAddress();
                confirmation.ShipperAddress.CompanyName = "Asik Comp 2";
                confirmation.ShipperAddress.ContactPerson = "Asik AMjad 2";
                confirmation.ShipperAddress.Street = "2nd street";
                confirmation.ShipperAddress.Fax = "1111111111";
                confirmation.ShipperAddress.Phone = "2222222222";
                confirmation.ConsigneeAddress.PhoneExtention = "1234";
                confirmation.ShipperAddress.City = "Los Angeles";
                confirmation.ShipperAddress.State = "CA";
                confirmation.ShipperAddress.ZipCode = "10001";
                confirmation.ShipperAddress.Country = "USA";

                rateQuoteWebService.ConfirmShipmentCompleted += new ConfirmShipmentCompletedEventHandler(ser_ConfirmShipmentCompleted);

                textBoxBolNo.Text = Convert.ToString(rateQuoteWebService.ConfirmShipment(confirmation));
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles the Click event of the btnMyShipmentTrack control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnMyShipmentTrack_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxBolNo.Text))
            {
                MessageBox.Show("No Shipment available.");
            }
            else
            {
                RateQuoteWebServiceReference.Service rateQuoteWebService = new RateQuoteWebServiceReference.Service();

                TrackingInfo trackingInfo = new TrackingInfo();
                trackingInfo = rateQuoteWebService.GetMyShipmentTrack(Username, Password, textBoxBolNo.Text, "True");

                DataTable trackingDatatable = new System.Data.DataTable();

                foreach (PropertyInfo info in typeof(TrackingInfo).GetProperties())
                {
                    trackingDatatable.Columns.Add(info.Name, info.PropertyType);
                }

                trackingDatatable.AcceptChanges();
                DataRow trackingRow = trackingDatatable.NewRow();

                foreach (var property in trackingInfo.GetType().GetProperties())
                {
                    trackingRow[property.Name] = property.GetValue(trackingInfo, null);
                }

                trackingDatatable.Rows.Add(trackingRow);
                trackingDatatable.AcceptChanges();

                dgvShipmentTrack.DataSource = trackingDatatable;
            }
        }