Exemplo n.º 1
0
        public void CreateSequentialStopInfo(long stationCodeF, long stationCodeS)
        {
            string exception      = "";
            bool   foundException = false;

            try
            {
                //goodCode
            }
            catch (Exception ex)
            {
                exception     += ex.Message;
                foundException = true;
            }
            try
            {
                //goodCode
            }
            catch (Exception ex)
            {
                exception     += ex.Message;
                foundException = true;
            }
            if (foundException)
            {
                throw new Exception(exception);
            }
            Stop               stopA                = GetStop(stationCodeF);
            Stop               stopB                = GetStop(stationCodeS);
            double             distance             = GteDistance(stopA.Latitude, stopA.Longitude, stopB.Latitude, stopB.Longitude);
            SequentialStopInfo SequentialStopInfoBO = new SequentialStopInfo(stationCodeF, stationCodeS, distance, TimeSpan.FromSeconds(distance / 50));  //@@@@ /

            DO.SequentialStopInfo SequentialStopInfoDO = SequentialStopInfoBO.GetPropertiesFrom <DO.SequentialStopInfo, BO.SequentialStopInfo>();
            dal.CreateSequentialStopInfo(SequentialStopInfoDO);
        }
        /// <summary>
        /// request a SequentialStopInfo according to a predicate
        /// </summary>
        /// <param name="firstId"></param>
        /// <param name="secondId"></param>
        /// <returns></returns>
        public SequentialStopInfo RequestSequentialStopInfo(Predicate <SequentialStopInfo> pr)
        {
            SequentialStopInfo ret = DataSource.SequentialStopInfoList.Find(seqStop => pr(seqStop));

            if (ret == null)
            {
                throw new Exception("no seqStop that meets these conditions!");
            }
            if (ret.Valid == false)
            {
                throw new Exception("seqStop that meets these conditions is not valid");
            }
            return(ret.GetPropertiesFrom <SequentialStopInfo, SequentialStopInfo>());
        }