NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;

namespace rgintro
{
public partial class kullanicibilgileriduzenle : Form
{
public kullanicibilgileriduzenle()
{
InitializeComponent();
}

public static OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=calisanlar.accdb");

public static void BaglantiAc()
{
try
{

calisan.Baglanti.Open();
}
catch (Exception Hata)
{
MessageBox.Show(Hata.Message, "BAĞLANTI AÇMA HATA PENCERESİ");

}


}

public void Kayitlistele()
{

try
{
BaglantiAc();
DataSet ds = new DataSet();
string sorguyonetici = "select * from kullanicilar"; //SQL sorgusu oluştur
string SorguKullanici = "select * from kullanicilar where Kadi='" + toolStripStatusLabel2.Text + "'";

if (kullanicigirisform.Kturu != "Yönetici")
sorguyonetici = SorguKullanici;

OleDbDataAdapter da = new OleDbDataAdapter(sorguyonetici, calisan.Baglanti);
da.Fill(ds, "kullanicilar");// DATASETİ DOLDUR
dataGridView1.DataSource = ds.Tables["kullanicilar"];//TABLOYU FORMDA GÖSTEr
calisan.Baglanti.Close();
}
catch (Exception Hata)
{

MessageBox.Show(Hata.Message, "KAYIT LİSTELEME HATA PENCERESİ");
}

}

public void SifreGuncelle()
{
try
{
calisan.BaglantiAc();
string Sorgu = "Update kullanicilar Set Sifre=@Sifre where id=@id";
OleDbCommand komut = new OleDbCommand(Sorgu, calisan.Baglanti);

komut.Parameters.AddWithValue("@Sifre", txtsifre.Text);
komut.Parameters.AddWithValue("@id", txtid.Text);

if (komut.ExecuteNonQuery() == 1)
MessageBox.Show(txtid.Text + " No Şifre Güncellendi");


calisan.Baglanti.Close();
}
catch (Exception Hata)
{

MessageBox.Show(Hata.Message, "Kayıt Güncelleme Hata Penceresi");
}
}
public void KullaniciSil()
{
try
{
calisan.BaglantiAc();
string Sorgu = "delete from kullanicilar where id=" + txtid.Text;
OleDbCommand komut = new OleDbCommand(Sorgu, calisan.Baglanti);
if (komut.ExecuteNonQuery() == 1) MessageBox.Show(txtid.Text + " Nolu Kullanıcı Silindi");
calisan.Baglanti.Close();

}
catch (Exception Hata)
{

MessageBox.Show(Hata.Message, "Kullanıcı Silme Hata Penceresi");
}

}
public bool BoslukKontrol()
{
txtkuladi.BackColor = Color.White;
txtsifre.BackColor = Color.White;
cmbtur.BackColor = Color.White;

if (txtkuladi.Text == "")
{
txtkuladi.BackColor = Color.Red;
txtkuladi.Focus();
return false;

}
else if (txtsifre.Text == "")
{
txtsifre.BackColor = Color.Red;
txtsifre.Focus();
return false;

}
else if (cmbtur.Text == "")
{
cmbtur.BackColor = Color.Red;
cmbtur.Focus();
return false;

}

return true;



}
public void Kullaniciekle()
{

try
{
calisan.BaglantiAc();
string Komut = "Insert Into kullanicilar(kadi,sifre,ktur) Values(@kadi,@sifre,@ktur)";
OleDbCommand EkleKomut = new OleDbCommand(Komut, calisan.Baglanti);
EkleKomut.Parameters.AddWithValue("@kadi", txtkuladi.Text);
EkleKomut.Parameters.AddWithValue("@sifre", txtsifre.Text);
EkleKomut.Parameters.AddWithValue("@ktur", cmbtur.Text);


if (EkleKomut.ExecuteNonQuery() == 1)
MessageBox.Show(txtkuladi.Text + " İsimli Kullanıcı Eklendi");

calisan.Baglanti.Close();

}
catch (Exception Hata)
{

MessageBox.Show(Hata.Message, "Kullanıcı Ekleme Hata Penceresi");

}
}


private void kullaniciislemform_Load(object sender, EventArgs e)
{


}

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{

}

private void dataGridView1_Click(object sender, EventArgs e)
{
txtid.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
txtkuladi.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
txtsifre.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
cmbtur.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
}

private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
txtid.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
txtkuladi.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
txtsifre.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
cmbtur.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();


}

private void toolStripStatusLabel2_Click(object sender, EventArgs e)
{

}

private void btnsifre_Click(object sender, EventArgs e)
{
if (txtsifre.Text != "")
SifreGuncelle();
else
{
txtsifre.BackColor = Color.Red;
txtsifre.Focus();
}
Kayitlistele();
}

private void btnsil_Click(object sender, EventArgs e)
{
DialogResult cevap;
cevap = MessageBox.Show("Kullanıcıyı silmek istiyor musunuz?", "Kullanıcı Sil", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (cevap == DialogResult.Yes)
{
KullaniciSil();

}
else if (cevap == DialogResult.No)
{
MessageBox.Show("Kullanıcı silinmedi");
}
Kayitlistele();

}

private void btnyeni_Click(object sender, EventArgs e)
{
bool varmi = false;
int i;
for (i = 0; i < dataGridView1.RowCount; i++)

if (dataGridView1.Rows[i].Cells[1].Value.ToString() == txtkuladi.Text)
varmi = true;

if (BoslukKontrol() == false)
{
MessageBox.Show("Boş Alanları Doldurunuz.");
}
else if (varmi == true)
MessageBox.Show(txtkuladi.Text + " İsimli Kayıt Zaten Var");
else
Kullaniciekle();
Kayitlistele();


}

private void kullanicibilgileriduzenle_Load(object sender, EventArgs e)
{

toolStripStatusLabel2.Text = kullanicigirisform.KullaniciAdi;
lblKturu.Text = kullanicigirisform.Kturu;
if (kullanicigirisform.Kturu != "Yönetici")
{
txtkuladi.Enabled = false;
cmbtur.Enabled = false;
btnyeni.Enabled = false;
btnsil.Enabled = false;
}
Kayitlistele();

}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void txtara_TextChanged(object sender, EventArgs e)
{
}

private void lblKturu_Click(object sender, EventArgs e)
{

}
}
}
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.