Exemple #1
0
        /// <summary>
        /// List of stop per Run
        /// SttopApiController/Get
        /// </summary>
        /// <param name="iRunID"></param>
        /// <returns></returns>
        public async Task <List <Stop> > List(int iRunID)
        {
            var oStopRepository = new StopRepository();

            IDataReader oDataReader = null;

            try
            {
                oDataReader = await oStopRepository.List(iRunID);
            }
            catch (Exception)
            {
                throw;
            }

            var lstStops = new List <Stop>();

            while (oDataReader.Read())
            {
                var oStop = new Stop(oDataReader);
                oStop.Customer = new Customer(oDataReader);

                string sStatus = oDataReader.ReadColumn("Status_CD").Trim();
                oStop.CurrentStatus = await StopStatus.Instance(sStatus);

                lstStops.Add(oStop);
            }

            oDataReader.Close();

            return(lstStops);
        }
Exemple #2
0
        public static async Task <StopStatus> Instance(string sStatus)
        {
            var lstStopStatuses = await StopStatus.List();

            return(lstStopStatuses.FirstOrDefault(oStopStatus => String.Compare(oStopStatus.Code, sStatus, false) == 0));
        }