示例#1
0
 public void CheckFedEx(int OrderID)
 {
     IRepository <Orders> Orders = new GenericRepository <Orders>(db);
     Orders      order           = Orders.Get(OrderID);
     TrackOrder  track           = new TrackOrder(order, order.Packages.First());
     TrackResult result          = track.Track();
 }
示例#2
0
        /// <summary>
        /// Invokes the NewTrackResult event
        /// </summary>
        /// <param name="result">The results of the current frame track</param>
        protected virtual void OnTrackResult(T result)
        {
            TrackResult handler = NewTrackResult;

            if (handler != null)
            {
                handler(result);
            }
        }
示例#3
0
 public void CheckDHL(int OrderID)
 {
     Orders      order  = db.Orders.Find(OrderID);
     TrackOrder  track  = new TrackOrder(order, order.Packages.First(p => p.IsEnable.Value));
     TrackResult result = track.Track();
 }
示例#4
0
        protected void TrackBtn_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("Track!");
            ImageDisplay.Visible    = false;
            MapDisplayPanel.Visible = true;
            ErrorMessage.Visible    = false;
            statusList.Clear();

            TrackResult tr = ParcelController.Track(TrackingNumber.Text);

            if (tr != null)
            {
                List <TrackRecord> records = tr.Records;

                ParcelStatusRepeater.Visible = (tr.Status != 0 && tr.Status != 1);
                ShowMoreBtn.Visible          = (tr.Status != 0 && tr.Status != 1);
                MapPanel.Visible             = (tr.Status != 0 && tr.Status != 1);

                ParcelStatus.Text = tr.Status.ToString();

                if (tr.Status != 0 && tr.Status != 1)
                {
                    for (int i = 0; i < records.Count; i++)
                    {
                        ParcelStatus parcelStatus;
                        if (i == 0)
                        {
                            string status = string.Empty;
                            if (tr.Status == 2 || tr.Status == 3 || tr.Status == 5)
                            {
                                switch (tr.Status)
                                {
                                case 2:
                                    status             = "Pending in " + records[i].Departure;
                                    DepBranch.Text     = records[i].DeparturePoint;
                                    DepBranchName.Text = records[i].Departure + " Branch";
                                    ArrBranch.Text     = "";
                                    ArrBranchName.Text = "";
                                    break;

                                case 3:
                                    status             = "Pending transit from " + records[i].Departure + " to " + records[i].Arrival;
                                    DepBranch.Text     = records[i].DeparturePoint;
                                    DepBranchName.Text = records[i].Departure + " Branch";
                                    ArrBranch.Text     = records[i].ArrivalPoint;
                                    ArrBranchName.Text = records[i].Arrival + " Branch";
                                    break;

                                case 5:
                                    status             = "Pending delivery from " + records[i].Departure + " to receiver address";
                                    DepBranch.Text     = records[i].DeparturePoint;
                                    DepBranchName.Text = records[i].Departure + " Branch";
                                    ArrBranch.Text     = "";
                                    ArrBranchName.Text = "";
                                    break;
                                }
                                parcelStatus = new ParcelStatus("...", "...", status);
                            }
                            else if (tr.Status == 4)
                            {
                                parcelStatus = new ParcelStatus(
                                    records[i].DepartureDateTime?.ToShortDateString(),
                                    records[i].DepartureDateTime?.ToShortTimeString(),
                                    "Transiting from " + records[i].Departure + " to " + records[i].Arrival);
                                DepBranch.Text     = records[i].DeparturePoint;
                                DepBranchName.Text = records[i].Departure + " Branch";
                                ArrBranch.Text     = records[i].ArrivalPoint;
                                ArrBranchName.Text = records[i].Arrival + " Branch";
                            }
                            else if (tr.Status == 6)
                            {
                                status             = "Delivering from " + records[i].Departure + " to receiver address";
                                DepBranch.Text     = records[i].DeparturePoint;
                                DepBranchName.Text = records[i].Departure + " Branch";
                                ArrBranch.Text     = "";
                                ArrBranchName.Text = "";
                                parcelStatus       = new ParcelStatus(
                                    records[i].DepartureDateTime?.ToShortDateString(),
                                    records[i].DepartureDateTime?.ToShortTimeString(),
                                    status);
                            }
                            else    // 7
                            {
                                status             = "Delivered to receiver address";
                                DepBranch.Text     = "";
                                DepBranchName.Text = "";
                                ArrBranch.Text     = "";
                                ArrBranchName.Text = "";
                                parcelStatus       = new ParcelStatus(
                                    records[i].ArrivalDateTime?.ToShortDateString(),
                                    records[i].ArrivalDateTime?.ToShortTimeString(),
                                    status);
                                ImageDisplay.ImageUrl   = "Images/delivered.png";
                                ImageDisplay.Visible    = true;
                                MapDisplayPanel.Visible = false;
                            }
                        }
                        else        // previous transit
                        {
                            parcelStatus = new ParcelStatus(
                                records[i].ArrivalDateTime?.ToShortDateString(),
                                records[i].ArrivalDateTime?.ToShortTimeString(),
                                "Transited from " + records[i].Departure + " to " + records[i].Arrival);
                        }
                        statusList.Add(parcelStatus);
                    }
                }
                else
                {
                    ImageDisplay.ImageUrl   = "Images/pending.png";
                    ImageDisplay.Visible    = true;
                    MapDisplayPanel.Visible = false;
                    ErrorMessage.ForeColor  = System.Drawing.Color.Red;
                    ErrorMessage.Text       = "Parcel is pending";
                    ErrorMessage.Visible    = true;
                }
            }
            else
            {
                ImageDisplay.ImageUrl        = "Images/not-found.png";
                ImageDisplay.Visible         = true;
                MapDisplayPanel.Visible      = false;
                ParcelStatusRepeater.Visible = false;
                ShowMoreBtn.Visible          = false;
                MapPanel.Visible             = false;
                ErrorMessage.ForeColor       = System.Drawing.Color.Red;
                ErrorMessage.Text            = "Parcel not found";
                ErrorMessage.Visible         = true;
            }

            List <ParcelStatus> resultList = new List <ParcelStatus>();
            int count = (statusList.Count < limit ? statusList.Count : limit);

            for (int i = 0; i < count; i++)
            {
                resultList.Add(statusList[i]);
            }

            ShowMoreBtn.Visible = (statusList.Count > limit);

            ParcelStatusRepeater.DataSource = resultList;
            ParcelStatusRepeater.DataBind();
        }
