示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (subjectNameTb.Text != "" &&
                countTb.Text != "")
            {
                if (!InputTester.IsAName(subjectNameTb.Text))
                {
                    iNotifierBox.Text = "Tên môn học không hợp lệ";
                    iNotifierBox.ShowDialog();
                    return;
                }

                if (!InputTester.IsANumber(countTb.Text, 2))
                {
                    iNotifierBox.Text = "Số tiết không hợp lệ";
                    iNotifierBox.ShowDialog();
                    return;
                }

                isCorrected = true;
                string subjectName = subjectNameTb.Text;
                int    count       = Convert.ToInt32(countTb.Text);

                this.Hide();
                subjectNameTb.Text = "";
                countTb.Text       = "";
                iNotifierBox.Text  = "Sửa 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 != "" &&
                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();
            }
        }
        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();
            }
        }
示例#4
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (classNameTb.Text != "" &&
                gradeTb.Text != "" &&
                teacherNameTb.Text != "" &&
                countTb.Text != "" &&
                yearTb.Text != "")
            {
                if (!InputTester.IsAClassName(classNameTb.Text))
                {
                    iNotifierBox.Text = "Tên lớp không hợp lệ";
                    iNotifierBox.ShowDialog();
                    return;
                }

                if (!InputTester.IsAName(teacherNameTb.Text))
                {
                    iNotifierBox.Text = "Tên giáo viên không hợp lệ";
                    iNotifierBox.ShowDialog();
                    return;
                }

                if (!InputTester.IsANumber(countTb.Text, 2))
                {
                    iNotifierBox.Text = "Sĩ số không hợp lệ";
                    iNotifierBox.ShowDialog();
                    return;
                }

                if (!InputTester.IsANumber(yearTb.Text, 4))
                {
                    iNotifierBox.Text = "Năm không hợp lệ";
                    iNotifierBox.ShowDialog();
                    return;
                }

                ClassInfo classInfo = new ClassInfo()
                {
                    tenLop   = classNameTb.Text,
                    khoi     = gradeTb.Text,
                    tenGVCN  = teacherNameTb.Text,
                    siSo     = Convert.ToInt32(countTb.Text),
                    nienKhoa = yearTb.Text
                };

                bool resultYN = await Controllers.Controller.Instance.DeleteClass(classInfo.maLop);

                if (resultYN)
                {
                    this.Hide();
                    isCorrected        = true;
                    classNameTb.Text   = "";
                    gradeTb.Text       = "";
                    teacherNameTb.Text = "";
                    countTb.Text       = "";
                    yearTb.Text        = "";
                    iNotifierBox.Text  = "Xoá thành công !";
                    iNotifierBox.ShowDialog();
                }
            }
            else
            {
                iNotifierBox.Text = "Vui lòng điền đầy đủ thông tin";
                iNotifierBox.ShowDialog();
            }
        }
示例#5
0
        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();
            }
        }