示例#1
0
        private void tbSearch_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                // 중복 검사
                for (int i = 0; i < subject_group.Count; i++)
                {
                    if (subject[Convert.ToInt32(subject_group[i][0].index)].과목명 == tbSearch.Text)
                    {
                        MessageBox.Show("같은 과목이 이미 추가되었습니다.", Version.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }

                // 추가
                List <TimeElement>       subjects = new List <TimeElement>();
                List <Bot.SubjectStruct> ssl      = new List <Bot.SubjectStruct>();
                if (cbSearch.Text == "과목명")
                {
                    foreach (Bot.SubjectStruct ss in subject)
                    {
                        if (ss.과목명 == tbSearch.Text)
                        {
                            TimeElement te = TimeParser.Get(ss.시강);
                            te.index = ss.index.ToString();
                            subjects.Add(te);
                            ssl.Add(ss);
                        }
                    }
                }
                else if (cbSearch.Text == "학수번호")
                {
                    foreach (Bot.SubjectStruct ss in subject)
                    {
                        if (ss.학수번호 == tbSearch.Text)
                        {
                            TimeElement te = TimeParser.Get(ss.시강);
                            te.index = ss.index.ToString();
                            subjects.Add(te);
                            ssl.Add(ss);
                        }
                    }
                }
                if (ssl.Count == 0)
                {
                    return;
                }
                AppendSubjectsToList(ssl);
                subject_group.Add(subjects);
            }
        }
示例#2
0
        /// <summary>
        /// 선택한 과목을 테이블 뷰어에 추가한다.
        /// </summary>
        private void lvSearch_DoubleClick(object sender, EventArgs e)
        {
            if (lvSearch.SelectedItems.Count != 0)
            {
                TimeElement te = TimeParser.Get(lvSearch.SelectedItems[0].SubItems[8].Text);

                if (!tt.CheckOverlap(te))
                {
                    lvSearchAdd.Items.Add((ListViewItem)lvSearch.SelectedItems[0].Clone());
                    te.index = lvSearch.SelectedItems[0].SubItems[0].Text;
                    tt.Add(te);
                    view_table.Add(te);
                    Save();
                    DrawTimeTable(false);
                }
                else
                {
                    MessageBox.Show("이미 겹치는 항목이 존재합니다.", Version.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 세이브 파일 불러오기
        /// </summary>
        private void InitSaveData()
        {
            if (SaveExist())
            {
                foreach (string ix in Open().Split('|'))
                {
                    foreach (ListViewItem lvi in lvSearch.Items)
                    {
                        if (lvi.SubItems[0].Text == ix)
                        {
                            TimeElement te = TimeParser.Get(lvi.SubItems[8].Text);

                            lvSearchAdd.Items.Add((ListViewItem)lvi.Clone());
                            te.index = lvi.SubItems[0].Text;
                            tt.Add(te);
                            view_table.Add(te);
                        }
                    }
                }
                DrawTimeTable();
            }
        }
示例#4
0
 /// <summary>
 /// 조합 파일 불러오기
 /// </summary>
 private void Open()
 {
     try
     {
         string line;
         System.IO.StreamReader file = new System.IO.StreamReader(frmMain.PathCombinations);
         while ((line = file.ReadLine()) != null)
         {
             List <TimeElement> al = new List <TimeElement>();
             foreach (string ix in line.Split('|'))
             {
                 if (ix != "")
                 {
                     foreach (Bot.SubjectStruct ss in subject)
                     {
                         if (ss.index.ToString() == ix)
                         {
                             TimeElement te = TimeParser.Get(ss.시강);
                             te.index = ss.index.ToString();
                             al.Add(te);
                         }
                     }
                 }
             }
             txts.Add(al);
         }
         file.Close();
         if (txts.Count > 0)
         {
             view_table = txts[0];
         }
         if (txts.Count == 1)
         {
             bRight.Enabled = false;
         }
     }
     catch {  }
 }
示例#5
0
 public bool CheckOverlap(TimeElement te)
 {
     return(te.Overlap(table));
 }