コード例 #1
0
ファイル: Maas.cs プロジェクト: sduran05/Employee-Tracking
        public double SabitMaasGetir(Maas m)
        {
            SqlCommand comm = new SqlCommand("Select SabitMaas from Personel where PersonelID=@PersonelID", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = m._personelID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr = comm.ExecuteReader();

            dr.Read();
            Personel p = new Personel();

            p.SabitMaas = Convert.ToDouble(dr["SabitMaas"]);
            dr.Close();
            conn.Close();
            return(p.SabitMaas);
        }
コード例 #2
0
        public bool PersonelEkle(Personel p)
        {
            bool       sonuc = false;
            SqlCommand comm  = new SqlCommand("Insert Into Personel (TCKN,PersonelAd,PersonelSoyad,Telefon,Adres,Departman,Durum,IBAN,SabitMaas,GirisTarihi,CikisTarihi) values(@TCKN,@PersonelAd,@PersonelSoyad,@Telefon,@Adres,@Departman,@Durum,@IBAN,@SabitMaas,@GirisTarihi,@CikisTarihi)", conn);

            comm.Parameters.Add("@TCKN", SqlDbType.VarChar).Value          = p._tCKN;
            comm.Parameters.Add("@PersonelAd", SqlDbType.VarChar).Value    = p._personelAd;
            comm.Parameters.Add("@PersonelSoyad", SqlDbType.VarChar).Value = p._personelSoyad;
            comm.Parameters.Add("@Telefon", SqlDbType.VarChar).Value       = p._telefon;
            comm.Parameters.Add("@Adres", SqlDbType.VarChar).Value         = p._adres;
            comm.Parameters.Add("@Departman", SqlDbType.VarChar).Value     = p._departman;
            comm.Parameters.Add("@Durum", SqlDbType.VarChar).Value         = p._durum;
            comm.Parameters.Add("@IBAN", SqlDbType.VarChar).Value          = p._iBAN;
            comm.Parameters.Add("@SabitMaas", SqlDbType.Money).Value       = p._sabitMaas;
            comm.Parameters.Add("@GirisTarihi", SqlDbType.DateTime).Value  = p._girisTarihi;
            comm.Parameters.Add("@CikisTarihi", SqlDbType.DateTime).Value  = Convert.ToDateTime("31.12.2199 00:00:00.000");


            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }



            return(sonuc);
        }