示例#1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            ENTITYDEPARTMAN ent = new ENTITYDEPARTMAN();

            ent.Departmanad = TextBox1.Text;
            BLLDEPARTMAN.DEPARTMANEKLE(ent);
        }
示例#2
0
 public static int DEPARTMANEKLE(ENTITYDEPARTMAN DEGER)
 {
     if (DEGER.Departmanad != null && DEGER.Departmanad != " ")
     {
         return(DALDEPARTMAN.DEPARTMANEKLE(DEGER));
     }
     return(-1);
 }
        public static int DEPARTMANEKLE(ENTITYDEPARTMAN DEGER)
        {
            SqlCommand komut = new SqlCommand("insert into TBLDEPARTMAN (DEPARTMANAD) VALUES (@P1)", SQLBAGLANTISI.bgl);

            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }
            komut.Parameters.AddWithValue("@P1", DEGER.Departmanad);
            return(komut.ExecuteNonQuery());
        }
        public static List <ENTITYDEPARTMAN> DEPARTMANLISTESI()
        {
            List <ENTITYDEPARTMAN> degerler = new List <ENTITYDEPARTMAN>();
            SqlCommand             komut    = new SqlCommand("Select * from tbldepartman", SQLBAGLANTISI.bgl);

            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }
            SqlDataReader dr = komut.ExecuteReader();

            while (dr.Read())
            {
                ENTITYDEPARTMAN ent = new ENTITYDEPARTMAN();
                ent.Departmanid = Convert.ToByte(dr["DEPARTMANID"]);
                ent.Departmanad = dr["DEPARTMANAD"].ToString();
                degerler.Add(ent);
            }
            dr.Close();
            return(degerler);
        }