Exemple #1
0
        public string UpdateDataWaliKelas(WaliKelas dp)
        {
            SqlCommand cmd = new SqlCommand("update walikelas set Nama_Wali_Kelas='" + dp.nama_walikelas + "'" +
                                            ", Username_wk='" + dp.uname_walikelas + "', Password_wk='" + dp.passw_walikelas + "'" +
                                            ", ID_Kelas='" + dp.id_kelas + "' where ID_Wali_Kelas = " + "'" + dp.id_walikelas + "'", conn);

            try
            {
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                return("Data Berhasil Di Update");
            }
            catch (Exception ex)
            {
                return("Data Gagal Di Update : " + ex);
            }
        }
Exemple #2
0
        public WaliKelas GetWalikelas(string id)
        {
            WaliKelas  ad  = new WaliKelas();
            SqlCommand cmd = new SqlCommand("select * from walikelas where Username_wk = " + "'" + id + "'", conn);

            //    SqlCommand sqlCommand = new SqlCommand("select * from pesanan where id = " + id, conn);
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ad.id_walikelas    = reader["ID_Wali_Kelas"].ToString();
                ad.nama_walikelas  = reader["Nama_Wali_Kelas"].ToString();
                ad.uname_walikelas = reader["Username_wk"].ToString();
                ad.passw_walikelas = reader["Password_wk"].ToString();
                ad.id_kelas        = reader["ID_Kelas"].ToString();
            }
            conn.Close();
            return(ad);
        }
Exemple #3
0
        public string AddDataWaliKelas(WaliKelas dp)
        {
            SqlCommand cmd = new SqlCommand("insert into walikelas(Nama_Wali_Kelas,Username_wk,Password_wk,ID_Kelas) values(" +
                                            "'" + dp.nama_walikelas + "'," +
                                            "'" + dp.uname_walikelas + "'," +
                                            "'" + dp.passw_walikelas + "'," +
                                            "'" + dp.id_kelas + "')", conn);

            try
            {
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                return("Data Berhasil Di Simpan");
            }
            catch (Exception ex)
            {
                return("Data Gagal Di Simpan : " + ex);
            }
        }
Exemple #4
0
        public List <WaliKelas> GetWaliKelas()
        {
            //string query = String.Format("Update pesanan set pesanan")
            List <WaliKelas> dp  = new List <WaliKelas>();
            SqlCommand       cmd = new SqlCommand("select * from walikelas", conn);

            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                WaliKelas pesan = new WaliKelas();
                pesan.id_walikelas    = reader["ID_Wali_Kelas"].ToString();
                pesan.nama_walikelas  = reader["Nama_Wali_Kelas"].ToString();
                pesan.uname_walikelas = reader["Username_wk"].ToString();
                pesan.passw_walikelas = reader["Password_wk"].ToString();
                pesan.id_kelas        = reader["ID_Kelas"].ToString();
                dp.Add(pesan);
            }
            conn.Close();
            return(dp);
        }