Esempio n. 1
0
 private void SaveTeachersToHTML_Click(object sender, EventArgs e)
 {
     foreach (var teacher in teachersListBox.Items)
     {
         HtmlSaver.SaveToHtml(teacher.ToString(), SchedlueMaker.GetTeacherByName(teacher.ToString()));
     }
 }
        private void OpenFileDialog_FileOk(object sender, CancelEventArgs e)
        {
            var grades      = new List <Grade>();
            var arrOfGrades = File.ReadAllText((sender as OpenFileDialog).FileName).Split('#');

            foreach (var gradeStr in arrOfGrades)
            {
                var grade  = new Grade(gradeStr.Substring(0, gradeStr.IndexOf('?') - 2));
                var strArr = gradeStr.Substring(gradeStr.IndexOf('?') + 1).Split('%');

                foreach (var str in strArr)
                {
                    var helpArr = str.Split('&');
                    grade.Subjects.Add(
                        new Subject(helpArr[0], int.Parse(helpArr[1]), int.Parse(helpArr[2])),
                        SchedlueMaker.GetOrCreateTeacherByName(helpArr[3].Substring(0, helpArr[3].Length - 2)));
                }

                grades.Add(grade);
            }

            SchedlueMaker.Grades = grades;
            listBoxOfGrades.Items.Clear();

            foreach (var schoolClass in grades)
            {
                CheckedList_AddItem(listBoxOfGrades, schoolClass.Name);
            }
        }
Esempio n. 3
0
 private void SaveClassesToHTML_Click(object sender, EventArgs e)
 {
     foreach (var grade in gradesListBox.Items)
     {
         HtmlSaver.SaveToHtml(grade.ToString(), SchedlueMaker.GetGradeByName(grade.ToString()));
     }
 }
Esempio n. 4
0
        private void FormTable_FormClosing(object sender, FormClosingEventArgs e)
        {
            var columnArray = new string[dataGridSubjects.Rows.Count];
            var grade       = new Grade(gradeName);

            foreach (DataGridViewRow row in dataGridSubjects.Rows)
            {
                var subject     = GetValueFromRow(row, 0);
                var difficulty  = GetValueFromRow(row, 1);
                var countAtWeek = GetValueFromRow(row, 2);
                var teacher     = GetValueFromRow(row, 3);

                if (subject != "" && difficulty != "" && countAtWeek != "" && teacher != "")
                {
                    grade.AddSubject(
                        new Subject(subject, int.Parse(difficulty), int.Parse(countAtWeek)),
                        SchedlueMaker.GetOrCreateTeacherByName(teacher)
                        );
                }
            }

            var currentGrade = SchedlueMaker.GetGradeByName(gradeName);

            if (currentGrade == null)
            {
                SchedlueMaker.Grades.Add(grade);
            }
            else
            {
                SchedlueMaker.Grades.Remove(currentGrade);
                SchedlueMaker.Grades.Add(grade);
            }
        }
 private void DeleteSelectingGrades_Click(object sender, EventArgs e)
 {
     for (var i = listBoxOfGrades.SelectedItems.Count - 1; i >= 0; i--)
     {
         SchedlueMaker.Grades.Remove(SchedlueMaker.GetGradeByName(listBoxOfGrades.SelectedItems[i].ToString()));
         listBoxOfGrades.Items.Remove(listBoxOfGrades.SelectedItems[i]);
     }
 }
        private void MakeSchedlueButton_Click(object sender, EventArgs e)
        {
            SchedlueMaker.CalculateSchedlue();

            var formOutput = new FormOutput();

            formOutput.Show();
        }
Esempio n. 7
0
        private void DoubleClickingTeacher(object sender, EventArgs e)
        {
            var objectName = (sender as ListBox).SelectedItem;

            if (objectName != null)
            {
                var teacherName  = objectName.ToString();
                var formSchedlue =
                    new FormSchedlue("Учитель - " + teacherName, SchedlueMaker.GetTeacherByName(teacherName));

                formSchedlue.Show();
            }
        }
Esempio n. 8
0
        private void DoubleClickingGrade(object sender, EventArgs e)
        {
            var objectName = (sender as ListBox).SelectedItem;

            if (objectName != null)
            {
                var gradeeName   = objectName.ToString();
                var formSchedlue =
                    new FormSchedlue("Класс - " + gradeeName, SchedlueMaker.GetGradeByName(gradeeName));

                formSchedlue.Show();
            }
        }
Esempio n. 9
0
        private void GetGradesToDataGrid(string gradeName)
        {
            var grade = SchedlueMaker.GetGradeByName(gradeName);

            if (grade != null)
            {
                dataGridSubjects.Rows.Clear();

                foreach (var item in grade.Subjects)
                {
                    dataGridSubjects.Rows.Add(
                        item.Key.Name,
                        item.Key.Difficult,
                        item.Key.CountAtWeek,
                        item.Value.Name
                        );
                }
            }
        }