private async void Button_Click(object sender, RoutedEventArgs e) { if (studentNameTb.Text != "" && subjectNameTb.Text != "" && classNameTb.Text != "" && semesterTb.Text != "" && typeTb.Text != "" && valueTb.Text != "") { if (!InputTester.IsAName(studentNameTb.Text)) { iNotifierBox.Text = "Tên học sinh không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAClassName(classNameTb.Text)) { iNotifierBox.Text = "Tên lớp không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAFloatNumber(valueTb.Text)) { iNotifierBox.Text = "Điểm không hợp lệ"; iNotifierBox.ShowDialog(); return; } string studentName = studentNameTb.Text; string subjectName = subjectNameTb.Text; string className = classNameTb.Text; string semester = semesterTb.Text; string type = typeTb.Text; double value = Convert.ToDouble(valueTb.Text); StudentMark studentMark = new StudentMark() { }; //ResultYN resultYN = await Controllers.Controller.Instance.InsertNewClass(classInfo); //if (resultYN.Result) { this.Hide(); isCorrected = true; studentNameTb.Text = ""; subjectNameTb.Text = ""; classNameTb.Text = ""; semesterTb.Text = ""; typeTb.Text = ""; valueTb.Text = ""; iNotifierBox.Text = "Xoá thành công !"; iNotifierBox.ShowDialog(); } } else { iNotifierBox.Text = "Vui lòng điền đầy đủ thông tin"; iNotifierBox.ShowDialog(); } }
private async void Button_Click(object sender, RoutedEventArgs e) { if (studentNameTb.Text != "" && subjectNameTb.Text != "" && classNameTb.Text != "" && semesterTb.Text != "" && typeTb.Text != "" && valueTb.Text != "") { if (!InputTester.IsAName(studentNameTb.Text)) { iNotifierBox.Text = "Tên học sinh không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAClassName(classNameTb.Text)) { iNotifierBox.Text = "Tên lớp không hợp lệ"; iNotifierBox.ShowDialog(); return; } if (!InputTester.IsAFloatNumber(valueTb.Text)) { iNotifierBox.Text = "Điểm không hợp lệ"; iNotifierBox.ShowDialog(); return; } StudentMark studentMark = new StudentMark() { LoaiDiem = typeTb.Text, maHS = savedMaHS, maLop = savedMaLop, maMonHoc = subjectNameTb.Text, HocKy = semesterTb.Text, GiaTriDiem = (float)Convert.ToDouble(valueTb.Text) }; bool resultYN = await Controllers.Controller.Instance.InsertMark(studentMark); if (resultYN) { this.Hide(); isCorrected = true; studentNameTb.Text = ""; subjectNameTb.Text = ""; classNameTb.Text = ""; semesterTb.Text = ""; typeTb.Text = ""; valueTb.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(); } }