private void btnCetak_Click(object sender, EventArgs e) { PenjualanEntity obj = penjualanEntityBindingSource.Current as PenjualanEntity; if (obj != null) { using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString)) { if (db.State == ConnectionState.Closed) { db.Open(); } ; string query = "SELECT * FROM tbl_detailpenjualan " + $" WHERE NoKwitansi='{obj.NoKwitansi}'"; List <DetailPenjualanEntity> list = db.Query <DetailPenjualanEntity>(query, commandType: CommandType.Text).ToList(); using (fmTransaksiCetak frm = new fmTransaksiCetak(obj, list)) { frm.ShowDialog(); } } } }
public fmTransaksiCetak(PenjualanEntity penjualanEntity, List <DetailPenjualanEntity> list) { InitializeComponent(); _penjualanEntity = penjualanEntity; _list = list; }