private void mnuOpen_Click(object sender, EventArgs e) { if (sender == mnuNewTeacher || sender == tsmnuTeacher) { TeacherForm frmTeacher = new TeacherForm(); frmTeacher.GetTeacher += frmTeacher_GetTeacher; frmTeacher.ShowDialog(); } else if (sender == mnuNewSubject || sender == tsmnuNewSubject) { SubjectForm frmSubject = new SubjectForm(); frmSubject.GetSubject += frmSubject_GetSubject; frmSubject.ShowDialog(); } else if (sender == mnuNewAbiturient || sender == tsmnuNewAbiturient) { AbiturientForm frmAbit = new AbiturientForm(); frmAbit.GetAbiturient += frmAbit_GetAbiturient; frmAbit.ShowDialog(); } else if (sender == mnuNewCourse || sender == tsmnuCourse) { CourseForm frmCourse = new CourseForm(subjects, teachers); frmCourse.GetCourse += frmCourse_GetCourse; frmCourse.ShowDialog(); } else if (sender == mnuSave || sender == tsmnuSave) { SaveInformation(dgvAbiturient, file_pathAbit); SaveInformation(dgvTeacher, file_pathTeach); SaveInformation(dgvSubject, file_pathSub); SaveInformation(dgvCourse, file_pathCourse); } }
private void mnuOpen_Click(object sender, EventArgs e) { if (sender == mnuNewTeacher || sender == tsmnuTeacher) { OqituvchiForm frmTeach = new OqituvchiForm(tscmbSubject); frmTeach.GetTeacher += frmTeach_GetTeacher; frmTeach.ShowDialog(); } else if (sender == mnuNewSubject || sender == tsmnuNewSubject) { SubjectForm frmSub = new SubjectForm(); frmSub.GetSubject += frmSub_GetSubject; frmSub.ShowDialog(); } else if (sender == mnuNewAbiturient || sender == tsmnuNewAbiturient) { AbiturientForm frmAbit = new AbiturientForm(tscmbSubject); frmAbit.GetAbiturient += frmAbit_GetAbiturient; frmAbit.ShowDialog(); } else if (sender == mnuNewCourse || sender == tsmnuCourse) { //CourseForm frmCourse = new CourseForm(tscmbSubject, ); //frmCourse.GetCourse+=frmCourse_GetCourse; //frmCourse.ShowDialog(); } else if (sender == mnuSave || sender == tsbSave) { using (StreamWriter sw = new StreamWriter(file1)) { foreach (DataGridViewRow row in dgvAbiturient.Rows) { string str = ""; for (int i = 0; i < row.Cells.Count; i++) { if (row.Cells[i].Value != null) { str += row.Cells[i].Value.ToString() + "#"; } else { str += " #"; } } str = str.Remove(str.Length - 1, 1); sw.WriteLine(str); } } using (StreamWriter sw = new StreamWriter(file2)) { foreach (DataGridViewRow row in dgvTeacher.Rows) { string str = ""; for (int i = 0; i < row.Cells.Count; i++) { if (row.Cells[i].Value != null) { str += row.Cells[i].Value.ToString() + "#"; } else { str += " #"; } } str = str.Remove(str.Length - 1, 1); sw.WriteLine(str); } } using (StreamWriter sw = new StreamWriter(file3)) { foreach (DataGridViewRow row in dgvCourse.Rows) { string str = ""; for (int i = 0; i < row.Cells.Count; i++) { if (row.Cells[i].Value != null) { str += row.Cells[i].Value.ToString() + "#"; } else { str += " #"; } } str = str.Remove(str.Length - 1, 1); sw.WriteLine(str); } } using (StreamWriter sw = new StreamWriter(file4)) { string str = ""; foreach (var a in tscmbSubject.Items) { str += a + "#"; } str = str.Remove(str.Length - 1, 1); sw.WriteLine(str); } } }