Esempio n. 1
0
        public int SimpanMahasiswa(MahasiswaModel model)
        {
            int hasil = -1;

            try
            {
                string Query = @"Insert into TbMahasiswa ([NPM]
                                    ,[Nama]
                                    ,[JK]
                                    ,[IdJurusan]
                                    ,[Alamat]
                                    ,[TglLahir]
                                    ,[Email])
                                Values('" + model.NPM + "'," +
                               "'" + model.Nama + "'," +
                               "'" + model.JK + "'," +
                               "'" + model.IdJurusan + "'," +
                               "'" + model.Alamat + "'," +
                               "'" + model.TglLahir + "'," +
                               "'" + model.Email + "')";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public int DeleteJurusan(string Id)
        {
            int hasil = -1;

            try
            {
                string Query = @"Delete TbJurusan Where IdJurusan = '" + Id + "'";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public int DeleteMahasiswa(string NPM)
        {
            int hasil = -1;

            try
            {
                string Query = @"Delete TbMahasiswa Where IdMahasiswa = '" + NPM + "'";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public int SimpanJurusan(JurusanModel model)
        {
            int hasil = -1;

            try
            {
                string Query = @"Insert into TbJurusan values('" + model.idJurusan + "','" + model.jurusan + "')";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public int DeleteJurusan(string id)
        {
            int hasil = -1;

            try
            {
                string Query = @"DELETE  TbJurusan WHERE IdJurusan= '" + id + "' ";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public int UpdateJurusan(JurusanModel model)
        {
            int hasil = -1;

            try
            {
                string Query = @"UPDATE TbJurusan SET Jurusan = '" + model.jurusan + "' WHERE IdJurusan ='" + model.idJurusan + "' ";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        public int UpdateMahasiswa(MahasiswaModel model)
        {
            int hasil = -1;

            try
            {
                string Query = @"Update TbMahasiswa 
                                SET Nama        = '" + model.Nama + "', " +
                               "JK         = '" + model.JK + "', " +
                               "IdJurusan  = '" + model.IdJurusan + "', " +
                               "Alamat     = '" + model.Alamat + "', " +
                               "TglLahir   = '" + model.TglLahir + "', " +
                               "Email      = '" + model.Email + "' " +
                               "Where NPM      = '" + model.NPM + "'";
                hasil = SQLHelpers.ExecQuery(Query);
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }