コード例 #1
0
        public int PersonelEkle(Personel personel)
        {
            try
            {
                if (PersonelExists(personel.getPersonelID()))
                {
                    throw new Exception("Course with same name exists");
                }

                string query = $"INSERT INTO Personel(departmanID,kisiID) VALUES('{personel.getDepartmanID()}','{personel.getKisiID()}')";
                return(DbHelper.ExecuteNonQuery(query));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        public List <Personel> GetPersonel()
        {
            try
            {
                List <Personel> list  = new List <Personel>();
                string          query = $"SELECT a.Personel_ID,a.Departman_ID,b.Ad,b.Soyad from personel a,kisi b where a.Kisi_ID=b.Kisi_ID ";
                var             dt    = DbHelper.ExecuteQuery(query);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Personel personel = new Personel();
                    personel.setPersonelID(int.Parse(dt.Rows[i]["personelID"].ToString()));
                    // personel.ad = dt.Rows[i]["ad"].ToString();
                    //personel.soyad = dt.Rows[i]["soyad"].ToString();

                    list.Add(personel);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception("GetAllDeparments Error: " + ex.Message);
            }
        }