Beispiel #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            int flat_hv;
            int flat_dk;

            //insert dữ liệu trong bản học viên
            if (rdNam.Checked)
            {
                if (cbxTinhTrang.Text == "Còn Học")
                {
                    flat_hv = hv.insert(AccountHelper.getAccountId(), AccountHelper.getAccoutPassword(), txtMaHV.Text, txtHoTen.Text, 1, txtDiaChi.Text, txtSDT.Text, txtEmail.Text, dtNgayDK.Value, 1, dtNgaySinh.Value);
                }
                else
                {
                    flat_hv = hv.insert(AccountHelper.getAccountId(), AccountHelper.getAccoutPassword(), txtMaHV.Text, txtHoTen.Text, 1, txtDiaChi.Text, txtSDT.Text, txtEmail.Text, dtNgayDK.Value, 0, dtNgaySinh.Value);
                }
            }
            else
            {
                if (cbxTinhTrang.Text == "Còn Học")
                {
                    flat_hv = hv.insert(AccountHelper.getAccountId(), AccountHelper.getAccoutPassword(), txtMaHV.Text, txtHoTen.Text, 0, txtDiaChi.Text, txtSDT.Text, txtEmail.Text, dtNgayDK.Value, 1, dtNgaySinh.Value);
                }

                else
                {
                    flat_hv = hv.insert(AccountHelper.getAccountId(), AccountHelper.getAccoutPassword(), txtMaHV.Text, txtHoTen.Text, 0, txtDiaChi.Text, txtSDT.Text, txtEmail.Text, dtNgayDK.Value, 0, dtNgaySinh.Value);
                }
            }

            //insert bảng đăng ký

            flat_dk = dk.insert(AccountHelper.getAccountId(), AccountHelper.getAccoutPassword(), cbxLopHoc.Text, txtMaHV.Text);

            if (flat_hv == 1 && flat_dk == 1)
            {
                Load_HV();
                DialogHelper.ExtendedShowErrorDialog("Thêm thành công", "", 1, 2);
            }
            else
            {
                Load_HV();
                DialogHelper.ExtendedShowErrorDialog("Thêm không thành công", "", 1, 1);
            }


            XoaText();
            EditButton(false, false, false, true);
            this.Cursor = Cursors.Arrow;
        }