private void kayıtGüncelleToolStripMenuItem_Click_1(object sender, EventArgs e) { kayitekle kytekle = new kayitekle(); kytekle.Show(); baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand cmd = new SqlCommand("select ilçeadı from ilçeler", bgln.baglan()); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { kytekle.cbilçe.Items.Add(rd[0].ToString()); //rd[0] İLCEAD } bgln.baglan().Close(); kytekle.textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); kytekle.dtpzaman.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); kytekle.txtadsoyad.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); kytekle.cbkurum.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); kytekle.txttel.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); kytekle.txtsonuc.Text = dataGridView1.CurrentRow.Cells[15].Value.ToString(); kytekle.txtsikayet.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); kytekle.cbmah.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString(); kytekle.txtinceleme.Text = dataGridView1.CurrentRow.Cells[14].Value.ToString(); kytekle.txtilgili.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); kytekle.cbilçe.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString(); kytekle.txtic.Text = dataGridView1.CurrentRow.Cells[13].Value.ToString(); kytekle.txtdis.Text = dataGridView1.CurrentRow.Cells[12].Value.ToString(); kytekle.txtcadde.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString(); kytekle.txtaciklama.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); kytekle.txtapt.Text = dataGridView1.CurrentRow.Cells[11].Value.ToString(); }
public void displayrecords() { baglanti bgln = new baglanti(); bgln.baglan(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM kayitbilgileri", bgln.baglan()); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; }
private void cbilçe_SelectedIndexChanged(object sender, EventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand cmd = new SqlCommand("select ilçeid from ilçeler where ilçeadı='" + cbilçe.Text + "'", bgln.baglan()); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { label16.Text = dr[0].ToString(); } bgln.baglan().Close(); }
private void btnsfrdegistr_Click(object sender, EventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand cm = new SqlCommand(); cm.Connection = bgln.baglan(); cm.CommandText = "Update ornek SET SİFRE= '" + txtdegissifre.Text + "'Where ID='" + txtID.Text + "'"; cm.ExecuteNonQuery(); bgln.baglan().Close(); MessageBox.Show("Şifreniz başarıyla değiştirildi!"); this.Close(); }
private void cbmah_MouseUp(object sender, MouseEventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand cm = new SqlCommand("select mahadı from mahalle where ilçeid='" + label16.Text + "'", bgln.baglan()); SqlDataReader d = cm.ExecuteReader(); cbmah.Items.Clear(); while (d.Read()) { cbmah.Items.Add(d[0].ToString()); } bgln.baglan().Close(); }
private void btnara_Click(object sender, EventArgs e) { kayıtlistesi kytliste = new kayıtlistesi(); kytliste.Show(); baglanti bgln = new baglanti(); bgln.baglan(); if (checkkurum.Checked == true && checkad.Checked == true) { DataTable dt = new DataTable(); if (cbkurum.Text.Trim() == "" && txtad.Text.Trim() == "") { SqlDataAdapter da = new SqlDataAdapter("select * from kayitbilgileri", bgln.baglan()); da.Fill(dt); kytliste.dataGridView1.DataSource = dt; } else { SqlDataAdapter da = new SqlDataAdapter("select * from kayitbilgileri where ADSOYAD LIKE '%" + txtad.Text + "%' AND KURUM='" + cbkurum.Text + "'", bgln.baglan()); da.Fill(dt); kytliste.dataGridView1.DataSource = dt; } } else if (checkad.Checked == true) { DataTable dt = new DataTable(); if (txtad.Text.Trim() == "") { SqlDataAdapter da = new SqlDataAdapter("select * from kayitbilgileri", bgln.baglan()); da.Fill(dt); kytliste.dataGridView1.DataSource = dt; } else { SqlDataAdapter da = new SqlDataAdapter("select * from kayitbilgileri where ADSOYAD LIKE '%" + txtad.Text + "%'", bgln.baglan()); da.Fill(dt); kytliste.dataGridView1.DataSource = dt; } } else if (checkkurum.Checked == true) { DataTable dt = new DataTable(); if (cbkurum.Text.Trim() == "") { SqlDataAdapter da = new SqlDataAdapter("select * from kayitbilgileri", bgln.baglan()); da.Fill(dt); kytliste.dataGridView1.DataSource = dt; } else { SqlDataAdapter da = new SqlDataAdapter("select * from kayitbilgileri where KURUM LIKE '%" + cbkurum.Text + "%'", bgln.baglan()); da.Fill(dt); kytliste.dataGridView1.DataSource = dt; } } }
private void addrecords() { baglanti bgln = new baglanti(); bgln.baglan(); if (txtadsoyad.Text.Trim() == "" || cbkurum.Text.Trim() == "" || txttel.Text.Trim() == "" || txtsikayet.Text == "") { MessageBox.Show("Gerekli alanı doldurmadınız!"); } else { DialogResult dugmesec; dugmesec = MessageBox.Show(this, "Kaydetmek istediğinize eminmisiniz?", "Kayıt Ekle", MessageBoxButtons.YesNo); if (dugmesec == DialogResult.Yes) { DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM kayitbilgileri", bgln.baglan()); da.Fill(dt); DataRow r = dt.NewRow(); r[1] = dtpzaman.Value.ToString(); r[2] = txtadsoyad.Text; r[3] = cbkurum.Text; r[4] = txttel.Text; r[5] = txtsikayet.Text; r[6] = txtilgili.Text; r[7] = txtaciklama.Text; r[8] = cbilçe.Text; r[9] = cbmah.Text; r[10] = txtcadde.Text; r[11] = txtapt.Text; r[12] = txtdis.Text; r[13] = txtic.Text; r[14] = txtinceleme.Text; r[15] = txtsonuc.Text; dt.Rows.Add(r); SqlCommandBuilder cb = new SqlCommandBuilder(da); da.Update(dt); bgln.baglan().Close(); this.Close(); } } }
private void şifreDeğiştirToolStripMenuItem_Click(object sender, EventArgs e) { sifredegistir sfrdgstr = new sifredegistir(); sfrdgstr.Show(); baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand sorgu = new SqlCommand(); sorgu.Connection = bgln.baglan(); giris grs = new giris(); sorgu.CommandText = "SELECT AD from ornek where ID='" + lblKullaniciID + "'"; sfrdgstr.txtID.Text = lblKullaniciID.Text; }
private void kayıtEkleToolStripMenuItem_Click(object sender, EventArgs e) { kayitekle frmKayit = new kayitekle(); //mainformdan Kayıt ekleyi cagırdık frmKayit.MdiParent = this; frmKayit.Show(); baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand cmd = new SqlCommand("select ilçeadı from ilçeler", bgln.baglan()); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { frmKayit.cbilçe.Items.Add(rd[0].ToString()); //rd[0] İLCEAD } bgln.baglan().Close(); }
private void btnguncelle_Click(object sender, EventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); kayıtlistesi kytliste = new kayıtlistesi(); kytliste.Show(); SqlCommand kmt = new SqlCommand(); kmt.Connection = bgln.baglan(); kmt.CommandText = "Update kayitbilgileri SET ADSOYAD='" + txtadsoyad.Text + "', KURUM= '" + cbkurum.Text + "',TELEFON='" + txttel.Text + "',SIKAYET ='" + txtsikayet.Text + "',ILGILIBIRIM='" + txtilgili.Text + "',ACIKLAMA='" + txtaciklama.Text + "',ILCE='" + cbilçe.Text + "',MAHALLE='" + cbmah.Text + "',CADDE='" + txtcadde.Text + "',APARTMAN='" + txtapt.Text + "',DISKAPI='" + txtdis.Text + "',ICKAPI='" + txtic.Text + "',INCELEME='" + txtinceleme.Text + "',SONUC='" + txtsonuc.Text + "',TARİH='" + dtpzaman.Value + "'Where ID='" + textBox1.Text + "'"; kmt.ExecuteNonQuery(); kytliste.displayrecords(); bgln.baglan().Close(); }
private void btngiris_Click(object sender, EventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM ornek", bgln.baglan()); da.Fill(dt); DataRow r = dt.NewRow(); r[1] = txtkad.Text; r[2] = txtsifre.Text; dt.Rows.Add(r); SqlCommandBuilder cb = new SqlCommandBuilder(da); da.Update(dt); bgln.baglan().Close(); this.Close(); }
private void kayıtSilToolStripMenuItem_Click_1(object sender, EventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); DataTable dt = new DataTable(); DialogResult dugmesec; dugmesec = MessageBox.Show(this, "silmek istediğinize eminmisiniz?", "kayıt sil", MessageBoxButtons.YesNo); if (dugmesec == DialogResult.Yes) { SqlDataAdapter da = new SqlDataAdapter("delete from kayitbilgileri where ID =" + dataGridView1.CurrentRow.Cells[0].Value + "", bgln.baglan()); da.Fill(dt); SqlCommandBuilder cb = new SqlCommandBuilder(da); da.Update(dt); displayrecords(); bgln.baglan().Close(); } }
private void button1_Click(object sender, EventArgs e) { kayıtlistesi kytlistesi = new kayıtlistesi(); kytlistesi.Show(); baglanti bgln = new baglanti(); bgln.baglan(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("SELECT *FROM kayitbilgileri WHERE TARİH BETWEEN '" + dateTimePicker1.Value.ToString() + "' AND '" + dateTimePicker2.Value.ToString() + "'", bgln.baglan()); da.Fill(dt); kytlistesi.dataGridView1.DataSource = dt; }
private void btngiris_Click(object sender, EventArgs e) { baglanti bgln = new baglanti(); bgln.baglan(); SqlCommand cm = new SqlCommand("SELECT ID FROM ornek WHERE AD='" + txtkad.Text + "' and SİFRE='" + txtsifre.Text + "'", bgln.baglan()); SqlDataReader dr = cm.ExecuteReader(); if (dr.Read()) { MessageBox.Show("Giriş Başarılı"); txtkad.Clear(); txtsifre.Clear(); mainform mfrm = new mainform(); mfrm.lblKullaniciID.Text = dr[0].ToString(); mfrm.Show(); } else { MessageBox.Show("Giriş işlemi başarısız!"); } }