Ejemplo n.º 1
0
        public List <JurusanModel> GetListJurusan()
        {
            try
            {
                List <JurusanModel> Result = new List <JurusanModel>();
                string    Query            = @"SELECT * FROM TbJurusan";
                DataTable dt = new DataTable();
                dt = SQLHelpers.GetDataTable(Query);

                foreach (DataRow dr in dt.Rows)
                {
                    Result.Add(
                        new JurusanModel
                    {
                        idJurusan = Convert.ToString(dr["IdJurusan"]),
                        jurusan   = Convert.ToString(dr["Jurusan"])
                    });
                }
                return(Result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 public List <MahasiswaModel> GetListMahasiswaById(string id)
 {
     try
     {
         List <MahasiswaModel> Result = new List <MahasiswaModel>();
         string    Query = @"SELECT convert(varchar,TglLahir,101) tgl,  * FROM TbMahasiswa where NPM = '" + id + "'";
         DataTable dt    = new DataTable();
         dt = SQLHelpers.GetDataTable(Query);
         foreach (DataRow dr in dt.Rows)
         {
             Result.Add(
                 new MahasiswaModel
             {
                 Id        = Convert.ToInt32(dr["Id"]),
                 NPM       = Convert.ToString(dr["NPM"]),
                 Nama      = Convert.ToString(dr["Nama"]),
                 JK        = Convert.ToString(dr["JK"]),
                 IdJurusan = Convert.ToString(dr["IdJurusan"]),
                 Alamat    = Convert.ToString(dr["Alamat"]),
                 TglLahir  = Convert.ToString(dr["tgl"]),
                 Email     = Convert.ToString(dr["Email"])
             });
         }
         return(Result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
        public List <StandartComboBox> GetJurusan()
        {
            List <StandartComboBox> Result = new List <StandartComboBox>();
            string    Query = @"SELECT IdJurusan, Jurusan From TbJurusan";
            DataTable dt    = new DataTable();

            dt = SQLHelpers.GetDataTable(Query);

            foreach (DataRow dr in dt.Rows)
            {
                Result.Add(
                    new StandartComboBox
                {
                    Value = Convert.ToString(dr["IdJurusan"]),
                    Text  = Convert.ToString(dr["Jurusan"])
                });
            }
            return(Result);
        }
Ejemplo n.º 4
0
        public bool IsDataExist(string Id)
        {
            bool hasil = false;

            try
            {
                string    Query = @"select * from TbJurusan where IdJurusan = '" + Id + "'";
                DataTable dt    = new DataTable();
                dt = SQLHelpers.GetDataTable(Query);
                if (dt.Rows.Count > 0)
                {
                    hasil = true;
                }
                return(hasil);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
        public bool IsDataExist(String id)
        {
            bool hasil = false;

            try
            {
                string    Query = @"SELECT * from TbJurusan WHERE IdJurusan = '" + id + "' ";
                DataTable dt    = new DataTable();
                dt = SQLHelpers.GetDataTable(Query);
                if (dt.Rows.Count > 0)
                {
                    hasil = true;
                }
                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public List <mahasiswamodel> GetListMahasiswa()

        {
            try
            {
                List <mahasiswamodel> Result = new List <mahasiswamodel>();
                string    Query = @"SELECT
                            m.NPM,
                            m.Nama,
                            m.JK,
                            j.Jurusan,
                            m.Alamat,
                            Convert(varchar,m.TglLahir,101) TglLahir,
                            m.Email
                          FROM TbMahasiswa m LEFT JOIN
                          Tbjurusan J on m.IdJurusan = J.IdJurusan";
                DataTable dt    = new DataTable();
                dt = SQLHelpers.GetDataTable(Query);

                foreach (DataRow dr in dt.Rows)
                {
                    Result.Add(
                        new mahasiswamodel
                    {
                        NPM      = Convert.ToString(dr["NPM"]),
                        Nama     = Convert.ToString(dr["Nama"]),
                        JK       = Convert.ToString(dr["JK"]),
                        Jurusan  = Convert.ToString(dr["Jurusan"]),
                        Alamat   = Convert.ToString(dr["Alamat"]),
                        TglLahir = Convert.ToString(dr["TglLahir"]),
                        Email    = Convert.ToString(dr["Email"])
                    });
                }
                return(Result);
            }
            catch (Exception)
            {
                throw;
            }
        }