public UCSubjectItem(String subjectID, String year, String term, SelectClassWindow selectClassWindow)
        {
            InitializeComponent();
            this.subjectID         = subjectID;
            this.year              = year;
            this.term              = term;
            this.selectClassWindow = selectClassWindow;

            tbIDSubject.Text = subjectID;
        }
Exemple #2
0
        public UCSelectClass(SelectClassWindow selectClassWindow)
        {
            InitializeComponent();
            this.selectClassWindow = selectClassWindow;
            String currYear = DateTime.Now.Year.ToString();
            String pathYear = Gobal.SUBJECT_PATH + "/" + currYear;

            if (!Directory.Exists(pathYear))
            {
                Directory.CreateDirectory(pathYear);
                for (int i = 1; i < 3; i++)
                {
                    String term     = i + "";
                    String pathTerm = Gobal.SUBJECT_PATH + "/" + currYear + "/" + term;
                    if (!Directory.Exists(pathTerm))
                    {
                        Directory.CreateDirectory(pathTerm);
                    }
                }
            }
            String[] dirYear = Directory.GetDirectories(Gobal.SUBJECT_PATH);
            for (int i = 0; i < dirYear.Length; i++)
            {
                dirYear[i] = dirYear[i].Remove(0, (Gobal.SUBJECT_PATH + "\\").Length);
                cbYear.Items.Add(dirYear[i]);
            }
            cbYear.Text = currYear;
            String[] dirTerm = Directory.GetDirectories(Gobal.SUBJECT_PATH + "/" + currYear);

            for (int j = 0; j < dirTerm.Length; j++)
            {
                String s = Gobal.SUBJECT_PATH + "/" + currYear + "\\";
                dirTerm[j] = dirTerm[j].Remove(0, s.Length);
                cbTerm.Items.Add(dirTerm[j]);
            }
            cbTerm.SelectedItem = "1";
        }