Exemplo n.º 1
0
 /// <summary>
 /// Upadte a line station
 /// </summary>
 /// <param name="lineStation"></param>
 public void UpdateLineStation(BO.LineStation lineStation)
 {
     try
     {
         var lineStationDo = lineStation.CopyPropertiesToNew(typeof(DO.LineStation)) as DO.LineStation;
         dl.UpdateLineStation(lineStationDo);
     }
     catch (DO.BadLineStationException ex)
     {
         throw new BO.BadLineStationException(lineStation.Station, lineStation.LineId, ex.Message);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Remove line station
        /// </summary>
        /// <param name="station"></param>
        public void RemoveLineStation(BO.LineStation station)
        {
            try
            {   /* A line must remain with at least two stations
                 * and therefore it is not possible to delete a station
                 * from a line that has only 2 left */
                if (GetLine(station.LineId).LineStations.Count() <= 2)
                {
                    throw new BO.BadLineStationException(station.Station, station.LineId,
                                                         "A line must remain with at least two stations");
                }

                var lineStationDo = station.CopyPropertiesToNew(typeof(DO.LineStation)) as DO.LineStation;
                dl.RemoveLineStation(lineStationDo);
            }
            catch (DO.BadLineStationException ex)
            {
                throw new BO.BadLineStationException(station.Station, station.LineId, ex.Message);
            }
        }