예제 #1
0
 private void TryParseParametersForFilterAndTake(string takeCommand, string takeQuantity, string courseName, string filter)
 {
     if (takeCommand == "take")
     {
         if (takeQuantity == "all")
         {
             repository.FilterAndTake(courseName, filter, null);
         }
         else
         {
             int studentsToTake;
             var hasParsed = int.TryParse(takeQuantity, out studentsToTake);
             if (hasParsed)
             {
                 repository.FilterAndTake(courseName, filter, studentsToTake);
             }
             else
             {
                 OutputWriter.WriteMessageOnNewLine(ExceptionMessages.InvalidTakeQueryParamter);
             }
         }
     }
     else
     {
         OutputWriter.WriteMessageOnNewLine(ExceptionMessages.InvalidTakeQueryParamter);
     }
 }
예제 #2
0
 private static void TryParseParametersForFilterAndTake(string takeCommand, string takeQuantity, string courseName, string filter)
 {
     if (takeCommand == "take")
     {
         if (takeQuantity == "all")
         {
             StudentsRepository.FilterAndTake(courseName, filter);
         }
         else
         {
             int  studentsToTake;
             bool hasParsed = int.TryParse(takeQuantity, out studentsToTake);
             if (hasParsed)
             {
                 StudentsRepository.FilterAndTake(courseName, filter, studentsToTake);
             }
             else
             {
                 OutputWriter.DisplayException(ExceptionMessages.InvalidTakeQuantityParameter);
             }
         }
     }
     else
     {
         OutputWriter.DisplayException(ExceptionMessages.InvalidTakeQuantityParameter);
     }
 }
예제 #3
0
 private static void TryParseParametersForOrderAndTake(string takeCommand, string takeQuantity, string courseName, string comparison)
 {
     if (takeCommand == "take")
     {
         if (takeQuantity == "all")
         {
             StudentsRepository.OrderAndTake(courseName, comparison);
         }
         else
         {
             if (int.TryParse(takeQuantity, out int studentsToTake))
             {
                 StudentsRepository.FilterAndTake(courseName, comparison, studentsToTake);
             }
             else
             {
                 OutputWriter.DisplayException(ExceptionMessages.InvalidTakeQuantityParameter);
             }
         }
     }
     else
     {
         OutputWriter.DisplayException(ExceptionMessages.InvalidTakeQuantityParameter);
     }
 }