FORM ANA SAYFA
[code lang=”csharp”]
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 Okul_Ziyaretçi_Takip
{
public partial class Form1 : Form
{
public Ekle FrmEkle;
public Ara FrmAra;
public Güncelle frmGuncelle;
public Form1()
{
InitializeComponent();
FrmEkle=new Ekle();
FrmAra=new Ara();
frmGuncelle=new Güncelle();
FrmEkle.frmAnaSayfa = this;
FrmAra.frmAnaSayfa = this;
frmGuncelle.frmAnaSayfa = this;
}
OleDbConnection baglantı = new OleDbConnection("Provider=Microsoft.Ace.OleDb.12.0;Data Source=data.accdb");
void bag()
{
DataTable tablo = new DataTable();
OleDbDataAdapter adaptör = new OleDbDataAdapter("Select * From okul", baglantı);
adaptör.Fill(tablo);
dataGridView1.DataSource = tablo;
}
private void Form1_Load(object sender, EventArgs e)
{
bag();
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Columns[0].HeaderText = "TC Kimlik No";
dataGridView1.Columns[4].HeaderText = "Giriş Saati";
dataGridView1.Columns[5].HeaderText = "Çıkış Saati";
dataGridView1.Columns[6].HeaderText = "Kimi Ziyaret Etti";
}
private void btnEkle_Click(object sender, EventArgs e)
{
FrmEkle.ShowDialog();
}
private void btnGüncelle_Click(object sender, EventArgs e)
{
frmGuncelle.ShowDialog();
}
private void btnAra_Click(object sender, EventArgs e)
{
this.Hide();
FrmAra.Show();
}
private void btnCıkıs_Click(object sender, EventArgs e)
{
DialogResult soru;
soru = MessageBox.Show("Program Kapatılsınmı","Çıkış",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (soru == DialogResult.Yes) Application.Exit();
}
private void btnSil_Click(object sender, EventArgs e)
{
DialogResult Soru;
Soru = MessageBox.Show("Ziyaretçi Silinsinmi","Soru",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (Soru == DialogResult.Yes)
{
OleDbCommand komut = new OleDbCommand();
baglantı.Open();
komut.Connection = baglantı;
komut.CommandText = "DELETE FROM okul Where TcKimlikNo=’" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "’";
komut.ExecuteNonQuery();
baglantı.Close();
bag();
}
}
}
}
[/code]
FORM KİŞİ EKLEME
[code lang=”csharp”]
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 Okul_Ziyaretçi_Takip
{
public partial class Ekle : Form
{
public Form1 frmAnaSayfa;
public Ekle()
{
InitializeComponent();
}
OleDbConnection baglantı = new OleDbConnection("Provider=Microsoft.Ace.OleDb.12.0;Data Source=data.accdb");
OleDbCommand komut = new OleDbCommand();
void bag()
{
DataTable tablo = new DataTable();
OleDbDataAdapter adaptör = new OleDbDataAdapter("Select * From okul", baglantı);
adaptör.Fill(tablo);
frmAnaSayfa.dataGridView1.DataSource = tablo;
}
private void btnAnaSayfa_Click(object sender, EventArgs e)
{
this.Hide();
}
private void btnEkle_Click(object sender, EventArgs e)
{
if (txtAdı.Text == "" || txtCıkısSaati.Text == "" || txtGirisSaati.Text == ""
|| txtKimiZiyaretEtti.Text == "" || txtSoyadı.Text == ""
|| txtTcKimlik.Text == "" || txtTelefon.Text == "")
{
MessageBox.Show("Lütfen Boş Yerleri Doldurunuz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
baglantı.Open();
komut.Connection = baglantı;
komut.CommandText = "INSERT INTO okul(TcKimlikNo,Adı,Soyadı,Tarih,GirisSaati,CıkısSaati,KimiZiyaretEtti,Telefon)Values(‘" + txtTcKimlik.Text + "’,’" + txtAdı.Text + "’,’" + txtSoyadı.Text + "’,’" + dateTimePicker1.Text + "’,’" + txtGirisSaati.Text + "’,’" + txtCıkısSaati.Text + "’,’" + txtKimiZiyaretEtti.Text + "’,’" + txtTelefon.Text + "’)";
komut.ExecuteNonQuery();
baglantı.Close();
MessageBox.Show("Yeni Ziyaretçi Eklendi", "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtAdı.Clear();
txtCıkısSaati.Clear();
txtGirisSaati.Clear();
txtKimiZiyaretEtti.Clear();
txtSoyadı.Clear();
txtTcKimlik.Clear();
txtTelefon.Clear();
bag();
}
}
}
}
[/code]
FORM KİŞİ GÜNCELLE
[code lang=”csharp”]
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 Okul_Ziyaretçi_Takip
{
public partial class Güncelle : Form
{
public Form1 frmAnaSayfa;
public Güncelle()
{
InitializeComponent();
}
OleDbConnection baglantı = new OleDbConnection("Provider=Microsoft.Ace.OleDb.12.0;Data Source=data.accdb");
private void btnAnaSayfa_Click(object sender, EventArgs e)
{
this.Hide();
}
void bag()
{
DataTable tablo = new DataTable();
OleDbDataAdapter adaptör = new OleDbDataAdapter("Select * From okul", baglantı);
adaptör.Fill(tablo);
frmAnaSayfa.dataGridView1.DataSource = tablo;
}
private void Güncelle_Load(object sender, EventArgs e)
{
txtTcKimlik.Text = frmAnaSayfa.dataGridView1.CurrentRow.Cells[0].Value.ToString();
txtAdı.Text=frmAnaSayfa.dataGridView1.CurrentRow.Cells[1].Value.ToString();
txtSoyadı.Text=frmAnaSayfa.dataGridView1.CurrentRow.Cells[2].Value.ToString();
dateTimePicker1.Text = frmAnaSayfa.dataGridView1.CurrentRow.Cells[3].Value.ToString();
txtGirisSaati.Text = frmAnaSayfa.dataGridView1.CurrentRow.Cells[4].Value.ToString();
txtCıkısSaati.Text = frmAnaSayfa.dataGridView1.CurrentRow.Cells[5].Value.ToString();
txtKimiZiyaretEtti.Text = frmAnaSayfa.dataGridView1.CurrentRow.Cells[6].Value.ToString();
txtTelefon.Text = frmAnaSayfa.dataGridView1.CurrentRow.Cells[7].Value.ToString();
}
private void btnGüncelle_Click(object sender, EventArgs e)
{
DialogResult soru;
soru = MessageBox.Show("Ziyaretçi Güncelleniyor","Mesaj",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
if (soru == DialogResult.OK)
{
OleDbCommand komut = new OleDbCommand();
baglantı.Open();
komut.Connection = baglantı;
komut.CommandText = "Update okul Set TcKimlikNo=’" + txtTcKimlik.Text + "’,Adı=’" + txtAdı.Text + "’,Soyadı=’" + txtSoyadı.Text + "’,Tarih=’" + dateTimePicker1.Text + "’,GirisSaati=’" + txtGirisSaati.Text + "’,CıkısSaati=’" + txtCıkısSaati.Text + "’,KimiZiyaretEtti=’" + txtKimiZiyaretEtti.Text + "’,Telefon=’" + txtTelefon.Text + "’ Where TcKimlikNo=’" + frmAnaSayfa.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "’";
komut.ExecuteNonQuery();
baglantı.Close();
bag();
MessageBox.Show("Ziyaretçi Güncelleştirildi", "Güncel", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
FORM KİŞİ ARA
[code lang="csharp"]
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 Okul_Ziyaretçi_Takip
{
public partial class Ara : Form
{
public Form1 frmAnaSayfa;
public Ara()
{
InitializeComponent();
}
OleDbConnection baglantı = new OleDbConnection("Provider=Microsoft.Ace.OleDb.12.0;Data Source=data.accdb");
private void btnAra_Click(object sender, EventArgs e)
{
DataTable tablo = new DataTable();
OleDbDataAdapter adaptör = new OleDbDataAdapter("Select * From okul where Adı=’" + textBox1.Text + "’", baglantı);
adaptör.Fill(tablo);
dataGridView1.DataSource = tablo;
}
private void btnAnaSayfa_Click(object sender, EventArgs e)
{
this.Hide();
frmAnaSayfa.Show();
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
DataTable tablo = new DataTable();
OleDbDataAdapter adaptör = new OleDbDataAdapter("Select * From okul where Adı Like ‘%" + textBox2.Text + "%’", baglantı);
adaptör.Fill(tablo);
dataGridView1.DataSource = tablo;
}
}
}
[/code]




Öncelikle elinize sağlık 🙂 öyle açıp bakmadım ama kişi silme kodlarıda içerisinde yer alıyor mu ?
Mustafa Ceylan:
Evet kişi silme var.
Selam. Arkadaşlar günlük sıra numarası satan ve gün bitiminde satılan numarasayını günlük olarak kayıt eden, kayıtları tarihe göre reporlayan bir proje yapmakda yardımcı ola bilirmisiniz?
Taleh Akifoglu:
Projeler için gorselprogram@gmail.com adresine mail atınız.
emeginize saglık odev ıcın cok ısıme yaradı gercekten cok tşk ederim