Exemplo n.º 1
0
        public bool PrimEkle(Prim p)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("Insert into Primler (PersonelID,PrimTutar,Donem) values(@PersonelID,@Tutar,@Donem)", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = p._personelID;
            comm.Parameters.Add("@Tutar", SqlDbType.Float).Value    = p._primTutar;
            comm.Parameters.Add("@Donem", SqlDbType.VarChar).Value  = p._donem;
            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);
        }
Exemplo n.º 2
0
        public Prim PrimleriGetir(int ID, Prim p)
        {
            SqlCommand comm = new SqlCommand("Select pr.PersonelID, PersonelAd, PersonelSoyad,PrimTutar,Donem from Personel p inner join Primler pr on p.PersonelID=pr.PersonelID where pr.Silindi=0 and PrimID=@ID", conn);

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

            if (dr.Read())
            {
                p.PersonelID    = Convert.ToInt32(dr[0]);
                p.PersonelAd    = dr[1].ToString();
                p.PersonelSoyad = dr[2].ToString();
                p.PrimTutar     = Convert.ToDouble(dr[3]);
                p.Donem         = dr[4].ToString();
            }
            dr.Close();
            conn.Close();
            return(p);
        }