Esempio n. 1
0
        //필드로부터 ClassData 객체를 얻음
        private ClassData GetClassDataFromFields()
        {
            var output = new ClassData();

            int    year     = (int)numeric_year.Value;
            int    semester = (int)numeric_semester.Value;
            string code     = "";

            if (checkBox_class.Checked)
            {
                code = textBox_code.Text;
            }
            else
            {
                code = textBox_code.Text + "-" + String.Format("{0:00}", numeric_class.Value);
            }

            string name      = textBox_name.Text;
            string professor = textBox_professor.Text;
            string place     = textBox_place.Text;
            int    size      = (int)numeric_size.Value;
            int    grade     = (int)numeric_grade.Value;

            var timeList = new List <TimeSlot>();

            foreach (String timeStr in listBox_timeslot.Items)
            {
                string week      = timeStr.Substring(0, 3);
                int    startHour = int.Parse(timeStr.Substring(4, 2));
                int    startMin  = int.Parse(timeStr.Substring(7, 2));
                int    endHour   = int.Parse(timeStr.Substring(12, 2));
                int    endMin    = int.Parse(timeStr.Substring(15, 2));

                var timeslot = new TimeSlot();
                timeslot.week      = week;
                timeslot.startTime = new HourMin(startHour, startMin);
                timeslot.endTime   = new HourMin(endHour, endMin);
                timeList.Add(timeslot);
            }

            output.year      = year;
            output.semester  = semester;
            output.code      = code;
            output.name      = name;
            output.professor = professor;
            output.place     = place;
            output.size      = size;
            output.grade     = grade;
            output.time      = timeList;


            return(output);
        }
Esempio n. 2
0
        //필드를 인덱스에 따라 업데이트
        private void SetFields(int index)
        {
            try {
                if (classArray == null || classArray.Count < index)
                {
                    MessageBox.Show("SetFields 실패");
                    return;
                }
                ClearFields();

                label_current_index.Text = (curIndex + 1).ToString() + "/" + (classArray.Count).ToString();

                ClassData _class = classArray[index];

                numeric_year.Value     = _class.year;
                numeric_semester.Value = _class.semester;
                textBox_code.Text      = ClassData.GetCodeFromFullCode(_class.code);

                int classNumber = ClassData.GetClassFromFullCode(_class.code);
                if (classNumber == -1)
                {
                    checkBox_class.Checked = true;
                }
                else
                {
                    checkBox_class.Checked = false;
                    numeric_class.Value    = classNumber;
                }

                textBox_name.Text      = _class.name;
                textBox_professor.Text = _class.professor;
                textBox_place.Text     = _class.place;
                numeric_size.Value     = _class.size;
                numeric_grade.Value    = _class.grade;


                foreach (var timeslot in _class.time)
                {
                    AddTimeSlot(timeslot);
                }
            } catch (Exception ex) {
            }
        }