private void btnThongKe_Click(object sender, EventArgs e)
        {
            if (tbSoTKThongKe.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số tài khoản");
                tbSoTKThongKe.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTKThongKe.Text))
            {
                MessageBox.Show("Giá trị nhập vào không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTKThongKe.Focus();
                return;
            }
            if (tbSoTKThongKe.Text.Length > 9)
            {
                MessageBox.Show("Số tài khoản tối đa là 9 số");
                tbSoTKThongKe.Focus();
                return;
            }

            else if (KT_TaiKhoanKH.KiemTraSoTaiKhoan(tbSoTKThongKe.Text) != 1)
            {
                MessageBox.Show("Số tài khoản không tồn tại");
                tbSoTKThongKe.Focus();
                return;
            }
            else
            {
                rptGiaoDich     rpt   = new rptGiaoDich(tbSoTKThongKe.Text, ngayBatDauTK.Value, ngayKetThucTK.Value);
                ReportPrintTool print = new ReportPrintTool(rpt);
                print.ShowPreviewDialog();
            }
        }
Exemple #2
0
        private void btnTaoTK_Click(object sender, EventArgs e)
        {
            if (tbSoTK.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số tài khoản");
                tbSoTK.Focus();
                return;
            }
            if (tbSoTK.Text.Length > 9)
            {
                MessageBox.Show("Số tài khoản tối đa là 9 số");
                tbSoTK.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTK.Text))
            {
                MessageBox.Show("Giá trị nhập vào không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTK.Focus();
                return;
            }
            else if (KT_TaiKhoanKH.KiemTraSoTaiKhoan(tbSoTK.Text) == 1)
            {
                MessageBox.Show("Số tài khoản bị trùng! Vui lòng nhập lại");
                tbSoTK.Focus();
                return;
            }
            else
            {
                taiKhoanBindingSource.AddNew();
                ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["SOTK"] = tbSoTK.Text;
                ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["CMND"] = tbCMND.Text;
                ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["SODU"] = tbSoDu.Text;
                ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["MACN"] = chiNhanhTaoTK;

                taiKhoanBindingSource.EndEdit();
                taiKhoanBindingSource.ResetCurrentItem();

                this.taiKhoanTableAdapter.Connection.ConnectionString = Program.connectionstring;

                if (this.taiKhoanTableAdapter.Update(this.cN_NGANHANG) == 1)
                {
                    MessageBox.Show("Tạo tài khoản khách hàng thành công");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Tạo tài khoản khách hàng không thành công");
                    return;
                }
            }
        }
