public void UyeEkle(yeniUye uye) { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlCommand komut = new SqlCommand(); komut.Connection = dbnesne.Baglanti; komut.CommandText = "INSERT INTO TST.kullEkle(kulAdi,kulSoyadi,kullanici,kulParola,kulTelefon,kulEposta,kulAdres) VALUES(@kulAdi,@kulSoyadi,@kullanici,@kulParola,@kulTelefon,@kulEposta,@kulAdres)"; komut.Parameters.Add("@kulAdi", SqlDbType.NVarChar); komut.Parameters["@kulAdi"].Value = uye.adi; komut.Parameters.Add("@kulSoyadi", SqlDbType.NVarChar); komut.Parameters["@kulSoyadi"].Value = uye.soyadi; komut.Parameters.Add("@kullanici", SqlDbType.NVarChar); komut.Parameters["@kullanici"].Value = uye.kullan; komut.Parameters.Add("@kulParola", SqlDbType.NVarChar); komut.Parameters["@kulParola"].Value = uye.parola; komut.Parameters.Add("@kulTelefon", SqlDbType.Int); komut.Parameters["@kulTelefon"].Value = uye.tel; komut.Parameters.Add("@kulEposta", SqlDbType.NVarChar); komut.Parameters["@kulEposta"].Value = uye.eposta; komut.Parameters.Add("@kulAdres", SqlDbType.NVarChar); komut.Parameters["@kulAdres"].Value = uye.adres; komut.ExecuteNonQuery(); SQLConn.DB.BaglantiKes(); }
public override void Sil() { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); int ürünId = (int)gridView2.GetDataRow(gridView2.FocusedRowHandle)["id"]; string ürünİsim = (string)gridView2.GetDataRow(gridView2.FocusedRowHandle)["ürünAdi"]; string SqlÜrünSil = string.Format("delete from TST.ürünler where id ={0}", ürünId); string UyariÜrünMsg = "" + ürünİsim + " adlı ürünü silmek istediğinize emin misiniz?"; DialogResult sonuc; sonuc = MessageBox.Show(UyariÜrünMsg, "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (sonuc == DialogResult.Yes) { dbnesne.SqlExecute(SqlÜrünSil); ürünListele(); } else { return; } dbnesne.BaglantiKes(); }
private void button1_Click(object sender, EventArgs e) { DBOperationsForSql dbnesne = new DBOperationsForSql(); // bağlantı için DataTable tblUser = new DataTable(); // tablo için oluşturuldu. string Pass = Md5Hash.MD5(txtPass.Text); // textboxa girilen parola verildi string UserSelect = string.Format("select * from TST.kullEkle where kullanici = '{0}' and kulParola = '{1}'" , txtUserName.Text // kullanıcı seçimi , Pass); dbnesne.DBOperationsForSqlServerFromAppConfig(true); // bağlantı için dbnesne.Baglan(); // bağlantı açıldı SqlCommand komut = new SqlCommand(UserSelect, dbnesne.Baglanti); // bağlantı ve kullanıcı stringi verildi. SqlDataReader dr = komut.ExecuteReader(); if (dr.Read()) // veritabanında okuma yapıldı { string user_name = dr["kullanici"].ToString(); string pass = dr["kulParola"].ToString(); mainMdiForm mainMdi = new mainMdiForm(); mainMdi.Show(); // bilgiler doğru ise anamenü açılır. this.Hide(); // bu form kapatılır. } else { MessageBox.Show("Login Bilgileri Hatalı!!!"); return; } }
public override void Sil() { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); int uyeId = (int)gridViewUye.GetDataRow(gridViewUye.FocusedRowHandle)["id"]; string uyeİsim = (string)gridViewUye.GetDataRow(gridViewUye.FocusedRowHandle)["kulAdi"]; string SqlUyeSil = string.Format("delete from TST.kullEkle where id ={0}", uyeId); string UyariMsg = "" + uyeİsim + " isimli üyeyi silmek istediğinize emin misiniz?"; DialogResult sonuc; sonuc = MessageBox.Show(UyariMsg, "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (sonuc == DialogResult.Yes) { dbnesne.SqlExecute(SqlUyeSil); uyeListele(); } else { return; } dbnesne.BaglantiKes(); }
private void navBarItem2_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { //Xrapor nsnRapor = new Xrapor(); //DataTable tablo = new DataTable(); //SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.musteriler", dbnesne.Baglanti); //dataAdap.Fill(tablo); //FrmMüsterilerListesi nsnMust = new FrmMüsterilerListesi(); //nsnRapor.DataSource = tablo; //nsnRapor.ShowPreviewMarginLines = true; //nsnRapor.CreateDocument(); //iTextSharp.text.Document raporPDF = new iTextSharp.text.Document(); ////Xrapor nsnRapor = new Xrapor(); //nsnRapor.rapor(); //nsnRapor.ShowPreviewMarginLines = true; //nsnRapor.CreateDocument(); DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); Xrapor rapor = new Xrapor(); DataTable tablo = new DataTable(); SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.musteriler", dbnesne.Baglanti); dataAdap.Fill(tablo); rapor.DataSource = tablo; //rapor.ShowPreview(); }
public void ürünListele() { DataTable tablo = new DataTable(); DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.ürünler", dbnesne.Baglanti); dataAdap.Fill(tablo); gridÜrünList.DataSource = tablo; }
private void kayıtSırasınaGöreToolStripMenuItem_Click(object sender, EventArgs e) { DataTable tablo = new DataTable(); DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.kullEkle ORDER BY id", dbnesne.Baglanti); dataAdap.Fill(tablo); gridList.DataSource = tablo; }
private void üyeSayısıToolStripMenuItem_Click(object sender, EventArgs e) { DataTable tablo = new DataTable(); DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.kullEkle", dbnesne.Baglanti); dataAdap.Fill(tablo); lblSayi.Text = tablo.Rows.Count.ToString(); lblText.Visible = true; }
private void FrmMüsterilerListesi_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; DataTable tablo = new DataTable(); DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.musteriler", dbnesne.Baglanti); dataAdap.Fill(tablo); gridMusteri.DataSource = tablo; }
private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DataTable tablo = new DataTable(); DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlDataAdapter dataAdap = new SqlDataAdapter("SELECT * FROM TST.ürünler", dbnesne.Baglanti); dataAdap.Fill(tablo); lblTopÜrün.Text = tablo.Rows.Count.ToString(); lblÜrünTxt.Visible = true; lblTopÜrün.Visible = true; }
public void ürünEkle(yeniÜrün ürün) { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); string ürünEkle = "INSERT INTO TST.ürünler(ürünAdi,ürünKodu,marka,adet,fiyat) VALUES ('" + ürün.adi + "','" + ürün.kod + "','" + ürün.marka + "','" + ürün.adet + "','" + ürün.fiyat + "')"; SqlCommand komut = new SqlCommand(ürünEkle, dbnesne.Baglanti); komut.Connection = dbnesne.Baglanti; komut.CommandText = ürünEkle; komut.ExecuteNonQuery(); }
private void button1_Click(object sender, EventArgs e) { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); SqlCommand komut = new SqlCommand(); komut.Connection = dbnesne.Baglanti; komut.CommandText = "select * from TST.musteriler"; komut.ExecuteNonQuery(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(komut); da.Fill(ds); }
private void btnAra_Click_1(object sender, EventArgs e) { gridMusteri.Visible = true; DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); string UserSelect = string.Format("select * from TST.musteriler where adi = '{0}' and soyadi = '{1}'" , txtMustAdi.Text , txtMustSoy.Text); DataTable tblMusteri = new DataTable(); SqlDataAdapter dataAdap = new SqlDataAdapter(UserSelect, dbnesne.Baglanti); dataAdap.Fill(tblMusteri); gridMusteri.DataSource = tblMusteri; }
public override void Kaydet() { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); ürünler.yeniÜrün nsnÜrün = new ürünler.yeniÜrün(); nsnÜrün.adi = gridView1.GetFocusedRowCellValue("ürünAdi").ToString(); nsnÜrün.kod = gridView1.GetFocusedRowCellValue("ürünKodu").ToString(); nsnÜrün.marka = gridView1.GetFocusedRowCellValue("marka").ToString(); nsnÜrün.adet = gridView1.GetFocusedRowCellValue("adet").ToString(); nsnÜrün.fiyat = gridView1.GetFocusedRowCellValue("fiyat").ToString(); MessageBox.Show("Ürün Eklendi"); ürünler ürün = new ürünler(); ürün.ürünEkle(nsnÜrün); }
private void btnKayd_Click(object sender, EventArgs e) { DBOperationsForSql dbnesne = new DBOperationsForSql(); dbnesne.DBOperationsForSqlServerFromAppConfig(true); dbnesne.Baglan(); if (!string.IsNullOrEmpty(txtAdi.Text) && !string.IsNullOrEmpty(txtKulSoy.Text) && !string.IsNullOrEmpty(txtKulAdi.Text) && !string.IsNullOrEmpty(txtKulPar.Text) && !string.IsNullOrEmpty(txtKulTel.Text)) { Uyeler.yeniUye uye = new Uyeler.yeniUye(); uye.adi = txtAdi.Text; uye.soyadi = txtKulSoy.Text; uye.kullan = txtKulAdi.Text; uye.parola = Md5Hash.MD5(txtKulPar.Text); uye.tel = txtKulTel.Text; uye.eposta = txtKulEpos.Text; uye.adres = txtKulAdr.Text; try { Uyeler nsnUye = new Uyeler(); nsnUye.UyeEkle(uye); } catch (Exception ex) { string Mesaj = "Hata Oluştu :" + ex.Message; } lblMesaj.Visible = true; } else { MessageBox.Show("Lütfen Gerekli Alanları Doldurunuz!"); } }