private void TeacherAddToolStripMenuItem_Click(object sender, EventArgs e) { TeacherForm teacherForm = new TeacherForm(); List <Commission> commissions = db.Commissions.ToList(); //принимаем данные с таблицы комиссии List <Subjects> subjects = db.Subjects.ToList(); //принимаем данные с таблицы предметов //подключаем данные и выводим список комиссий в comboBox1 teacherForm.comboBox1.DataSource = commissions; teacherForm.comboBox1.ValueMember = "ComId"; teacherForm.comboBox1.DisplayMember = "ComName"; //подключаем данные и выводим список предметов в comboBox2 teacherForm.comboBox2.DataSource = subjects; teacherForm.comboBox2.ValueMember = "SubjId"; teacherForm.comboBox2.DisplayMember = "ShortName"; if (teacherForm.ShowDialog() == DialogResult.OK) { db.Teachers.Add(teacherForm.Teacher); db.SaveChanges(); } }
private void btnHomePageLogin_Click(object sender, EventArgs e) { switch (cmbxHomePAgeUserType.SelectedItem.ToString()) { case "Teacher": //LocalStorage.homePage = this; TeacherForm teacher = new TeacherForm(); teacher.Show(); //this.Hide(); break; case "Mentor": var form3 = new MentorForm(); form3.Show(); break; case "Student": var form4 = new StudentForm(); form4.Show(); break; case "Admin": var form1 = new RegistrationForm(); form1.Show(); break; } }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var teacher = await _context.Teachers.FindAsync(id); if (teacher == null) { return(NotFound()); } TeacherForm vm = new TeacherForm { Id = teacher.TeacherId, FirstName = teacher.FirstName, LastName = teacher.LastName, Degree = teacher.Degree, AcademicRank = teacher.AcademicRank, OfficeNumber = teacher.OfficeNumber, HireDate = teacher.HireDate, Courses_first = teacher.Course1, Courses_second = teacher.Course2 }; return(View(vm)); }
private void button1_Click(object sender, EventArgs e) { if (Program.CheckString(new string[] { textBox1.Text, textBox2.Text })) { try { var result = ((Main)Owner).db.users.SingleOrDefault(n => n.id_u == item.id_u); bool check = checkBox2.Checked ? true : false, check2 = checkBox1.Checked ? true : false; TeacherForm teach = new TeacherForm(); teach.EditTeacher(item, result, textBox2.Text, textBox1.Text, textBox3.Text, dateTimePicker1.Value, textBox5.Text, textBox6.Text, check, check2); ((Main)Owner).usersSheet = ((Main)Owner).db.users.OrderBy(n => n.id_u).ToList(); ((Main)Owner).db.SaveChanges(); ((Main)Owner).преподавателиToolStripMenuItem_Click(sender, e); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Не все поля заполнены!"); } }
private void TryLogin() { if (Core.Server.Integration.Connected()) { Student user = Core.Server.Integration.ExecuteGetStudent(textBox1.Text); Teacher user2 = Core.Server.Integration.ExecuteGetTeacher(textBox1.Text); if (user != null) { // student exists // check if password is correct if (textBox2.Text == user.Password) { if (openForm != null) { openForm.Close(); } // password is correct StudentForm form = new StudentForm(user); // open student form form.Show(); // minimize login this.WindowState = FormWindowState.Minimized; } else { errorText.Text = "Incorrect Password"; } } else if (user2 != null) { // teacher exists // check if password is correct if (textBox2.Text == user2.Password) { if (openForm != null) { openForm.Close(); } // password is correct TeacherForm form = new TeacherForm(user2); // open teacher form form.Show(); // minimize login this.WindowState = FormWindowState.Minimized; } else { errorText.Text = "Incorrect Uassword"; } } else { errorText.Text = "Invalid Username"; } } else { errorText.Text = "Check Connection"; } }
public async Task <IActionResult> Create(TeacherForm Vmodel) { if (ModelState.IsValid) { string uniqueFileName = UploadedFile(Vmodel); Teacher teacher = new Teacher { ProfilePicture = uniqueFileName, FirstName = Vmodel.FirstName, LastName = Vmodel.LastName, Degree = Vmodel.Degree, AcademicRank = Vmodel.AcademicRank, OfficeNumber = Vmodel.OfficeNumber, HireDate = Vmodel.HireDate, Course1 = Vmodel.Courses_first, Course2 = Vmodel.Courses_second }; _context.Add(teacher); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View()); }
private void btnAddTeacher_Click(object sender, EventArgs e) { RefreshUI RefreshUI = new RefreshUI(this.RefreshUI); TeacherForm addTeacherForm = new TeacherForm(this.TeacherList, this.ITeacherFormReq, this.CurrentlCourse.Id, RefreshUI); addTeacherForm.ShowDialog(); }
private void Teacherbtn_Click(object sender, EventArgs e) { TeacherForm teachers = new TeacherForm(); this.Hide(); teachers.ShowDialog(); this.Show(); }
private string UploadedFile(TeacherForm Vmodel) { string uniqueFileName = null; if (Vmodel.ProfilePicture != null) { string uploadsFolder = Path.Combine(_webHostEnvironment.WebRootPath, "images"); uniqueFileName = Guid.NewGuid().ToString() + "_" + Path.GetFileName(Vmodel.ProfilePicture.FileName); string filePath = Path.Combine(uploadsFolder, uniqueFileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { Vmodel.ProfilePicture.CopyTo(fileStream); } } return(uniqueFileName); }
//Checks user info private void CheckUserInfo(object sender, EventArgs e) { if (cbxLoginUserType.Text == "Teacher") { UserType = 1; } else if (cbxLoginUserType.Text == "Student") { UserType = 2; } else if (cbxLoginUserType.Text == "Mentor") { UserType = 3; } if (db.Logins.ToList().Any(t => t.LoginEmail == tbxLoginEmail.Text && t.LoginPassword == tbxLoginPassword.Text && t.UserTypeId == UserType)) { //holds user email UserEmail = tbxLoginEmail.Text; //Disables th ebutton btnSignIn.Enabled = false; if (UserType == 1) { TeacherForm teacher = new TeacherForm(); teacher.Show(); teacher.FillTeacherInfo(tbxLoginEmail.Text); } else if (UserType == 2) { StudentForm student = new StudentForm(); student.Show(); student.FillStudentInfo(tbxLoginEmail.Text); } else if (UserType == 3) { MentorForm mentor = new MentorForm(); mentor.Show(); mentor.FillMentorInfo(tbxLoginEmail.Text); } } else { MessageBox.Show("Wrong data was provided."); } }
//If user is not registerd in database, builder returns null public void LoadUser(string userName, string password, string userType) { User user = DataManager.ReturnUser(userName, password, userType); if (userType.Equals("student")) { StudentForm studentForm = new StudentForm((Student)user); studentForm.Show(); CloseMainForm(); } else if (userType.Equals("teacher")) { TeacherForm teacherForm = new TeacherForm((Teacher)user); teacherForm.Show(); CloseMainForm(); } }
public async Task <IActionResult> Create(TeacherForm model, string[] selectedCourses, Teacher teacher) { if (selectedCourses != null) { teacher.Course1 = new List <Course>(); foreach (var course in selectedCourses) { var courseToAdd = new Course { FirstTeacherId = teacher.TeacherId, CourseID = int.Parse(course) }; teacher.Course1.Add(courseToAdd); } teacher.Course2 = new List <Course>(); foreach (var course in selectedCourses) { var courseToAdd = new Course { SecondTeacherId = teacher.TeacherId, CourseID = int.Parse(course) }; teacher.Course2.Add(courseToAdd); } } if (ModelState.IsValid) { string uniqueFileName = UploadedFile(model); teacher = new Teacher { FirstName = model.FirstName, LastName = model.LastName, Degree = model.Degree, AcademicRank = model.AcademicRank, OfficeNumber = model.OfficeNumber, HireDate = model.HireDate, ProfilePicture = uniqueFileName, Course1 = model.Courses_first, Course2 = model.Courses_second }; _context.Add(teacher); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task <IActionResult> Edit(int id, TeacherForm Vmodel) { if (id != Vmodel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { string uniqueFileName = UploadedFile(Vmodel); Teacher teacher = new Teacher { ProfilePicture = uniqueFileName, TeacherId = Vmodel.Id, FirstName = Vmodel.FirstName, LastName = Vmodel.LastName, Degree = Vmodel.Degree, AcademicRank = Vmodel.AcademicRank, OfficeNumber = Vmodel.OfficeNumber, HireDate = Vmodel.HireDate, Course1 = Vmodel.Courses_first, Course2 = Vmodel.Courses_second }; _context.Update(teacher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherExists(Vmodel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(Vmodel)); }
private void button1_Click(object sender, EventArgs e) { teacherChosen.Names = comboBox1.SelectedItem.ToString(); // Find and bind the chosen teacher from combo box for (int i = 0; i < Allteachers.Names.Count; i++) { if (teacherChosen.Names.Equals(Allteachers.Names[i]) == true) { teacherChosen.Names = Allteachers.Names[i]; teacherChosen.Subject = Allteachers.Subject[i]; teacherChosen.Special = Allteachers.Special[i]; teacherChosen.Consultation = Allteachers.Consultation[i]; teacherChosen.sip = Allteachers.sip[i]; } } TeacherForm teacherForm = new TeacherForm(); // open TeacherForm teacherForm.Show(); }
private void button1_Click(object sender, EventArgs e) { if (Program.CheckString(new string[] { textBox1.Text, textBox2.Text, textBox5.Text, textBox6.Text })) { try { string patron = (!String.IsNullOrEmpty(textBox3.Text) ? Program.NameString(textBox3.Text) : ""); TeacherForm teach = new TeacherForm(Program.NameString(textBox1.Text), Program.NameString(textBox2.Text), patron, Program.NameString(textBox5.Text), Program.NameString(textBox6.Text)); teach.AddTeacher(dateTimePicker1, checkBox1); ((Main)Owner).преподавателиToolStripMenuItem_Click(sender, e); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Не все поля заполнены!"); } }
public TableTeacherGroup() { InitializeComponent(); TeacherForm.InitializeForm1(this); }
public static BaseForm getForm(string name) { BaseForm f = new ObjectForm(); switch (name) { case "Object": f = new ObjectForm(); break; case "Linq": f = new LinqForm(); break; case "People": f = new PeopleForm(); break; case "ConnectToUniversityPeople": f = new ConnectToUniversityPeopleForm(); break; case "Worker": f = new Workers(); break; case "Leadership": f = new LeadershipForm(); break; case "Teacher": f = new TeacherForm(); break; case "Staff": f = new StaffForm(); break; case "Student": f = new StudentForm(); break; case "Entrant": f = new EntrantForm(); break; case "Thing": f = new ThingForm(); break; case "CultureThing": f = new CultureThingForm(); break; case "MatherialThing": f = new MatherialThingForm(); break; case "Building": f = new BuildingForm(); break; case "Room": f = new RoomForm(); break; case "PersonalThing": f = new RersonalThingForm(); break; case "Literature": f = new LiteratureForm(); break; case "Electronic": f = new ElectronicForm(); break; case "NotMatherialThing": f = new NotMatherialForm(); break; case "GroupOfPeople": f = new GroupOfPeopleForm(); break; case "Faculty": f = new FacultyForm(); break; case "Group": f = new GroupForm(); break; case "ManageOfPeople": f = new ManageOfPeopleForm(); break; case "Mark": f = new MarkForm(); break; case "Award": f = new AwardForm(); break; //case "Event": // f = new EventForm(); // break; //case "ControlKnowledge": // f = new ControlKnowledgeForm(); // break; case "Subject": f = new SubjectForm(); break; } return(f); }
private void Change_Click(object sender, EventArgs e) { if (dataGridView.SelectedCells.Count == 0) { MessageBox.Show("Виберіть хочаб одну строку в таблиці", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // идентификатор записи // вызываем форму таблиц и редактируем выделенную строку var id = dataGridView.SelectedRows[0].Cells[0].Value; List <Commission> commissions = db.Commissions.ToList(); //принимаем данные с таблицы комиссии List <Subjects> subjects = db.Subjects.ToList(); //принимаем данные с таблицы предметов if (typeof(T) == typeof(Subjects)) { var subject = set.Find(id) as Subjects; if (subject != null) { var form = new SubjectForm(subject); if (form.ShowDialog() == DialogResult.OK) { subject = form.Subject; db.SaveChanges(); dataGridView.Refresh(); } } } else if (typeof(T) == typeof(Teacher)) { var teacher = set.Find(id) as Teacher; if (teacher != null) { TeacherForm teacherForm = new TeacherForm(teacher); //подключаем данные и выводим список комиссий в comboBox1 teacherForm.comboBox1.DataSource = commissions; teacherForm.comboBox1.ValueMember = "ComId"; teacherForm.comboBox1.DisplayMember = "ComName"; //подключаем данные и выводим список предметов в comboBox2 teacherForm.comboBox2.DataSource = subjects; teacherForm.comboBox2.ValueMember = "SubjId"; teacherForm.comboBox2.DisplayMember = "ShortName"; if (teacherForm.ShowDialog() == DialogResult.OK) { teacher = teacherForm.Teacher; db.SaveChanges(); dataGridView.Refresh(); } } } else if (typeof(T) == typeof(Groups)) { var groups = set.Find(id) as Groups; if (groups != null) { GroupForm groupForm = new GroupForm(); groupForm.comboBox1.DataSource = commissions; groupForm.comboBox1.ValueMember = "ComId"; groupForm.comboBox1.DisplayMember = "ComName"; if (groupForm.ShowDialog() == DialogResult.OK) { groups = groupForm.Groups; db.SaveChanges(); dataGridView.Refresh(); } } } else if (typeof(T) == typeof(Commission)) { var commission = set.Find(id) as Commission; if (commission != null) { var form = new CommissionForm(commission); if (form.ShowDialog() == DialogResult.OK) { commission = form.Commission; db.SaveChanges(); dataGridView.Refresh(); } } } }
private void cmbCiclo_SelectionChanged(object sender, SelectionChangedEventArgs e) { TeacherForm.ButtonSee(this); }