public async Task <ActionResult <IEnumerable <Student> > > GetStudent() { StudentBUS studentBUS = new StudentBUS(_context); var students = await studentBUS.GetStudent(); return(students); }
public StudentManager() { newKhoa = new KhoaBUS(); newStudent = new StudentBUS(); majorForStudent = new DataTable(); TableKhoaName = new List <string>(); TableKhoaID = new List <string>(); InitializeComponent(); }
public async Task <ActionResult <Student> > GetStudent(string id) { StudentBUS studentBUS = new StudentBUS(_context); var result = await studentBUS.GetStudentById(id); if (result.ErrorCode == HttpStatusCode.NotFound.ToString()) { return(NotFound()); } return(result.item); }
public async Task <ActionResult <Student> > PostStudent(Student student) { StudentBUS studentBUS = new StudentBUS(_context); var result = await studentBUS.CreateStudent(student); if (result.ErrorCode == HttpStatusCode.Conflict.ToString()) { return(NotFound()); } return(CreatedAtAction("GetStudent", new { id = student.StudentID }, student)); }
private void btnDongY_Click(object sender, EventArgs e) { if (DataInvalid() == true) { StudentDTO st = new StudentDTO(); st.Password = txtbOldPass.Text; st.StudentID = GlobalVarian.StudentID; StudentBUS sb = new StudentBUS(st); if (sb.ChangePass(txtbNewPass.Text) == true) { MessageBox.Show("Bạn đã thay đổi Password thành công."); this.Close(); } } }
private void btnSearch_Click(object sender, EventArgs e) { StudentBUS sb = new StudentBUS(); //Students s = sb.getStudentByID(txtSearchID.Text); DataTable table = sb.getStudentByName(txtSearchID.Text); if (table == null) { MessageBox.Show("There is no student", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dataGridView1.DataSource = table; } }
public async Task <IActionResult> PutStudent(string id, Student student) { if (id != student.StudentID) { return(BadRequest()); } _context.Entry(student).State = EntityState.Modified; StudentBUS studentBUS = new StudentBUS(_context); var result = await studentBUS.PutStudent(id, student); if (result.ErrorCode == HttpStatusCode.NotFound.ToString()) { return(NotFound()); } return(NoContent()); }
private void btnSubmit_Click(object sender, EventArgs e) { if (DataInvalid() != false) { StudentDTO sd = new StudentDTO(); sd.StudentID = int.Parse(txtbUser.Text); sd.Password = txtbPass.Text; StudentBUS ub = new StudentBUS(sd); int kq = ub.isAtuthencation(); GlobalVarian.StudentID = kq; if (kq > 0) { this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Lỗi đăng nhập, mời bạn kiểm tra lại tài khoản!", "Error"); } } }
private void UpdateStudents() { var entityStudentSelected = new StudentBUS().GetByID(Convert.ToInt32(this.dgvListTeachers.SelectedRows[0].Cells[7].Value)); new FrmNewStudent(entityStudentSelected).Show(); }
private void btnDoneofEdit_click(object sender, RoutedEventArgs e) { phone_st_infor.IsReadOnly = true; email_st_infor.IsReadOnly = true; birthofday_st_infor.IsReadOnly = true; gender_st_infor.IsReadOnly = true; gender_st_infor.IsEnabled = false; btnDoneOfEdit.Visibility = Visibility.Collapsed; btnEdit.Visibility = Visibility.Visible; btnCancel.Visibility = Visibility.Collapsed; string idStudent = id_st_infor.Text; string Name = Global.Student.Name; string Gender = gender_st_infor.Text; string Email = email_st_infor.Text; string Phone = phone_st_infor.Text; string BirthDay = birthofday_st_infor.Text; if (StudentBUS.changeMyInfomation(idStudent, Name, Gender, Email, Phone, BirthDay)) { Global.Student.Name = Name; Global.Student.Gender = Gender; Global.Student.Email = Email; Global.Student.Phone = Phone; Global.Student.DateofBith = BirthDay; id_st_infor.Text = Global.Student.Id; birthofday_st_infor.Text = Global.Student.DateofBith; phone_st_infor.Text = Global.Student.Phone; email_st_infor.Text = Global.Student.Email; if (Global.Student.Gender == "Male") { gender_st_infor.SelectedIndex = 1; } else if (Global.Student.Gender == "Female") { gender_st_infor.SelectedIndex = 2; } else { gender_st_infor.SelectedIndex = 0; } // Teacher = Global.Teacher; } else { id_st_infor.Text = Global.Student.Id; birthofday_st_infor.Text = Global.Student.DateofBith; phone_st_infor.Text = Global.Student.Phone; email_st_infor.Text = Global.Student.Email; if (Global.Student.Gender == "Male") { gender_st_infor.SelectedIndex = 1; } else if (Global.Student.Gender == "Female") { gender_st_infor.SelectedIndex = 2; } else { gender_st_infor.SelectedIndex = 0; } MessageBox.Show("Update your information failed"); } }
private void LogIn_Click(object sender, RoutedEventArgs e) { passLogIn = passbPassword.Password; /* if (userLogIn == null || userLogIn != userAdmin) * { * lblErrorMessage_1.Content = "The username that you've entered" + "\n" + "doesn't match any account."; * lblErrorMessage_1.Visibility = Visibility.Visible; * uiErrorSp_1.Visibility = Visibility.Visible; * * dispatcherTimer.Start(); * } * else if (passLogIn != passAdmin) * { * lblErrorMessage_2.Content = "The password that you've entered" + "\n" + "is incorrect."; * lblErrorMessage_2.Visibility = Visibility.Visible; * uiErrorSp_2.Visibility = Visibility.Visible; * dispatcherTimer.Start(); * * }else if (rb_tc.IsChecked==false&&rb_st.IsChecked==false&&rb_ad.IsChecked==false) * { * lblErrorMessage_3.Content = "You must choose a authorities."; * lblErrorMessage_3.Visibility = Visibility.Visible; * uiErrorSp_3.Visibility = Visibility.Visible; * dispatcherTimer.Start(); * } * else if (userLogIn == userAdmin & passLogIn == passAdmin & rb_st.IsChecked==true) * { * var window = new DashboardStudent(); * window.Show(); * this.Close(); * } * else if (userLogIn == userAdmin & passLogIn == passAdmin & rb_tc.IsChecked == true) * { * var window = new DashboardTeacher(); * window.Show(); * this.Close(); * } * else if (userLogIn == userAdmin & passLogIn == passAdmin & rb_ad.IsChecked == true) * { * var window = new DashboardAdmin(); * window.Show(); * this.Close(); * }*/ if (rb_tc.IsChecked == false && rb_st.IsChecked == false && rb_ad.IsChecked == false) { lblErrorMessage_3.Content = "You must choose a authorities."; lblErrorMessage_3.Visibility = Visibility.Visible; uiErrorSp_3.Visibility = Visibility.Visible; dispatcherTimer.Start(); } else if (rb_tc.IsChecked == true) { if (TeacherBUS.Login(userLogIn, passLogIn) != null) { var window = new DashboardTeacher(); window.Show(); this.Close(); } else { lblErrorMessage_1.Content = "The username that you've entered" + "\n" + "doesn't match any account."; lblErrorMessage_1.Visibility = Visibility.Visible; uiErrorSp_1.Visibility = Visibility.Visible; dispatcherTimer.Start(); lblErrorMessage_2.Content = "The password that you've entered" + "\n" + "is incorrect."; lblErrorMessage_2.Visibility = Visibility.Visible; uiErrorSp_2.Visibility = Visibility.Visible; dispatcherTimer.Start(); } } else if (rb_ad.IsChecked == true) { if (AdminBUS.Login(userLogIn, passLogIn) != null) { var window = new DashboardAdmin(); window.Show(); this.Close(); } else { lblErrorMessage_1.Content = "The username that you've entered" + "\n" + "doesn't match any account."; lblErrorMessage_1.Visibility = Visibility.Visible; uiErrorSp_1.Visibility = Visibility.Visible; dispatcherTimer.Start(); lblErrorMessage_2.Content = "The password that you've entered" + "\n" + "is incorrect."; lblErrorMessage_2.Visibility = Visibility.Visible; uiErrorSp_2.Visibility = Visibility.Visible; dispatcherTimer.Start(); } } else if (rb_st.IsChecked == true) { if (StudentBUS.Login(userLogIn, passLogIn) != null) { var window = new DashboardStudent(); window.Show(); this.Close(); } else { lblErrorMessage_1.Content = "The username that you've entered" + "\n" + "doesn't match any account."; lblErrorMessage_1.Visibility = Visibility.Visible; uiErrorSp_1.Visibility = Visibility.Visible; dispatcherTimer.Start(); lblErrorMessage_2.Content = "The password that you've entered" + "\n" + "is incorrect."; lblErrorMessage_2.Visibility = Visibility.Visible; uiErrorSp_2.Visibility = Visibility.Visible; dispatcherTimer.Start(); } } }
private void SaveStudents() { try { string validPeao = ValidatePartialPeao(); string validPrenda = ValidatePartialPrenda(); string validRestForm = ValidateRestForm(); if (string.IsNullOrEmpty(validPeao) && string.IsNullOrEmpty(validPrenda) && string.IsNullOrEmpty(validRestForm)) { var entityPeao = GetDataPeao(); var entityPrenda = GetDataPrenda(); if (entityPeao.Id <= 0 && entityPrenda.Id <= 0) { //add new students var idStudentPeao = new StudentBUS().Add(entityPeao); var idStudentPrenda = new StudentBUS().Add(entityPrenda); //entity registration form to data Peão var entityRegFormPeao = new RegistrationFormEntity() { CreateDate = DateTime.Now, IdClass = Convert.ToInt32(this.txtCodeClass.Text), IdStudent = idStudentPeao, Observation = this.txtObservation.Text.Trim(), Payment = this.chbPayment.Checked }; //entity registration form to data Prenda var entityRegFormPrenda = new RegistrationFormEntity() { CreateDate = DateTime.Now, IdClass = Convert.ToInt32(this.txtCodeClass.Text), IdStudent = idStudentPrenda, Observation = this.txtObservation.Text.Trim(), Payment = this.chbPayment.Checked }; //registration var idReg = new RegistrationFormBUS().Add(entityRegFormPeao,0); new RegistrationFormBUS().Add(entityRegFormPrenda, idReg); new ViewKnowledgeBUS().Add(new ViewKnowledgeEntity() { IdRegistrationForm = idReg, OtherObservation = this.txtObservation.Text.Trim(), Type = GetValueKnowledge() }); if (this.chbPayment.Checked) { if (MessageBox.Show("Deseja imprimir o comprovante da inscrição realizada", "Nova Inscrição", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //TODO create method for print } } MessageBox.Show("Inscrição realizada com sucesso", "Nova Inscrição", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { //update students } } else { MessageBox.Show(validPeao + "\n" + validPrenda + "\n" + validRestForm, "Nova Inscrição", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception) { MessageBox.Show("Ocorreu um erro ao tentar efetuar a inscrição", "Nova Inscrição", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SaveStudents() { try { string validPeao = ValidatePartialPeao(); string validPrenda = ValidatePartialPrenda(); string validRestForm = ValidateRestForm(); if (string.IsNullOrEmpty(validPeao) && string.IsNullOrEmpty(validPrenda) && string.IsNullOrEmpty(validRestForm)) { var entityPeao = GetDataPeao(); var entityPrenda = GetDataPrenda(); if (entityPeao.Id <= 0 && entityPrenda.Id <= 0) { //add new students var idStudentPeao = new StudentBUS().Add(entityPeao); var idStudentPrenda = new StudentBUS().Add(entityPrenda); //entity registration form to data Peão var entityRegFormPeao = new RegistrationFormEntity() { CreateDate = DateTime.Now, IdClass = Convert.ToInt32(this.txtCodeClass.Text), IdStudent = idStudentPeao, Observation = this.txtObservation.Text.Trim(), Payment = this.chbPayment.Checked }; //entity registration form to data Prenda var entityRegFormPrenda = new RegistrationFormEntity() { CreateDate = DateTime.Now, IdClass = Convert.ToInt32(this.txtCodeClass.Text), IdStudent = idStudentPrenda, Observation = this.txtObservation.Text.Trim(), Payment = this.chbPayment.Checked }; //registration var idReg = new RegistrationFormBUS().Add(entityRegFormPeao, 0); new RegistrationFormBUS().Add(entityRegFormPrenda, idReg); new ViewKnowledgeBUS().Add(new ViewKnowledgeEntity() { IdRegistrationForm = idReg, OtherObservation = this.txtObservation.Text.Trim(), Type = GetValueKnowledge() }); if (this.chbPayment.Checked) { if (MessageBox.Show("Deseja imprimir o comprovante da inscrição realizada", "Nova Inscrição", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //TODO create method for print } } MessageBox.Show("Inscrição realizada com sucesso", "Nova Inscrição", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { //update students } } else { MessageBox.Show(validPeao + "\n" + validPrenda + "\n" + validRestForm, "Nova Inscrição", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception) { MessageBox.Show("Ocorreu um erro ao tentar efetuar a inscrição", "Nova Inscrição", MessageBoxButtons.OK, MessageBoxIcon.Error); } }