Пример #1
0
        private List <ClassInfo> AddClassInfoToList(DataTable dataTable, List <OnlineClassInfo> onlineClass)
        {
            List <ClassInfo> classList = new List <ClassInfo>();

            foreach (DataRow dataTableRow in dataTable.Rows)
            {
                try
                {
                    if (int.TryParse(dataTableRow.ItemArray[0].ToString(), out _))
                    {
                        ClassInfo classInfo = new ClassInfo(dataTableRow, onlineClass);
                        classInfo.EncodeDurationTime(_timerList);
                        classList.Add(classInfo);
                    }
                }
                catch (Exception e)
                {
                    File.AppendAllText("Exception.txt", $@"{e.Message} ----- ReadExcelFile{Environment.NewLine}");
                    continue;
                }
            }

            return(classList);
        }