Exemple #3
0
        private void HienThiThongTin(string cmnd)
        {
            List <string> list = new List <string>();

            list = KT_TaiKhoanKH.ThongTinTaiKhoanKhachHang(cmnd);
            if (list == null)
            {
                MessageBox.Show("Danh sách null");
            }
            else
            {
                groupBox1.Enabled = true;
                tbCMND.Enabled    = tbHo.Enabled = tbSoDu.Enabled = tbTen.Enabled = rtbDiaChi.Enabled = tbSDT.Enabled = tbChiNhanh.Enabled = false;
                // tbCMND.Text = list[0];
                tbCMND.Text     = list[0];
                tbHo.Text       = list[1];
                tbTen.Text      = list[2];
                rtbDiaChi.Text  = list[3];
                tbSDT.Text      = list[4];
                tbChiNhanh.Text = list[5];
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (tbSoTK.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số tài khoản chuyển", "", MessageBoxButtons.OK);
                tbSoTK.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTK.Text.Trim()))
            {
                MessageBox.Show("Số tài khoản gửi nhập vào số tài khoản không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTK.Focus();
                return;
            }
            else if (tbSoTKNhan.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số tài khoản nhận", "", MessageBoxButtons.OK);
                tbSoTKNhan.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTKNhan.Text.Trim()))
            {
                MessageBox.Show("Số tài khoản nhận nhập vào số tài khoản không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTKNhan.Focus();
                return;
            }
            else if (tbSoTKNhan.Text.Trim().Equals(tbSoTK.Text.Trim()))
            {
                MessageBox.Show("Số tài khoản nhận phải khác số tài khoản gửi", "", MessageBoxButtons.OK);
                tbSoTKNhan.Focus();
                return;
            }
            else if (KT_TaiKhoanKH.KiemTraSoTaiKhoan(tbSoTKNhan.Text) != 1)
            {
                MessageBox.Show("Số tài khoản không tồn tại trong hệ thống! Vui lòng nhập lại");
                tbSoTKNhan.Focus();
                return;
            }
            else if (tbSoTienChuyen.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số tiền cần chuyển", "", MessageBoxButtons.OK);
                tbSoTienChuyen.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTienChuyen.Text))
            {
                MessageBox.Show("Giá trị nhập vào số tiền chuyển không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTienChuyen.Focus();
                return;
            }
            else if (Double.Parse(tbSoTienChuyen.Text) < 100000)
            {
                int soTienNap = Int32.Parse(tbSoTienChuyen.Text);
                MessageBox.Show("Số tiền chuyển vào phải lơn hơn 100000 VND", "", MessageBoxButtons.OK);
                tbSoTienChuyen.Focus();
                return;
            }
            else
            {
                Double soTienChuyen = Double.Parse(tbSoTienChuyen.Text);
                //Double soDu = Double.Parse(tbSoDu.Text);
                //Double soTienCon = soDu - soTienChuyen;
                //if (soTienCon < 100000)
                //{
                //    MessageBox.Show("Bạn phải giữ lại tối thiểu 100000 VND trong tài khoản", "", MessageBoxButtons.OK);
                //    tbSoTienChuyen.Focus();
                //    return;
                //}

                string date = DateTime.Now.ToString("yyyy-MM-dd h:mm:ss");
                int    a    = KT_TaiKhoanKH.GD_ChuyenTienTaiKhoan(tbCMND.Text.Trim(), tbSoTK.Text, tbSoTKNhan.Text, date, soTienChuyen, Program.username);

                if (a == 1)
                {
                    MessageBox.Show("Giao dịch thành công");
                    try
                    {
                        this.sP_DS_TAIKHOANTableAdapter.Connection.ConnectionString = Program.connectionstring;
                        this.sP_DS_TAIKHOANTableAdapter.Fill(this.cN_NGANHANG.SP_DS_TAIKHOAN);
                    }
                    catch (System.Data.SqlClient.SqlException ex)
                    {
                        return;
                    }
                    //MessageBox.Show("Giao dịch thành công");
                    tbSoTienChuyen.ResetText();
                    tbSoTKNhan.ResetText();
                }
                else if (a == 2)
                {
                    MessageBox.Show("Không tìm được số tài khoản gửi");
                }
                else if (a == 3)
                {
                    MessageBox.Show("Bạn phải để tối thiểu số dư trong tài khoản lớn hơn 100000 VND");
                }

                else
                {
                    MessageBox.Show("Giao dịch thất bại! Vui lòng kiểm tra lại thông tin");
                }
            }
        }
        private void btnGuiTien_Click(object sender, EventArgs e)
        {
            if (tbSoTaiKhoanGD.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập tài khoản", "", MessageBoxButtons.OK);
                tbSoTaiKhoanGD.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTaiKhoanGD.Text.Trim()))
            {
                MessageBox.Show("Số tài khoản nhập vào không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTaiKhoanGD.Focus();
                return;
            }
            else if (tbSoTienGD.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số tiền nạp", "", MessageBoxButtons.OK);
                tbSoTienGD.Focus();
                return;
            }
            else if (!kiemTraSo(tbSoTienGD.Text))
            {
                MessageBox.Show("Giá trị nhập vào không hợp lệ", "", MessageBoxButtons.OK);
                tbSoTienGD.Focus();
                return;
            }
            else if (Double.Parse(tbSoTienGD.Text) < 100000)
            {
                MessageBox.Show("Số tiền giao dịch vào phải lơn hơn 100000 VND", "", MessageBoxButtons.OK);
                tbSoTienGD.Focus();
                return;
            }

            else
            {
                //Double soTienRut = Double.Parse(tbSoTienGD.Text);
                //Double soTienTK = Double.Parse(tbSoDu.Text);
                //if (((soTienTK - soTienRut) < 100000) && (cbbLoaiGD.SelectedIndex == 1))
                //{
                //    MessageBox.Show("Số dư còn lại phải tối thiểu là 100000 VND", "", MessageBoxButtons.OK);
                //    tbSoTienGD.Focus();
                //    return;
                //}
                Double soTienDG = Double.Parse(tbSoTienGD.Text);

                string loaigd = "RT";
                if (cbbLoaiGD.SelectedIndex == 0)
                {
                    loaigd = "GT";
                }
                string dateGR = DateTime.Now.ToString("yyyy-MM-dd h:mm:ss");
                int    a      = KT_TaiKhoanKH.CapNhatSoDuTaiKhoan(tbCMND.Text.Trim(), tbSoTaiKhoanGD.Text.Trim(), loaigd, dateGR, soTienDG, Program.username);
                if (a == 1)
                {
                    MessageBox.Show("Giao dịch thành công");
                }
                else if (a == 2)
                {
                    MessageBox.Show("Không tìm được số tài khoản");
                }
                else if (a == 3)
                {
                    MessageBox.Show("Bạn phải để tối thiểu số dư trong tài khoản lớn hơn 100000 VND");
                }
                else
                {
                    MessageBox.Show("Giao dịch thất bại! Vui lòng kiểm tra lại");
                }

                try
                {
                    this.sP_DS_TAIKHOANTableAdapter.Connection.ConnectionString = Program.connectionstring;
                    this.sP_DS_TAIKHOANTableAdapter.Fill(this.cN_NGANHANG.SP_DS_TAIKHOAN);
                }
                catch (System.Data.SqlClient.SqlException ex)
                {
                    return;
                }

                tbSoTienGD.ResetText();
            }
        }
        private void btnTaoTK_Click(object sender, EventArgs e)
        {
            int vt_taikhoan = KiemTraViTri_CMND(CMNDKhachHang.Text.Trim());

            if (vt_taikhoan != -1)
            {
                MessageBox.Show("Khách hàng đã tồn tại tài khoản");
            }
            else
            {
                btnThem.Enabled = btnSua.Enabled = btnXoa.Enabled = btnLuu.Enabled = true;
                //MessageBox.Show("Bạn có thể tạo tài khoản khách hàng");
                if (tbSoTaiKhoan.Text == "")
                {
                    MessageBox.Show("Bạn chưa nhập số tài khoản");
                    tbSoTaiKhoan.Focus();
                    return;
                }
                if (tbSoTaiKhoan.Text.Length > 9)
                {
                    MessageBox.Show("Số tài khoản tối đa là 9 số");
                    tbSoTaiKhoan.Focus();
                    return;
                }
                else if (tbSoDu.Text == "")
                {
                    MessageBox.Show("Bạn chưa nhập số dư! Số dư tối thiểu là 100000 VND");
                    tbSoDu.Focus();
                    return;
                }
                else if (!kiemTraSo(tbSoDu.Text))
                {
                    MessageBox.Show("Số dư phải định dạng số");
                    tbSoDu.Focus();
                    return;
                }
                else if (KT_TaiKhoanKH.KiemTraSoTaiKhoan(tbSoTaiKhoan.Text) == 1)
                {
                    MessageBox.Show("Số tài khoản bị trùng! Vui lòng nhập lại");
                    tbSoTaiKhoan.Focus();
                    return;
                }
                else
                {
                    taiKhoanBindingSource.AddNew();
                    ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["SOTK"] = tbSoTaiKhoan.Text;
                    ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["CMND"] = tbCMND.Text;
                    ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["SODU"] = tbSoDu.Text;
                    ((DataRowView)taiKhoanBindingSource[taiKhoanBindingSource.Count - 1])["MACN"] = maChiNhanh.Text;

                    taiKhoanBindingSource.EndEdit();
                    taiKhoanBindingSource.ResetCurrentItem();

                    if (this.taiKhoanTableAdapter.Update(this.cN_NGANHANG) == 1)
                    {
                        MessageBox.Show("Tạo tài khoản khách hàng thành công");
                    }
                    else
                    {
                        MessageBox.Show("Tạo tài khoản khách hàng không thành công");
                        return;
                    }
                    gbTaoTaiKhoanKH.ResetText();
                    gbTaoTaiKhoanKH.Text = "Khách hàng đã có tài khoản";
                    btnTaoTK.ResetText();
                    btnTaoTK.Text = "Duyệt";
                }
            }
        }