private void Donloadresults_Click(object sender, EventArgs e)
        {
            String result = "Класс: " + group.ToString() + "\n";

            result += "Количество пройденных тестов: " + totalTests + "\n";
            result += "Коэффициент благополучия класса: " + totalC + "\n";
            result += "Количество взаимных выборов: " + totalK + "\n";
            result += " __________________________________________________________________________________ " + "\n";
            result += "|                     ФИО                     |         Статус         | Сдан тест |" + "\n";
            result += "|_____________________________________________|________________________|___________|" + "\n";
            foreach (User currentUser in results.Keys)
            {
                result += "|";
                result += currentUser.ToString();
                int freeSpace = 45 - currentUser.ToString().Length;
                for (int i = 0; i < freeSpace; i++)
                {
                    result += " ";
                }
                result += "|";
                String statusName = statuses.ElementAt(currentUser.StatusId - 1).ToString();
                result += statusName;

                freeSpace = 24 - statusName.Length;
                for (int i = 0; i < freeSpace; i++)
                {
                    result += " ";
                }

                result += "|";
                if (results[currentUser].Count == 5)
                {
                    result += "Да ";
                }
                else
                {
                    result += "Нет";
                }
                result += "        ";
                result += "|" + "\n";
                result += "|_____________________________________________|________________________|___________|" + "\n";
            }
            if (saveFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            String filename = saveFileDialog.FileName;

            System.IO.File.WriteAllText(filename, result);
        }
 public TeacherForm(User user)
 {
     InitializeComponent();
     currentUser = user;
     group       = DBWork.getPupilGroup(currentUser.ClassId);
     this.Text  += " " + currentUser.ToString() + " " + group.ToString();
     results     = new Dictionary <User, List <Answer> >();
     totalTests  = 0;
     totalK      = 0;
     N           = 0;
     questions   = DBWork.getAllQuestions();
     statuses    = DBWork.getAllStatuses();
     countResults();
     fillTable();
     saveFileDialog        = new SaveFileDialog();
     saveFileDialog.Filter = "Text Files(*.txt)|*.txt";
 }
Esempio n. 3
0
        public QuestionForm(User user)
        {
            InitializeComponent();
            currentUser          = user;
            group                = DBWork.getPupilGroup(currentUser.ClassId);
            this.Text           += " " + currentUser.ToString() + " " + group.ToString();
            questions            = DBWork.getAllQuestions();
            answers              = new List <Answer>();
            currentQuestionIndex = 0;
            loadClassmates();

            TextQuestion.Text       = questions.ElementAt(currentQuestionIndex).ToString();
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;
            comboBox4.SelectedIndex = 0;
            comboBox5.SelectedIndex = 0;
        }