private void button4_Click(object sender, EventArgs e) { if (checkBox1.Checked == true && checkBox2.Checked == false) { if (Instructor.checkIID(int.Parse(textBox1.Text)) == true) { MessageBox.Show("ID is Unavailable"); } else if (Instructor.checkIID(int.Parse(textBox1.Text)) == false) { Instructor.addNewInstructor(int.Parse(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text); MessageBox.Show("Done"); Close(); } } else if (checkBox1.Checked == false && checkBox2.Checked == true) { if (Teacher_Assistant.checkTID(int.Parse(textBox1.Text)) == true) { MessageBox.Show("ID is Unavailable"); } else if (Teacher_Assistant.checkTID(int.Parse(textBox1.Text)) == false) { Teacher_Assistant.addNewTA(int.Parse(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text); MessageBox.Show("Done"); Close(); } } else if ((checkBox1.Checked == true && checkBox2.Checked == true) || (checkBox1.Checked == false && checkBox2.Checked == false)) { MessageBox.Show("You Should Determine TA Or Instructor"); } }
public static void read() { FileStream fs = new FileStream("Course.txt", FileMode.Open); StreamReader sr = new StreamReader(fs); while (sr.Peek() != -1) { string s = sr.ReadLine(); string[] arr = s.Split(','); string id = arr[0]; string lec = arr[1]; string lab = arr[2]; int pir = Convert.ToInt32(arr[3]); string inst = arr[4]; string TA = arr[5]; Course cc = new Course(id, lec, lab, pir, inst, TA); courselist.Add(cc); } fs.Close(); FileStream fs1 = new FileStream("Instructor.txt", FileMode.Open); StreamReader sr1 = new StreamReader(fs1); while (sr1.Peek() != -1) { string s = sr1.ReadLine(); string[] arr = s.Split(','); int id = int.Parse(arr[0]); string Name = arr[1]; string Phone = arr[2]; string mail = arr[3]; string ads = arr[4]; Instructor cc = new Instructor(id, Name, Phone, mail, ads); Instructor.Instructorlist.Add(cc); } sr1.Close(); //fs1.Close(); FileStream fsa = new FileStream("Room.txt", FileMode.Open); StreamReader sra = new StreamReader(fsa); while (sra.Peek() != -1) { string s = sra.ReadLine(); string[] arr = s.Split(','); string id = arr[0]; string num = arr[1]; int cap = Convert.ToInt32(arr[2]); string plc = arr[4]; string avlb = arr[3]; Room cc = new Room(id, num, cap, avlb, plc); Room.roomlist.Add(cc); } sra.Close(); fsa.Close(); FileStream fst = new FileStream("TeacherAssestant.txt", FileMode.Open); StreamReader srt = new StreamReader(fst); while (srt.Peek() != -1) { string s = srt.ReadLine(); string[] arr = s.Split(','); int id = int.Parse(arr[0]); string Name = arr[1]; string Phone = arr[2]; string mail = arr[3]; string ads = arr[4]; Teacher_Assistant cc = new Teacher_Assistant(id, Name, Phone, mail, ads); Teacher_Assistant.TAlist.Add(cc); } srt.Close(); fst.Close(); }