public IEnumerable <PairTime> GetAllPairTimes()
        {
            var pairTimes = new List <PairTime>();

            using (var databaseConnection = new SqlConnection(_connString))
            {
                databaseConnection.Open();
                using (var command = new SqlCommand(getAllPairTimes, databaseConnection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var pairTime = new PairTime()
                            {
                                PairStart  = (TimeSpan)reader["PairStart"],
                                PairEnd    = (TimeSpan)reader["PairEnd"],
                                PairNumber = (int)reader["PairNumber"]
                            };
                            pairTimes.Add(pairTime);
                        }
                    }
                }
            }
            return(pairTimes);
        }
Exemplo n.º 2
0
 public ChangePairTimeDialog(PairTime selectedTime, List <PairTime> displayedPairTimes)
 {
     InitializeComponent();
     ExistingPairTimes     = displayedPairTimes;
     OldTime               = selectedTime;
     StartTimePicker.Value = new DateTime() + selectedTime.PairStart;
     EndTimePicker.Value   = new DateTime() + selectedTime.PairEnd;
 }
        public static PairTime Parse(string content, PairTime defaultTime, out string reducedText)
        {
            PairTime time = ParseTime(content) ?? defaultTime;

            reducedText = RemoveTime(content);

            return(ParseLongPair(content, ref reducedText, time));;
        }
        private static PairTime ParseLongPair(string content, ref string reducedText, PairTime time)
        {
            bool hasLongPair = PartParseHelper.CheckEntry(content, LongPairPattern);

            if (!hasLongPair)
            {
                return(time);
            }

            reducedText = PartParseHelper.RemoveEntries(reducedText, LongPairPattern);
            return(new PairTime(time.Start, 4));
        }