using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using YTech.ShipperInterface.UPS;
using YTech.ShipperInterface.UPS.Tracking;
namespace YTech.ShippingInterfaceSample
{
/// <summary>
/// A test form for testing shipping information
/// </summary>
public class frmTracking : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl shipperTabs;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.TextBox txtLicenseNumber;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtTrackingNumber;
private System.Windows.Forms.Button cmdTrack;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.DataGrid dgTrackingInfo;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frmTracking()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.shipperTabs = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.txtPassword = new System.Windows.Forms.TextBox();
this.txtUserName = new System.Windows.Forms.TextBox();
this.txtLicenseNumber = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtTrackingNumber = new System.Windows.Forms.TextBox();
this.cmdTrack = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label5 = new System.Windows.Forms.Label();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label6 = new System.Windows.Forms.Label();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.label7 = new System.Windows.Forms.Label();
this.dgTrackingInfo = new System.Windows.Forms.DataGrid();
this.shipperTabs.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgTrackingInfo)).BeginInit();
this.SuspendLayout();
//
// shipperTabs
//
this.shipperTabs.Controls.Add(this.tabPage1);
this.shipperTabs.Controls.Add(this.tabPage2);
this.shipperTabs.Controls.Add(this.tabPage3);
this.shipperTabs.Controls.Add(this.tabPage4);
this.shipperTabs.Location = new System.Drawing.Point(8, 8);
this.shipperTabs.Name = "shipperTabs";
this.shipperTabs.SelectedIndex = 0;
this.shipperTabs.Size = new System.Drawing.Size(488, 240);
this.shipperTabs.TabIndex = 7;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.txtPassword);
this.tabPage1.Controls.Add(this.txtUserName);
this.tabPage1.Controls.Add(this.txtLicenseNumber);
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.label2);
this.tabPage1.Controls.Add(this.txtTrackingNumber);
this.tabPage1.Controls.Add(this.cmdTrack);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.label1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(480, 214);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "UPS";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(128, 124);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(160, 20);
this.txtPassword.TabIndex = 19;
this.txtPassword.Text = "";
//
// txtUserName
//
this.txtUserName.Location = new System.Drawing.Point(128, 90);
this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(160, 20);
this.txtUserName.TabIndex = 18;
this.txtUserName.Text = "";
//
// txtLicenseNumber
//
this.txtLicenseNumber.Location = new System.Drawing.Point(128, 56);
this.txtLicenseNumber.Name = "txtLicenseNumber";
this.txtLicenseNumber.Size = new System.Drawing.Size(160, 20);
this.txtLicenseNumber.TabIndex = 17;
this.txtLicenseNumber.Text = "";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(72, 126);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(57, 16);
this.label4.TabIndex = 16;
this.label4.Text = "Password:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(40, 58);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(90, 16);
this.label2.TabIndex = 14;
this.label2.Text = "License Number:";
//
// txtTrackingNumber
//
this.txtTrackingNumber.Location = new System.Drawing.Point(128, 22);
this.txtTrackingNumber.Name = "txtTrackingNumber";
this.txtTrackingNumber.Size = new System.Drawing.Size(160, 20);
this.txtTrackingNumber.TabIndex = 11;
this.txtTrackingNumber.Text = "";
//
// cmdTrack
//
this.cmdTrack.Location = new System.Drawing.Point(136, 168);
this.cmdTrack.Name = "cmdTrack";
this.cmdTrack.Size = new System.Drawing.Size(72, 24);
this.cmdTrack.TabIndex = 13;
this.cmdTrack.Text = "Track";
this.cmdTrack.Click += new System.EventHandler(this.cmdTrack_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(64, 92);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 16);
this.label3.TabIndex = 15;
this.label3.Text = "User Name:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(32, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(94, 16);
this.label1.TabIndex = 12;
this.label1.Text = "Tracking Number:";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.label5);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(320, 214);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "FedEx";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label5.Location = new System.Drawing.Point(88, 80);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(146, 22);
this.label5.TabIndex = 0;
this.label5.Text = "Not Yet Supported";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.label6);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(320, 214);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "DHL";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label6.Location = new System.Drawing.Point(87, 96);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(146, 22);
this.label6.TabIndex = 1;
this.label6.Text = "Not Yet Supported";
//
// tabPage4
//
this.tabPage4.Controls.Add(this.label7);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(320, 214);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "USPS";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label7.Location = new System.Drawing.Point(87, 96);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(146, 22);
this.label7.TabIndex = 1;
this.label7.Text = "Not Yet Supported";
//
// dgTrackingInfo
//
this.dgTrackingInfo.DataMember = "";
this.dgTrackingInfo.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dgTrackingInfo.Location = new System.Drawing.Point(8, 256);
this.dgTrackingInfo.Name = "dgTrackingInfo";
this.dgTrackingInfo.Size = new System.Drawing.Size(488, 280);
this.dgTrackingInfo.TabIndex = 8;
//
// frmTracking
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(504, 542);
this.Controls.Add(this.dgTrackingInfo);
this.Controls.Add(this.shipperTabs);
this.Name = "frmTracking";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Shipper Tracking Interface";
this.shipperTabs.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgTrackingInfo)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmTracking());
}
private void cmdTrack_Click(object sender, System.EventArgs e)
{
AccessRequest ar;
TrackingRequest tr;
TrackingResponse trackResponse;
tr = new YTech.ShipperInterface.UPS.Tracking.TrackingRequest(txtTrackingNumber.Text, "1");
ar = new AccessRequest(txtLicenseNumber.Text, txtUserName.Text, txtPassword.Text);
trackResponse = tr.MakeRequest(ar);
dgTrackingInfo.DataSource = trackResponse.GetTrackingInfo();
}
}
}