Beispiel #1
0
        private void btnTaoThanhVien_Click(object sender, EventArgs e)
        {
            bool gioiTinh = false;

            if (txtSDT.Text != string.Empty)
            {
                if (!KiemTraSDT(txtSDT.Text.Trim()))
                {
                    MessageBox.Show("SĐT không hợp lệ");
                }
            }


            if (rbtnNam.Checked)
            {
                gioiTinh = true;
            }
            else if (txtHoTen.Text == string.Empty)
            {
                MessageBox.Show("Vui lòng nhập họ tên");
            }
            else if (txtNamSinh.Text == string.Empty)
            {
                MessageBox.Show("Vui lòng nhập năm sinh");
            }
            else if (!KiemTraNamSinh(txtNamSinh.Text.Trim()))
            {
                MessageBox.Show("Năm sinh không hợp lệ");
            }
            else if (txtCMND.Text == string.Empty)
            {
                MessageBox.Show("Vui lòng nhập CMND/Căn cước");
            }
            else if (!KiemTraCMND(txtCMND.Text.Trim()))
            {
                MessageBox.Show("CMND không hợp lệ");
            }
            else if (txtDiaChi.Text == string.Empty)
            {
                MessageBox.Show("Vui lòng nhập địa chỉ");
            }
            else if (!rbtnNam.Checked && !rbtnNu.Checked)
            {
                MessageBox.Show("Vui lòng chọn giới tính");
            }
            else if (busKhachHang.TaoThanhVien(string.Empty, txtHoTen.Text, txtNamSinh.Text, gioiTinh, txtCMND.Text, txtDiaChi.Text, txtSDT.Text))
            {
                MessageBox.Show("Lưu thông tin thành công!", "Thông báo", MessageBoxButtons.OK);
                Close();
            }
            else
            {
                MessageBox.Show("Lưu thông tin không thành công!", "Thông báo", MessageBoxButtons.OK);
            }
        }