public Validation(MainForm main) { InitializeComponent(); this.main = main; ds = new DanhsachtheATM(); main.exit += Main_exit; main.btnChange += Main_btnChange; main.delete_Text += Main_delete_Text; }
public void ResetData() { textBox1.Text = string.Empty; textBox2.Text = string.Empty; Cardpanel.Visible = true; PassPanel.Visible = false; ds = null; IsVisible = false; }
public DanhsachtheATM LayThongTinThe(DataTable dt) { DanhsachtheATM ds = new DanhsachtheATM(); ds.SoTheATM = dt.Rows[0][0].ToString(); ds.MaPin = int.Parse(dt.Rows[0][1].ToString()); ds.TrangThaiThe = dt.Rows[0][2].ToString(); ds.Mataikhoan = dt.Rows[0][3].ToString(); ds.NgayCapThe = DateTime.Parse(dt.Rows[0][4].ToString()); ds.NgayHetHan = DateTime.Parse(dt.Rows[0][5].ToString()); ds.SoLanNhapPin = int.Parse(dt.Rows[0][6].ToString()); return(ds); }
public bool KiemTraThongTin(string MaThe, out DanhsachtheATM _obj) { string query = @"select [SoTheATM] ,[MaPin] ,[TrangThaiThe] ,[Mataikhoan] ,[NgayCapThe] ,[NgayHetHan] ,[SoLanNhapPin] from DanhsachtheATM where SoTheATM = @mathe"; DataTable dt = DataProvider.Instance.ExcuteQuery(query, new object[] { MaThe }); if (dt.Rows.Count > 0) { _obj = LayThongTinThe(dt); return(true); } else { _obj = null; return(false); } }
/// <summary> /// Bắt sự kiện đăng nhập và khởi tạo các use case có liên quan /// </summary> /// <param name="isSuccess"></param> /// <param name="ds"></param> /// <param name="mathe"></param> private void Validation_login(bool isSuccess, DanhsachtheATM ds, string mathe) { if (isSuccess) { this.ds = ds; tk = DanhSachTaiKhoan_BUL.Instance.LayThongTinTaiKhoan(ds.Mataikhoan); kh = KhachHang_BUL.Instance.LayThongTinKhachHang(tk.Makhachhang); main = new MainUC(tk, kh); this.mathe = mathe; main.rutten += Main_rutten; main.checkBalance += Main_checkBalance; main.history += Main_history; main.changePIN += Main_changePIN; main.exit += Main_exit; main.cardTranfer += Main_cardTranfer; viewHistory = new ViewHistory(tk, kh, mathe, thongTinMay.MaATM); checkBanlance = new CheckBanlance(tk, kh, mathe, thongTinMay.MaATM); changePIN = new ChangePIN(mathe, thongTinMay.MaATM, this); withDraw = new WithDraw(tk, kh); beingFinal = new BeingFinal_UC(tk, kh); cardTranfer = new CardTranfer(tk, kh, mathe, thongTinMay.MaATM, this); final_UC = new Final_UC(tk, kh); withDraw.SetMoney += WithDraw_SetMoney; viewHistory.click += ViewHistory_click; checkBanlance.click += CheckBanlance_click; changePIN.ok += ChangePIN_ok; cardTranfer.tranfer += CardTranfer_tranfer; final_UC.click_Finish += Final_UC_click_Finish; mainPanel.Controls.Clear(); mainPanel.Controls.Add(main); } }
void SetData() { if (Cardpanel.Visible) { if (!string.IsNullOrEmpty(textBox1.Text)) { if (DanhSachTaiKhoan_BUL.Instance.KiemTraTaiKhoan(textBox1.Text, out tkNhan)) { IsVisible = true; Cardpanel.Visible = false; PassPanel.Visible = true; btnOk.Text = "Chuyển tiền"; } else { MessageBox.Show("Đã xảy ra lỗi trong quá trình xử lý.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Tài khoản không có trong hệ thống.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { if (tkNhan != null) { if (!string.IsNullOrEmpty(textBox2.Text)) { double slTien = 0; if (double.TryParse(textBox2.Text, out slTien)) { if (DanhSachTaiKhoan_BUL.Instance.SoTienCoTrongTaiKhoan(tk.Mataikhoan) >= slTien) { //Cho phep chuyen khoan if (DanhSachTaiKhoan_BUL.Instance.ChuyenKhoan(tkNhan.Mataikhoan, tk.Mataikhoan, slTien) > 0) { GhiGiaoDich ghi = new GhiGiaoDich(); ghi.Ngaygiaodich = DateTime.Now; ghi.MoTaGD = "Chuyển khoản"; ghi.SoTheATM = mathe; ghi.MaATM = maATM; ghi.Malog = "Log02"; ghi.SotheATMnhanTien = ""; DanhsachtheATM ds = DanhSachTheATM_BUL.Instance.LayThongTin(tk.Mataikhoan); if (ds != null) { ghi.SotheATMnhanTien = ds.SoTheATM; } ghi.KhoanTienGD = slTien; GhiGiaoDich_BUL.Instance.TaoMoiBanGhi(ghi); ResetData(); if (tranfer != null) { tranfer(true); } } else { MessageBox.Show("Đã xảy ra lỗi trong quá trình xử lý.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Số tiền còn lại trong tài khoản không đủ để thực hiện giao dịch.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Định dạng dữ liệu sai.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Không được để trống trường này.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } }