private void UpdateState() { if (superTabControl1.TabPages.Count == 0) { return; } richTextBoxState.Text = ""; System.Collections.ArrayList listChooseDiscip = new System.Collections.ArrayList(); System.Collections.ArrayList listCorrectData = new System.Collections.ArrayList(); for (int i = 0; i < superTabControl1.TabPages.Count; i++) { PageWorkPlanManager manager = (PageWorkPlanManager)superTabControl1.TabPages[i].Tag; if (!manager.IsDisciplineChoosen) { listChooseDiscip.Add(manager.fileName); } if (!manager.IsDataCorrect) { listCorrectData.Add(manager.fileName); } } if (listChooseDiscip.Count == 0 && listCorrectData.Count == 0) { richTextBoxState.Text = "Данные готовы к сохранению"; return; } if (listChooseDiscip.Count != 0) { string text = "Выберите название загружаемой дисциплины для следующих файлов:\n"; for (int i = 0; i < listChooseDiscip.Count; i++) { text += listChooseDiscip[i].ToString() + "\n"; } richTextBoxState.AppendText(text); } if (listCorrectData.Count != 0) { string text = "В следующих файлах обнаружены незагруженные в базу компетенции, они помечены жёлтым. Удалите их из списка загрузки:\n"; for (int i = 0; i < listCorrectData.Count; i++) { text += listCorrectData[i].ToString() + "\n"; } richTextBoxState.AppendText(text); } }
private void LoadData(string[] FileNames, string[] Names) { superTabControl1.TabPages.Clear(); string kod_specialty = managerSpecialty.GetCellValue(comboBoxSpecialty.SelectedIndex, "KOD"); long id_specialization = Convert.ToInt64(managerSpecialization.GetCellValue(comboBoxSpecialization.SelectedIndex, "ID")); for (int i = 0; i < FileNames.Length; i++) { ReaderWorkPlan reader = new ReaderWorkPlan(FileNames[i]); string nameDisp = ""; string[] Competence = reader.ReadCompetenceKod(ref nameDisp); if (Competence == null || Competence.Length == 0) { continue; } TabPage page = new TabPage(Names[i]); superTabControl1.TabPages.Add(page); PageWorkPlanManager manager = new PageWorkPlanManager(Names[i], nameDisp, page, kod_specialty, id_specialization, Competence); page.Tag = manager; } UpdateState(); }
private void buttonSave_Click(object sender, EventArgs e) { if (superTabControl1.TabPages.Count == 0) { return; } for (int i = 0; i < superTabControl1.TabPages.Count; i++) { PageWorkPlanManager manager = (PageWorkPlanManager)superTabControl1.TabPages[i].Tag; if (!manager.IsDataCorrect || !manager.IsDisciplineChoosen) { UpdateState(); MessageBox.Show("Данные не готовы к загрузке.", "Уведомление"); return; } } for (int i = 0; i < superTabControl1.TabPages.Count; i++) { PageWorkPlanManager manager = (PageWorkPlanManager)superTabControl1.TabPages[i].Tag; manager.Save(); } MessageBox.Show("Данные успешно сохранены", "Уведомление"); superTabControl1.TabPages.Clear(); }