示例#5
0
 void Track_PlayStopped(object sender, Player.StopEventArgs e)
 {
     switch (e.Reason)
     {
         case StopReason.Finished: this._Result = TrackResult.Success; break;
         case StopReason.Aborted: this._Result = TrackResult.Aborted; break;
         default: this._Result = TrackResult.Error; break;
     }
     this.StateChanged(this, new EventArgs());
 }
示例#6
0
 static public Track Parse(string Line, PlaylistFormat Format)
 {
     switch (Format)
     {
         case PlaylistFormat.Auto:
             throw new ArgumentException("Format recognition is not supported at track level.");
         case PlaylistFormat.Internal:
             string State = Line.Substring(0, 1);
             string Path = System.IO.Path.GetFullPath(Line.Substring(2));
             Track Track = new Track(Path);
             switch (State)
             {
                 case "Q": Track._Result = TrackResult.None; break;
                 case "A": Track._Result = TrackResult.Aborted; break;
                 case "D": Track._Result = TrackResult.Success; break;
                 case "S": Track._Result = TrackResult.None; Track._Excluded = true; break;
                 default: Track._Result = TrackResult.Error; break;
             }
             return Track;
         case PlaylistFormat.M3U:
             try
             {
                 string[] Lines = Line.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                 Track M3UTrack = new Track(System.IO.Path.GetFullPath(Lines[1].Trim().Trim(new char[] { '\r' })));
                 M3UTrack._Result = TrackResult.None;
                 return M3UTrack;
             }
             catch { throw new ArgumentException("The specified playlist line could not be recognized."); }
     }
     throw new ArgumentException("The specified playlist format is not supported.");
 }
示例#7
0
 public void Reset()
 {
     if (this.Initialized) { this.StopFinal(StopReason.Aborted); }
     this.ResetParameters();
     this._Excluded = false;
     this._Result = TrackResult.None;
     this.StateChanged(this, new EventArgs());
 }