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; } }
// 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 ; } }
public static void ThemGiaoDich(GiaoDichDTO gdDto, PhieuRutTienTuTKDTO rutTienTuTKDto, string nhanVien, ref double LePhi) { RutTienDAO.ThemGiaoDich(gdDto, rutTienTuTKDto, nhanVien , ref LePhi ); }