Esempio n. 1
0
        public static bool TryParse(List <string> strings, List <HistoryDate> results)
        {
            HistoryDate temp = null;

            try
            {
                foreach (var item in strings)
                {
                    temp = new HistoryDate();
                    HistoryDate.TryParse(item, out temp);
                    results.Add(temp);
                }
                if (strings.Count == results.Count)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(false);
        }
Esempio n. 2
0
        public static bool TryParse(string s, out HistoryDate result)
        {
            result = null;
            var parts = s.Split(',');

            if (parts.Length != 2)
            {
                return(false);
            }

            DateTime scheduleDate = new DateTime();
            bool     isWeekend    = false;

            if (DateTime.TryParse(parts[0], out scheduleDate) && bool.TryParse(parts[1], out isWeekend))
            {
                result = new HistoryDate()
                {
                    ScheduleDate = scheduleDate,
                    IsWeekend    = isWeekend
                };
                return(true);
            }
            return(false);
        }