protected void Page_Load(object sender, EventArgs e) { SqlCommand komut1 = new SqlCommand("select * from Tbl_KitapBilgileri where Tbl_KitapBilgileri.TeslimEdilmeDurumu=1", bgl.baglanti()); SqlDataReader dr = komut1.ExecuteReader(); DropDownList1.DataTextField = "KitapAd"; DropDownList1.DataValueField = "KitapID"; DropDownList1.DataSource = dr; DropDownList1.DataBind(); Label3.Visible = false; bgl.baglanti().Close(); }
protected void LinkButton1_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("select * from Tbl_Kullanici where KullaniciAd=@p1 and KullaniciSifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", txt_kullaniciAd.Text); komut.Parameters.AddWithValue("@p2", txt_sifre.Text); SqlDataReader dr = komut.ExecuteReader(); if (dr.Read()) { SqlCommand komut2 = new SqlCommand("select KullaniciID from Tbl_Kullanici where KullaniciAd=@p1", bgl.baglanti()); komut2.Parameters.AddWithValue("@p1", txt_kullaniciAd.Text); SqlDataReader dr2 = komut2.ExecuteReader(); while (dr2.Read()) { Session.Add("ID", dr2[0].ToString()); } Response.Redirect("Kullanici.aspx"); } else { Response.Write("<script lang='JavaScript'>alert('Hatalı Kullanıcı Adı veya Şifre');</script>"); txt_kullaniciAd.Text = ""; txt_sifre.Text = ""; txt_kullaniciAd.Focus(); } bgl.baglanti().Close(); }
protected void btn_kaydet_Click(object sender, EventArgs e) { btn_kaydet.Visible = true; ekleISBN = ISBN_Kontrol(); Label1.Visible = true; SQLBaglanti bgl = new SQLBaglanti(); SqlCommand komut = new SqlCommand("insert into Tbl_KitapBilgileri (KitapAd,KitapISBN) values (@p1,@p2)", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", txt_kitapAdi.Text); komut.Parameters.AddWithValue("@p2", ekleISBN); komut.ExecuteNonQuery(); bgl.baglanti().Close(); }
protected void Page_Load(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("select KullaniciAd,KitapAd from Tbl_Kullanici, Tbl_Kitap, Tbl_KitapBilgileri where Tbl_Kullanici.KullaniciID = Tbl_Kitap.KullaniciID and Tbl_Kitap.KitapID = Tbl_KitapBilgileri.KitapID and Tbl_Kitap.TeslimTarihi is null", bgl.baglanti()); SqlDataReader dr = komut.ExecuteReader(); DataList1.DataSource = dr; DataList1.DataBind(); SqlCommand komut2 = new SqlCommand("select Tbl_Kullanici.KullaniciAd from Tbl_Kullanici where Tbl_Kullanici.KullaniciID not in (select Tbl_Kitap.KullaniciID from Tbl_Kitap where Tbl_Kitap.TeslimTarihi is null)", bgl.baglanti()); SqlDataReader dr2 = komut2.ExecuteReader(); DataList2.DataSource = dr2; DataList2.DataBind(); bgl.baglanti().Close(); }
protected void btn_ara_Click(object sender, EventArgs e) { Label2.Visible = true; Label1.Visible = true; TextBox1.Visible = true; btn_ara.Visible = true; if (Label3.Text.Equals("CheckBox1")) { SqlCommand komut = new SqlCommand("select * from Tbl_KitapBilgileri where TeslimEdilmeDurumu=1 and KitapAd=@p1", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", TextBox1.Text); SqlDataReader dr = komut.ExecuteReader(); if (dr.Read()) { //Label3.Text= kontrol.ToString(); Label2.Text = "İstediğiniz kitap bulunmaktadır."; } else { Label2.Text = "İstediğiniz kitap bulunmamaktadır."; } } else if (Label3.Text.Equals("CheckBox2")) { SqlCommand komut2 = new SqlCommand("select * from Tbl_KitapBilgileri where TeslimEdilmeDurumu=1 and KitapISBN=@p1", bgl.baglanti()); komut2.Parameters.AddWithValue("@p1", TextBox1.Text); SqlDataReader dr2 = komut2.ExecuteReader(); if (dr2.Read()) { Label2.Text = "İstediğiniz kitap bulunmaktadır."; } else { Label2.Text = "İstediğiniz kitap bulunmamaktadır."; } } bgl.baglanti().Close(); }
protected void LinkButton1_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("select * from Tbl_Admin where AdminAd=@p1 and AdminSifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", txt_kullaniciAd.Text); komut.Parameters.AddWithValue("@p2", txt_sifre.Text); SqlDataReader dr = komut.ExecuteReader(); if (dr.Read()) { Response.Redirect("Admin.aspx"); } else { Response.Write("<script lang='JavaScript'>alert('Hatalı Kullanıcı Adı veya Şifre');</script>"); //Response.Redirect("AdminGiris.aspx"); txt_kullaniciAd.Text = ""; txt_sifre.Text = ""; txt_kullaniciAd.Focus(); } bgl.baglanti().Close(); }
protected void btn_teslimEt_Click(object sender, EventArgs e) { if (Session["Gun"] != null) { int sayi = Convert.ToInt32(Session["Gun"].ToString()); gun = System.DateTime.Now.AddDays(sayi); } else { gun = System.DateTime.Now; } Label4.Visible = true; ekleISBN = ISBN_Kontrol(); Label5.Visible = false; Label5.Text = ekleISBN; SqlCommand komut = new SqlCommand("select * from Tbl_Kitap,Tbl_KitapBilgileri,Tbl_Kullanici where Tbl_Kitap.KitapID=Tbl_KitapBilgileri.KitapID and Tbl_Kullanici.KullaniciID=@p1 and Tbl_KitapBilgileri.KitapISBN =@p2 and Tbl_KitapBilgileri.TeslimEdilmeDurumu=0", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", Session["ID"].ToString()); komut.Parameters.AddWithValue("@p2", Label5.Text.ToString()); SqlDataReader dr = komut.ExecuteReader(); if (dr.Read()) { SqlCommand komut2 = new SqlCommand("update Tbl_KitapBilgileri set TeslimEdilmeDurumu=1", bgl.baglanti()); komut2.ExecuteNonQuery(); SqlCommand komut3 = new SqlCommand("update Tbl_Kitap set TeslimTarihi=@u1", bgl.baglanti()); komut3.Parameters.AddWithValue("@u1", gun); komut3.ExecuteNonQuery(); Label4.Text = "Kitap teslim edilmiştir."; } else { Label4.Text = "Eklediğiniz ISBN ile üzerinizdeki kitap bilgileri uyuşmamaktadır."; } bgl.baglanti().Close(); }