private void CheckBanlance_Load(object sender, EventArgs e) { helloPanel.BackColor = Color.FromArgb(255, 255, 204, 55); GhiGiaoDich ghi = new GhiGiaoDich(); ghi.Ngaygiaodich = DateTime.Now; ghi.MoTaGD = "Vấn tin tài khoản"; ghi.SoTheATM = the; ghi.MaATM = maATM; ghi.Malog = "Log03"; ghi.SotheATMnhanTien = ""; GhiGiaoDich_BUL.Instance.TaoMoiBanGhi(ghi); string t = string.Format("Thông tin:\r\n-Chủ tài khoản: {0}\r\n- Số dư trong tài khoản: {1}", kh.Tenkhachhang, tk.SoTienConLaiTrongTK.ToString("c")); label1.Text = t; var images = typeof(Properties.Resources) .GetProperties(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public) .Where(p => p.PropertyType == typeof(Bitmap)) .Select(x => new { Name = x.Name, Image = x.GetValue(null, null) }) .ToList(); Random r = new Random(); int i = r.Next(0, images.Count - 1); this.BackgroundImage = (Image)images[i].Image; }
private void btn500_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text)) { if (!string.IsNullOrEmpty(textBox2.Text)) { if (textBox1.Text.Equals(textBox2.Text)) { int pin = 0; if (int.TryParse(textBox1.Text, out pin)) { if (DanhSachTheATM_BUL.Instance.DoiMaPIN(the, pin) > 0) { GhiGiaoDich ghi = new GhiGiaoDich(); ghi.Ngaygiaodich = DateTime.Now; ghi.MoTaGD = "Đổi mã pin"; ghi.SoTheATM = the; ghi.MaATM = maATM; ghi.Malog = "Log05"; ghi.SotheATMnhanTien = ""; GhiGiaoDich_BUL.Instance.TaoMoiBanGhi(ghi); if (ok != null) { ok(true); } } else { MessageBox.Show("Đã xảy ra lỗi trong quá trình xử lý.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Mã PIN là 1 dãy ít nhất 4 số.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Mật khẩu không trùng khớp.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Hãy nhập lại mật khẩu.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Mật khẩu không được để trống.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Chọn số tiền mặc định trên máy /// </summary> /// <param name="money"></param> private void WithDraw_SetMoney(string money) { double soTien = 0; if (money.Equals("none")) { mainPanel.Controls.Clear(); mainPanel.Controls.Add(draw_Chosse); } else { string[] temp_ = money.Split('.'); money = string.Empty; for (int i = 0; i < temp_.Length; i++) { money += temp_[i]; } soTien = double.Parse(money); if (DanhSachTaiKhoan_BUL.Instance.SoTienCoTrongTaiKhoan(tk.Mataikhoan) >= soTien) { if (DanhSachTaiKhoan_BUL.Instance.RutTien(tk.Mataikhoan, soTien) > 0) { GhiGiaoDich ghi = new GhiGiaoDich(); ghi.Ngaygiaodich = DateTime.Now; ghi.MoTaGD = "Rút tiền"; ghi.SoTheATM = ds.SoTheATM; ghi.MaATM = thongTinMay.MaATM; ghi.Malog = "Log01"; ghi.KhoanTienGD = soTien; ghi.SotheATMnhanTien = ""; GhiGiaoDich_BUL.Instance.TaoMoiBanGhi(ghi); mainPanel.Controls.Clear(); mainPanel.Controls.Add(final_UC); } 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 trong tài khoản không đủ để thực hiện giao dịch", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public int TaoMoiBanGhi(GhiGiaoDich ghi) { string logID = DataProvider.Instance.GetValueFunction("select dbo.fn_GetLog()"); ghi.MaBanghiLog = logID; string query = @"INSERT INTO [dbo].[GhiGiaoDich] ([MaBanghiLog] ,[Ngaygiaodich] ,[KhoanTienGD] ,[MoTaGD] ,[SotheATMnhanTien] ,[SoTheATM] ,[Malog] ,[MaATM]) VALUES ( @malogID , @ngayGD , @soTien , @moTa , @maATMNhan , @maThe , @maLog , @maATM_ )"; return(DataProvider.Instance.ExcuteNonQuery(query, new object[] { ghi.MaBanghiLog, ghi.Ngaygiaodich, ghi.KhoanTienGD, ghi.MoTaGD, ghi.SotheATMnhanTien, ghi.SoTheATM, ghi.Malog, ghi.MaATM })); }
/// <summary> /// Lựa chọn số tiền nhập vào /// </summary> /// <param name="isContinue"></param> /// <param name="soTien"></param> private void Draw_Chosse_ok(bool isContinue, double soTien) { if (isContinue && soTien != -1) { if (DanhSachTaiKhoan_BUL.Instance.SoTienCoTrongTaiKhoan(tk.Mataikhoan) >= soTien) { if (DanhSachTaiKhoan_BUL.Instance.RutTien(tk.Mataikhoan, soTien) > 0) { GhiGiaoDich ghi = new GhiGiaoDich(); ghi.Ngaygiaodich = DateTime.Now; ghi.MoTaGD = "Rút tiền"; ghi.SoTheATM = ds.SoTheATM; ghi.MaATM = thongTinMay.MaATM; ghi.Malog = "Log01"; ghi.KhoanTienGD = soTien; ghi.SotheATMnhanTien = ""; GhiGiaoDich_BUL.Instance.TaoMoiBanGhi(ghi); mainPanel.Controls.Clear(); mainPanel.Controls.Add(final_UC); } 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 trong tài khoản không đủ để thực hiện giao dịch", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { mainPanel.Controls.Clear(); mainPanel.Controls.Add(main); } }
public int GhiLog(GhiGiaoDich giaoDich) { string query = @"INSERT INTO [dbo].[GhiGiaoDich] ([MaBanghiLog] ,[Ngaygiaodich] ,[KhoanTienGD] ,[MoTaGD] ,[SotheATMnhanTien] ,[SoTheATM] ,[Malog] ,[MaATM]) VALUES ( @mabangi , @ngaygd , @khoantien , @mota , @sothenhan , @sothe , @maLog , @maatm )"; return(DataProvider.Instance.ExcuteNonQuery(query, new object[] { giaoDich.MaBanghiLog, giaoDich.Ngaygiaodich, giaoDich.KhoanTienGD, giaoDich.SotheATMnhanTien, giaoDich.SoTheATM, giaoDich.Malog, giaoDich.MaATM })); }
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); } } } }