private void button5_Click(object sender, EventArgs e) { materi = new Entity.EntMateri(); //Entity.EntMateri push_materi = new Entity.EntMateri(); //push_materi.SetKelas(comboBox1.Text); //push_materi.SetMateri(txtMateri.Text); //push_materi.SetMatakuliah(comboBox2.Text); try { materi.SetMatakuliah(comboBox2.Text.Substring(0, 1)); materi.SetKelas(comboBox1.Text.Substring(0, 6)); materi.SetMateri(txtMateri.Text); if (impDosen.InsertMateri(materi)) { this.Hide(); View.FrmPresensi frm = new View.FrmPresensi(); frm.Show(); } else { MessageBox.Show("Error"); } } catch (Exception) { txtMateri.Select(); MessageBox.Show("Mohon Isi Materi"); } }
public Boolean SelectKelas(Entity.EntMateri em) { status = false; try { query = "SELECT kode_kelas FROM KELAS kode_kelas WHERE kode_kelas = '" + em.GetKelas() + "'"; koneksi.Open(); command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (SqlException se) { Console.WriteLine("ERROR" + se); } return(status); }
Boolean InsertKelas(Entity.EntMateri em) { status = false; try { query = "INSERT INTO kode_kelas VALUES ('" + em.GetKelas() + "')"; koneksi.Open(); command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (SqlException se) { Console.WriteLine("ERROR" + se); } return(status); }
public Boolean SelectMatakuliah(Entity.EntMateri em) { status = false; try { query = "INSERT INTO Materi VALUES Kode_Matkul ('" + em.GetMatakuliah() + "')"; //'"+ em.GetMatakuliah() + "' koneksi.Open(); command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; //Entity.EntMateri.SeNamaMatkul(reader.GetString(1)); koneksi.Close(); } catch (SqlException se) { Console.WriteLine("ERROR" + se); } return(status); }