private async void Button_Click(object sender, RoutedEventArgs e) { if (studentNameTb.Text != "" && sexTb.Text != "" && dobTb.Text != "" && countryTb.Text != "" && parentNameTb.Text != "" && phoneNumberTb.Text != "" && currentClassTb.Text != "") { if (!InputTester.IsAName(studentNameTb.Text)) { iNotifierBox.Text = "Tên học sinh không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsADate(dobTb.Text)) { iNotifierBox.Text = "Ngày không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAName(countryTb.Text)) { iNotifierBox.Text = "Tên quê không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAName(parentNameTb.Text)) { iNotifierBox.Text = "Tên phụ huynh không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsANumber(phoneNumberTb.Text, 10)) { iNotifierBox.Text = "Số điện thoại không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAClassName(currentClassTb.Text)) { iNotifierBox.Text = "Tên lớp không hợp lệ"; iNotifierBox.ShowDialog(); return; } Student student = new Student() { Hoten = studentNameTb.Text, GioiTinh = sexTb.Text, NgaySinh = dobTb.Text, NoiSinh = countryTb.Text, TenNgGianHo = parentNameTb.Text, SDT = phoneNumberTb.Text, MaLop = currentClassTb.Text }; ResultYN resultYN = await Controllers.Controller.Instance.InsertNewStudent(student); if (resultYN.Result) { this.Hide(); isCorrected = true; studentNameTb.Text = ""; sexTb.Text = ""; dobTb.Text = ""; countryTb.Text = ""; parentNameTb.Text = ""; phoneNumberTb.Text = ""; currentClassTb.Text = ""; iNotifierBox.Text = "Thêm thành công !"; iNotifierBox.ShowDialog(); } else { iNotifierBox.Text = "Lỗi"; iNotifierBox.ShowDialog(); } } else { iNotifierBox.Text = "Vui lòng điền đầy đủ thông tin"; iNotifierBox.ShowDialog(); } }