public static void ThemGiaoDich(GiaoDichDTO gdDto, PhieuRutTienTuTKDTO rutTienTuTKDto, string nhanVien, ref double LePhi) { SqlConnection cnn = KetNoiCSDL.TaoKetNoi(); SqlCommand cmd = new SqlCommand("sp_Lay_phi_rut", cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Ma_TK", SqlDbType.Char); cmd.Parameters.Add("@So_tien", SqlDbType.Money ); cmd.Parameters.Add("@MaNV", SqlDbType.VarChar ); cmd.Parameters["@Ma_TK"].Value = gdDto.MaTK ; cmd.Parameters["@So_tien"].Value = rutTienTuTKDto.SoTien; cmd.Parameters["@MaNV"].Value = nhanVien; cnn.Open(); SqlDataReader dr = cmd.ExecuteReader(); try { if (dr.Read()) { LePhi = double.Parse(dr["LePhi"].ToString()); } cnn.Close(); } catch (Exception ex) { if (cnn.State == ConnectionState.Open) cnn.Close(); throw ex; } }
public static int ThemGiaoDich(GiaoDichDTO gdDto, PhieuChuyenTienDenTKKhacNHDTO ctkhacNHDto, string recentUser, ref double phiGD) { SqlConnection cnn = KetNoiCSDL.TaoKetNoi(); SqlCommand cmd = new SqlCommand("sp_ChuyenTienKhacNH", cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@MaTKChuyen", SqlDbType.Char); cmd.Parameters.Add("@MaTKNhan", SqlDbType.Char); cmd.Parameters.Add("@NHangNhan", SqlDbType.Int); cmd.Parameters.Add("@SoTien", SqlDbType.Money); cmd.Parameters.Add("@MaNVGD", SqlDbType.Char); cmd.Parameters.Add("@ChiNhanhGD", SqlDbType.Int); cmd.Parameters.Add("@PhiGD", SqlDbType.Money); cmd.Parameters["@PhiGD"].Direction = ParameterDirection.Output; cmd.Parameters["@MaTKChuyen"].Value = gdDto.MaTK; cmd.Parameters["@MaTKNhan"].Value = ctkhacNHDto.MaTKNhan; cmd.Parameters["@NHangNhan"].Value = ctkhacNHDto.NganHangNhan; cmd.Parameters["@SoTien"].Value = ctkhacNHDto.SoTien; cmd.Parameters["@MaNVGD"].Value = recentUser; cmd.Parameters["@ChiNhanhGD"].Value = NhanVienDAO.LayChiNhanhGD(recentUser); cnn.Open(); int rs = 0; try { rs = (int)cmd.ExecuteNonQuery(); phiGD = Double.Parse(cmd.Parameters["@PhiGD"].Value.ToString()); cnn.Close(); return rs; } catch (Exception ex) { if (cnn.State == ConnectionState.Open) cnn.Close(); throw ex; } }
public static int ThemGiaoDich(GiaoDichDTO gdDto, PhieuChuyenTienDenTKKhacNHDTO ctkhacNHDto, string recentUser, ref double phiGD) { return GiaoDichChuyenTienDenTKKhacNHDAO.ThemGiaoDich(gdDto, ctkhacNHDto, recentUser, ref phiGD); }
// Chuyển tiền đi từ tài khoản //0712455 private void ChuyenTienDenTKKhacNH() { GiaoDichDTO gdDto = new GiaoDichDTO(); PhieuChuyenTienDenTKKhacNHDTO ctienKhacNhDto = new PhieuChuyenTienDenTKKhacNHDTO(); gdDto.MaTK = tb_CTSub_MaTKTu.Text.Trim(); ctienKhacNhDto.MaTKNhan = tb_CTSub_MaTKDen.Text.Trim(); ctienKhacNhDto.NganHangNhan = (int)((NganHangDTO)cb_CT_NganHang.SelectedItem).MaNganHang; ctienKhacNhDto.SoTien = Convert.ToDouble(tb_CTSub_SoTien.Text.Trim()); try { double phiDV = 0.0; GiaoDichChuyenTienDenTKKhacNHBUS.ThemGiaoDich(gdDto, ctienKhacNhDto, recentUser, ref phiDV); string str = String.Format("Đã chuyển khoản thành công. Phí dịch vụ là : {0}", phiDV); MessageBox.Show(str); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//0712455 private void ChuyenTienDenTKCungNH() { GiaoDichDTO gdDto = new GiaoDichDTO(); PhieuChuyenTienDenTKCungNHDTO ctienCungNhDto = new PhieuChuyenTienDenTKCungNHDTO(); gdDto.MaTK = tb_CTSub_MaTKTu.Text.Trim(); ctienCungNhDto.MaTKNhan = tb_CTSub_MaTKDen.Text.Trim(); ctienCungNhDto.MaChiNhanh = Int32.Parse(tb_CT_MaCNNhan.Text); ctienCungNhDto.SoTien = Convert.ToDouble(tb_CTSub_SoTien.Text.Trim()); try { double phiDV = 0.0; GiaoDichChuyenTienDenTKCungNHNoBUS.ThemGiaoDich(gdDto, ctienCungNhDto, recentUser,ref phiDV); string str = String.Format("Đã chuyển khoản thành công. Phí dịch vụ là : {0}", phiDV); MessageBox.Show(str); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// end 0712455 // Rút tiền từ tài khoản //0712452 private double RutTienTuTaiKhoan(string Ma_tai_khoan) { double Lephi = 0.0; GiaoDichDTO gdDto = new GiaoDichDTO(); PhieuRutTienTuTKDTO rutTienTuTKDto = new PhieuRutTienTuTKDTO(); gdDto.MaTK = Ma_tai_khoan; rutTienTuTKDto.SoTien = Convert.ToDouble(tb_so_tien_rut.Text.Trim()); try { RutTienBUS.ThemGiaoDich(gdDto, rutTienTuTKDto, recentUser, ref Lephi ); return Lephi; } catch (Exception ex) { MessageBox.Show(ex.Message); return Lephi ; } }
private double NapTienVoTaiKhoan() { double Lephi = 0.0; PhieuNapTienDTO napTienDto = new PhieuNapTienDTO(); GiaoDichDTO gdDto = new GiaoDichDTO(); KhachHangDTO khachHangDto = new KhachHangDTO(); gdDto.MaTK = tb_MaTK_nap.Text.Trim(); khachHangDto.HoTen = tb_hoTenChuKhoan_nap.Text; napTienDto.HoTenNguoiGui = tb_HoTenNgGui_nap.Text; napTienDto.DiaChiNguoiGui = tb_DiaChiNggui_nap.Text; napTienDto.SoTien = Convert.ToDouble(tb_soTien_nap.Text.Trim()); try { NapTienBUS.ThemGiaoDich(gdDto, napTienDto, khachHangDto, recentUser,ref Lephi); MessageBox.Show("Đã nạp tiền thành công "); return Lephi; } catch (Exception ex) { MessageBox.Show(ex.Message); return Lephi ; } }
public static void ThemGiaoDich(GiaoDichDTO gdDto, PhieuRutTienTuTKDTO rutTienTuTKDto, string nhanVien, ref double LePhi) { RutTienDAO.ThemGiaoDich(gdDto, rutTienTuTKDto, nhanVien , ref LePhi ); }
public static void ThemGiaoDich(GiaoDichDTO gdDto, PhieuNapTienDTO napTienDto, KhachHangDTO khachHangDto, string nhanVien,ref double LePhi) { NapTienDAO.ThemGiaoDich(gdDto, napTienDto, khachHangDto, nhanVien,ref LePhi); }