Example #1
0
    private List <TrafficMessage> Searching(System.Object tsearchParam)
    {
        SearchParam      searchParam   = tsearchParam as SearchParam;
        int              type          = searchParam.type;
        string           startlocation = searchParam.startlocation;
        string           stoplocation  = searchParam.stoplocation;
        DateTime         dt            = searchParam.dt;
        RoutineOperation operation     = new RoutineOperation();
        List <Routine>   tickets       = operation.GetAllTicket(startlocation, stoplocation, type, dt);

        List <TrafficMessage> data = new List <TrafficMessage>();

        foreach (RoutineTicket rt in tickets)
        {
            DateTime starttime = rt.GetActualBeginTime();

            if (DateTime.Compare(starttime, TimeManager.instance.NowTime) > 0)
            {
                DateTime stoptime = rt.GetAcutalEndTime();

                string start = rt.GetRoutineStartNode();
                string stop  = rt.GetEndNode();

                string ticketname = rt.GetTicketName();
                string money      = rt.GetMoney() + "";

                int id = rt.GetRoutineId();

                TimeSpan ts = stoptime - starttime;

                string usetime = "";
                if (ts.Hours < 10)
                {
                    usetime += "0";
                }
                usetime += ts.Hours + ":";
                if (ts.Minutes < 10)
                {
                    usetime += "0";
                }
                usetime += ts.Minutes;

                if ((DateTime.Compare(starttime, rt.GetBeginTime()) == 0) && (DateTime.Compare(stoptime, rt.GetEndTime()) == 0))
                {
                    data.Add(new TrafficMessage(starttime.ToString("HH:mm"), start, usetime, ticketname, stoptime.ToString("HH:mm"), stop, money, true, false, id, (TrafficType)rt.Type()));
                }
                else
                {
                    data.Add(new TrafficMessage(starttime.ToString("HH:mm"), start, usetime, ticketname, stoptime.ToString("HH:mm"), stop, money, true, true, id, (TrafficType)rt.Type()));
                }
            }
        }
        return(data);
    }