예제 #1
0
 void IDAL.AddLineExit(LineExit lineExit)
 {
     if (DataSource.LineExits.Exists(lineExit1 => lineExit1.BusLineID1 == lineExit.BusLineID1 && lineExit1.LineStartTime == lineExit.LineStartTime))
     {
         throw new ExceptionLineExit(lineExit.BusLineID1, lineExit.LineStartTime, "the LineExit alrdy exist in the list in the same time");
     }
     else
     {
         DataSource.LineExits.Add(lineExit.Clone());
     }
 }
예제 #2
0
        LineExit IDAL.ReturnLineExit(int lineNumber, TimeSpan StartTime)
        {
            LineExit lineExit = DataSource.LineExits.FirstOrDefault(lineExit1 => lineExit1.BusLineID1 == lineNumber && lineExit1.LineStartTime == StartTime);

            return(lineExit.Clone() ?? throw new ExceptionLineExit(lineNumber, StartTime, "the LineExit not exist in the list"));
        }
예제 #3
0
        void IDAL.UpdatingLineExit(LineExit lineExit)
        {
            int index = DataSource.LineExits.FindIndex(lineExit1 => lineExit1.BusLineID1 == lineExit.BusLineID1 && lineExit1.LineStartTime == lineExit.LineStartTime);

            DataSource.LineExits[index] = index == -1 ? throw new ExceptionLineExit(lineExit.BusLineID1, lineExit.LineStartTime, "The lineExit not exist in the compny") : lineExit.Clone();
        }