private void btnFilter_Click(object sender, EventArgs e) { var form = new FrmFilter(set); var returnvalue = form.RunAndReturnObjectTMahasiswa(form); if (returnvalue != null) { string nim = returnvalue.Nim; string nama = returnvalue.Nama; string jeniskelamin = returnvalue.JenisKelamin; string programstudi = returnvalue.ProgramStudi; string waktukuliah = returnvalue.WaktuKuliah; string kelas = returnvalue.Kelas; string query = @"Select* from TMahasiswa where[Nim] like '" + nim + "%' and [Nama] like '" + nama + "%' and [JenisKelamin] like '" + jeniskelamin + "%' and [ProgramStudi] like '" + programstudi + "%' and [WaktuKuliah] like '" + waktukuliah + "%' and [Kelas] like '" + kelas + "%'"; LoadData(query); lblFilter.Text = $"Filter By : Nim : {nim}. Nama : {nama}. Jenis Kelamin : {jeniskelamin}. Program Studi : {programstudi}. Waktu Kuliah : {waktukuliah}. Kelas : {kelas}"; set.Nim = nim; set.Nama = nama; set.JenisKelamin = jeniskelamin; set.ProgramStudi = programstudi; set.WaktuKuliah = waktukuliah; set.Kelas = kelas; } }
private void btnFilter_Click(object sender, EventArgs e) { var conn = new Connection().OpenConnection(); var formFilter = new FrmFilter(mhsValue); var filterValue = formFilter.passFilterValue(formFilter); if (filterValue != null) { string nim = filterValue.Nim; string nama = filterValue.Nama; string jk = filterValue.JenisKelamin; string prodi = filterValue.ProgramStudi; string wk = filterValue.WaktuKuliah; string kls = filterValue.Kelas; SqlCommand cmd = new SqlCommand ( @"SELECT * FROM TMahasiswa WHERE [Nim] LIKE '" + nim + "%' AND [Nama] LIKE '" + nama + "%' AND [JenisKelamin] LIKE '" + jk + "%' AND [ProgramStudi] LIKE '" + prodi + "%' AND [WaktuKuliah] LIKE '" + wk + "%' AND [Kelas] LIKE '" + kls + "%' ", conn ); DataTable dt = new DataTable(); SqlDataReader reader = cmd.ExecuteReader(); dt.Load(reader); dgvData1.DataSource = dt; mhsValue.Nim = nim; mhsValue.Nama = nama; mhsValue.JenisKelamin = jk; mhsValue.ProgramStudi = prodi; mhsValue.WaktuKuliah = wk; mhsValue.Kelas = kls; this.lblBanyakRecordData.Text = dgvData1.Rows.Count.ToString() + " Record Data."; this.lblFilter.Text = $"Nim : {nim} " + $"Nama : {nama} " + $"Jenis Kelamin : {jk} " + $"Program Studi : {prodi} " + $"Waktu Kuliah : {wk} " + $"Kelas : {kls}"; } }
private void btnFilter_Click(object sender, EventArgs e) { var frmfilter = new FrmFilter(MhsSent); var returnvalue = frmfilter.RunAndReturnObjectMahasiswa(frmfilter); if (returnvalue != null) { string nim = returnvalue.Nim; string nama = returnvalue.Nama; string jnskelamin = returnvalue.JenisKelamin; string prgmstudi = returnvalue.ProgramStudi; string watkul = returnvalue.WaktuKuliah; string kls = returnvalue.Kelas; SqlCommand cmd = new SqlCommand(@"Select * from TMahasiswa where [nim] like '" + nim + "%' and [nama] like '" + nama + "%' and [jeniskelamin] like '" + jnskelamin + "%' and [programstudi] like '" + prgmstudi + "%' and [waktukuliah] like '" + watkul + "%' and [kelas] like '" + kls + "%' ", conn); DataTable dt = new DataTable(); conn.Open(); SqlDataReader sdr = cmd.ExecuteReader(); dt.Load(sdr); conn.Close(); dgvData.DataSource = dt; lblFilter.Text = $"Nim : {nim}. Nama : {nama}. Jenis Kelamin : {jnskelamin}. Program Studi : {prgmstudi}. Waktu Kuliah : {watkul}. Kelas : {kls}"; MhsSent.Nim = nim; MhsSent.Nama = nama; MhsSent.JenisKelamin = jnskelamin; MhsSent.ProgramStudi = prgmstudi; MhsSent.WaktuKuliah = watkul; MhsSent.Kelas = kls; } }
private void dgvData_DoubleClick(object sender, EventArgs e) { if (this.dgvData.CurrentRow != null) { var row = this.dgvData.CurrentRow; string nim = row.Cells[0].Value.ToString().Trim(); string nama = row.Cells[1].Value.ToString().Trim(); string jeniskelamin = row.Cells[2].Value.ToString().Trim();; string programstudi = row.Cells[3].Value.ToString().Trim(); string waktukuliah = row.Cells[4].Value.ToString().Trim(); string kelas = row.Cells[5].Value.ToString().Trim(); FrmFilter form = new FrmFilter(set); var returnValue = form.RunAndReturnObjectTMahasiswa(form); if (returnValue != null) { row.Cells[0].Value = returnValue.Nim; row.Cells[1].Value = returnValue.Nama; row.Cells[2].Value = returnValue.JenisKelamin; row.Cells[3].Value = returnValue.ProgramStudi; row.Cells[4].Value = returnValue.WaktuKuliah; row.Cells[5].Value = returnValue.Kelas; } } }
public Mahasiswa RunAndReturnObjectMahasiswa(FrmFilter frm) { frm.ShowDialog(); return(mhswa); }
public TMahasiswa RunAndReturnObjectTMahasiswa(FrmFilter form) { form.ShowDialog(); return(_objMhs); }
public Mahasiswa passFilterValue(FrmFilter form) { form.ShowDialog(); return(DataMahasiswa); }