C# Emlak Takip Programı

C# Emlak Takip Programı

</pre>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace WindowsFormsApplication1
{
 public partial class Form1 : Form
 {
 public Form1()
 {
 InitializeComponent();
 }

private void button4_Click(object sender, EventArgs e)
 {
 Form3 frm = new Form3();
 frm.Show();
 }

private void Form1_Load(object sender, EventArgs e)
 {

}

private void button2_Click(object sender, EventArgs e)
 {
 Form2 frm = new Form2();
 frm.Show();
 }

 }
}
<pre>

Form2 (Emlak Ekle)

</pre>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace WindowsFormsApplication1
{
 public partial class Form2 : Form
 {
 public Form2()
 {
 InitializeComponent();
 }
 OleDbConnection baglan = new OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source= emlak.accdb");
 void temizle()
 {
 textBox1.Clear();
 textBox2.Clear();
 textBox3.Clear();
 textBox4.Clear();
 textBox5.Clear();
 textBox6.Clear();
 //WHERE (durum like '%satılık%'and durum like '%kiralık%')
 }
 void goster()
{
 OleDbDataAdapter getir = new OleDbDataAdapter("SELECT * FROM emlak", baglan);
 baglan.Open();
DataSet goster = new DataSet();
getir.Fill(goster, "emlak");
 dataGridView1.DataSource = goster.Tables["emlak"];
getir.Dispose();
 baglan.Close();
}

private void Form2_Load(object sender, EventArgs e)
 {
 label11.Hide();
 label12.Hide();
 label13.Hide();
 label14.Hide();
 label15.Hide();
 label16.Hide();
 label17.Hide();
 label18.Hide();
 label19.Hide();
 label20.Hide();
 label21.Hide();

 label9.Hide();
 textBox6.Hide();

 goster();
 /* */
 }

private void label2_Click(object sender, EventArgs e)
 {

}

int a=0;
 private void button1_Click(object sender, EventArgs e)
 {
 label21.Visible = false;
 label20.Visible = false;
 label19.Visible = false;
 label18.Visible = false;
 label17.Visible = false;
 label16.Visible = false;
 label15.Visible = false;
 label14.Visible = false;
 label13.Visible = false;
 label12.Visible = false;
 if (pictureBox1.ImageLocation == null){label21.Visible = true; a++;}
 if (textBox5.Text == "") { label20.Visible = true;a++; }
 if (comboBox2.Text == "") { label19.Visible = true;a++; }
 if (textBox4.Text == "") { label18.Visible = true;a++; }
 if (textBox3.Text == "") { label17.Visible = true; a++;}
 if (comboBox4.Text == "") { label16.Visible = true; a++;}
 if (comboBox3.Text == "") { label15.Visible = true; a++;}
 if (textBox2.Text == "") { label14.Visible = true; a++;}
 if (textBox1.Text == "") { label13.Visible = true; a++;}
 if (comboBox1.Text == "") { label12.Visible = true; a++;}

 else if (a==0)
 {
 baglan.Open();
 OleDbCommand kaydet = new OleDbCommand("INSERT INTO emlak([tür],[madsoyad],[adres],[tel],[fiyat],[durum],[not],[resim])Values(@tür,@madsoyad,@adres,@tel,@fiyat,@durum,@not,@resim)", baglan);

kaydet.Parameters.AddWithValue("@tür", comboBox1.Text);
 kaydet.Parameters.AddWithValue("@madsoyad", textBox1.Text);
 kaydet.Parameters.AddWithValue("@adres", comboBox3.Text + " " + comboBox4.Text + " " + textBox2.Text);
 kaydet.Parameters.AddWithValue("@tel", textBox3.Text);
 kaydet.Parameters.AddWithValue("@fiyat", textBox4.Text);
 kaydet.Parameters.AddWithValue("@durum", comboBox2.Text);
 kaydet.Parameters.AddWithValue("@not", textBox5.Text);

kaydet.Parameters.AddWithValue("@resim", pictureBox1.ImageLocation);
 pictureBox1.Image.Save("Resimler/" + textBox3.Text.ToString() + ".jpg");

kaydet.ExecuteNonQuery();
 baglan.Close();
 MessageBox.Show("Kayıt Başarıyla Gerçekleşti");
 goster();
 temizle();

 }
 a = 0;

}

private void button2_Click(object sender, EventArgs e)
 {
 baglan.Open();
 OleDbCommand sil = new OleDbCommand("delete From emlak Where [emlakno]=@emlakno", baglan);
 sil.Parameters.AddWithValue("@emlakno", textBox6.Text);
 sil.ExecuteNonQuery();
 MessageBox.Show("Kayıt Silindi");
 baglan.Close();
 goster();
 temizle();

}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {

}

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
 comboBox4.Enabled = false;
 comboBox3.Enabled = false;
 int stırno = dataGridView1.SelectedCells[0].RowIndex;
 textBox6.Text = dataGridView1.Rows[stırno].Cells[0].Value.ToString();
 comboBox1.Text = dataGridView1.Rows[stırno].Cells[1].Value.ToString();
 textBox1.Text = dataGridView1.Rows[stırno].Cells[2].Value.ToString();
 textBox2.Text = dataGridView1.Rows[stırno].Cells[3].Value.ToString();
 textBox3.Text = dataGridView1.Rows[stırno].Cells[4].Value.ToString();
 textBox4.Text = dataGridView1.Rows[stırno].Cells[5].Value.ToString();
 comboBox2.Text = dataGridView1.Rows[stırno].Cells[6].Value.ToString();
 textBox5.Text = dataGridView1.Rows[stırno].Cells[7].Value.ToString();
 pictureBox1.ImageLocation = "Resimler/" + dataGridView1.Rows[stırno].Cells[4].Value.ToString() + ".jpg";
 }

private void pictureBox1_Click(object sender, EventArgs e)
 {

}

private void button4_Click(object sender, EventArgs e)
 {

 if (openFileDialog1.ShowDialog() == DialogResult.OK)
 {
 pictureBox1.ImageLocation = openFileDialog1.FileName;
 }
 }

private void button3_Click(object sender, EventArgs e)
 {
 baglan.Open();
 OleDbCommand guncelle = new OleDbCommand("UPDATE emlak SET [emlakno]=@emlakno,[tür]=@tür,[madsoyad]=@madsoyad,[adres]=@adres,[tel]=@tel,[fiyat]=@fiyat,[durum]=@durum,[not]=@not,[resim]=@resim WHERE [emlakno]=@emlakno", baglan);
 guncelle.Parameters.AddWithValue("@emlakno", textBox6.Text);
 guncelle.Parameters.AddWithValue("@tür", comboBox1.Text);
 guncelle.Parameters.AddWithValue("@madsoyad", textBox1.Text);
 guncelle.Parameters.AddWithValue("@adres", textBox2.Text);
 guncelle.Parameters.AddWithValue("@tel", textBox3.Text);
 guncelle.Parameters.AddWithValue("@fiyat", textBox4.Text);
 guncelle.Parameters.AddWithValue("@durum", comboBox2.Text);
 guncelle.Parameters.AddWithValue("@not", textBox5.Text);
 guncelle.Parameters.AddWithValue("@resim", pictureBox1.ImageLocation);
 pictureBox1.Image.Save("Resimler/" + textBox3.Text.ToString() + ".jpg");
 guncelle.ExecuteNonQuery();
 MessageBox.Show("Kayıt Güncellendi");
 baglan.Close();
 goster();
 temizle();
 }

&nbsp;

private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
 {

 }

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {
 comboBox4.Items.Clear();
 if (comboBox3.Text == "Konya")
 {

 comboBox4.Items.Add("meram");
 comboBox4.Items.Add("selçuklu");
 comboBox4.Items.Add("çumra");
 comboBox4.Items.Add("karatay");
 comboBox4.Items.Add("bozkır");
 comboBox4.Items.Add("hadim");

}
 else if (comboBox3.Text == "Adana")
 {

 comboBox4.Items.Add("seyhan");
 comboBox4.Items.Add("ceyhan");
 comboBox4.Items.Add("kozan");
 comboBox4.Items.Add("karataş");
 comboBox4.Items.Add("sarıçam");
 comboBox4.Items.Add("tufanbeyli");

}
 else if (comboBox3.Text == "Ankara")
 {

 comboBox4.Items.Add("akyurt");
 comboBox4.Items.Add("altındağ");
 comboBox4.Items.Add("bala");
 comboBox4.Items.Add("çubuk");
 comboBox4.Items.Add("polatlı");
 comboBox4.Items.Add("mamak");

}
 }

&nbsp;

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

private void textBox6_TextChanged(object sender, EventArgs e)
 {

}

private void button5_Click_1(object sender, EventArgs e)
 {
 comboBox1.Enabled = true;
 comboBox2.Enabled = true;
 comboBox3.Enabled = true;
 comboBox4.Enabled = true;
 pictureBox1.ImageLocation = null;
 temizle();

 }
 }
}
<pre>

Form3(Emlak)

</pre>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace WindowsFormsApplication1
{
 public partial class Form3 : Form
 {
 public Form3()
 {
 InitializeComponent();
 }
 OleDbConnection baglan = new OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source= emlak.accdb");
 OleDbConnection baglan1 = new OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source= il.accdb");
 private void Form3_Load(object sender, EventArgs e)
 {
 groupBox1.Visible = false;
 groupBox5.Visible = false;
 groupBox6.Visible = false;
 }
 int a1 ;
 void verigetir()
 {
 OleDbCommand veri = new OleDbCommand("SELECT * FROM sehir", baglan1);
 OleDbDataReader oku1;
 baglan1.Open();
 oku1 = veri.ExecuteReader();

 while (oku1.Read())
 {

 if (comboBox3.Text==oku1[2].ToString())
 {

 a1 = int.Parse(oku1[0].ToString());

 verigetir2();
 }
 }
 oku1.Close();
 baglan1.Close();
 }
 int a2;
 int a3;
 void verigetir2()
 {
 OleDbCommand veri = new OleDbCommand("SELECT * FROM ilceler", baglan1);
 OleDbDataReader oku2;
 //baglan1.Open();
 oku2 = veri.ExecuteReader();

 while (oku2.Read())
 {
 int r=int.Parse(oku2[1].ToString());
 if (a1 == r)
 {
 comboBox4.Items.Add(oku2[2].ToString());
 a3 = int.Parse(oku2[0].ToString());

 }
 }
 oku2.Close();
 //baglan1.Close();
 }
 /* void verigetir3()
 {
 OleDbCommand veri = new OleDbCommand("SELECT * FROM mahalleler", baglan1);
 OleDbDataReader oku3;

 oku3 = veri.ExecuteReader();
 while (oku3.Read())
 {
 int r1 = int.Parse(oku3[1].ToString());
 if (a3 == r1)
 {
 comboBox1.Items.Add(oku3[3].ToString());
 }
 }
 oku3.Close();

 }*/
 void verigetir3()
 {
 OleDbCommand veri = new OleDbCommand("SELECT * FROM ilceler", baglan1);
 OleDbDataReader oku1;
 baglan1.Open();
 oku1 = veri.ExecuteReader();

while (oku1.Read())
 {

if (comboBox4.Text == oku1[2].ToString())
 {

a1 = int.Parse(oku1[0].ToString());
 }
 }
 oku1.Close();
 baglan1.Close();
 }

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
 groupBox1.Visible = true;
 int stırno = dataGridView1.SelectedCells[0].RowIndex;
 label3.Text = dataGridView1.Rows[stırno].Cells[1].Value.ToString();
 label11.Text = dataGridView1.Rows[stırno].Cells[2].Value.ToString();
 label12.Text = dataGridView1.Rows[stırno].Cells[3].Value.ToString();
 label14.Text = dataGridView1.Rows[stırno].Cells[4].Value.ToString();
 label15.Text = dataGridView1.Rows[stırno].Cells[5].Value.ToString();
 label16.Text = dataGridView1.Rows[stırno].Cells[6].Value.ToString();
 label17.Text = dataGridView1.Rows[stırno].Cells[7].Value.ToString();
 label21.Text = dataGridView1.Rows[stırno].Cells[0].Value.ToString();

 pictureBox1.ImageLocation = "Resimler/" + dataGridView1.Rows[stırno].Cells[4].Value.ToString() + ".jpg";
 }
 /* void ürüngetir()
 {
 string baglantı, sorgu;
 baglantı = "provider=Microsoft.ACE.OLEDB.12.0;data source=emlak.accdb";
 sorgu = "SELECT * FROM emlak";
 OleDbConnection yeni = new OleDbConnection(baglantı);
 OleDbCommand veri = new OleDbCommand(sorgu, yeni);
 OleDbDataReader oku;
 yeni.Open();
 oku = veri.ExecuteReader();
 while (oku.Read())
 {

if (oku[6].ToString() == "kiralık")
 {
 if (oku[1].ToString() == "ev")
 {

}

 }
 }
 oku.Close();
 yeni.Close();
 }*/
 string se, lç;
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {

 se = comboBox3.Text;
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(adres like'%" + comboBox3.Text + "%')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 comboBox4.Items.Clear();
 verigetir();
 /*if (comboBox3.Text == "Konya")
 {

comboBox4.Items.Add("meram");
 comboBox4.Items.Add("selçuklu");
 comboBox4.Items.Add("çumra");
 comboBox4.Items.Add("karatay");
 comboBox4.Items.Add("bozkır");
 comboBox4.Items.Add("hadim");

}
 else if (comboBox3.Text == "Adana")
 {

comboBox4.Items.Add("seyhan");
 comboBox4.Items.Add("ceyhan");
 comboBox4.Items.Add("kozan");
 comboBox4.Items.Add("karataş");
 comboBox4.Items.Add("sarıçam");
 comboBox4.Items.Add("tufanbeyli");

}
 else if (comboBox3.Text == "Ankara")
 {

comboBox4.Items.Add("akyurt");
 comboBox4.Items.Add("altındağ");
 comboBox4.Items.Add("bala");
 comboBox4.Items.Add("çubuk");
 comboBox4.Items.Add("polatlı");
 comboBox4.Items.Add("mamak");

}*/
 }

private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
 {

 lç = comboBox4.Text;
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(adres like'%" + comboBox3.Text +" "+ comboBox4.Text + "%')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 groupBox5.Visible = true;
 verigetir();
 verigetir3();
}

private void checkBox4_CheckedChanged(object sender, EventArgs e)
{

if (checkBox1.Checked)
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(adres like '%" + se + "%' and adres like '%" + lç + "%' and tür like'%arsa%'and durum like '%satılık%')";
 DataSet goster = new DataSet();

getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 }
 if (checkBox2.Checked)
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(tür like'%arsa%'and adres like '%" + se + "%' and adres like '%" + lç + "%' and durum like '%kiralık%')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 }
 }

private void checkBox3_CheckedChanged(object sender, EventArgs e)
 {
 if(checkBox1.Checked)
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(tür like'%ev%'and adres like '%" + se + "%' and adres like '%" + lç + "%' and durum like '%satılık%')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 }
 if (checkBox2.Checked)
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(tür like'%ev%'and adres like '%" + se + "%' and adres like '%" + lç +" %')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 }

}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(durum like'%satılık%' and adres like '%" + se + "%' and adres like '%" + lç + "%')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 groupBox6.Visible = true;
 }

private void checkBox2_CheckedChanged(object sender, EventArgs e)
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak" + " where(durum like'%kiralık%' and adres like '%" + se + "%' and adres like '%" + lç + "%')";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 groupBox6.Visible = true;
 }

private void textBox1_TextChanged(object sender, EventArgs e)
 {

 }

private void button1_Click(object sender, EventArgs e)
 {
 int a, b;
 a = int.Parse(textBox1.Text);
 b = int.Parse(textBox2.Text);
 OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak", baglan);
 baglan.Open();
 getir.SelectCommand.CommandText = "Select * From emlak where fiyat between '" + a + "' and '" + b + "' ";
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 goster.Tables["emlak"].Clear();
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Fill(goster, "emlak");
 baglan.Close();
 /*OleDbDataAdapter getir = new OleDbDataAdapter("Select * From emlak where fiyat between '" + a + "' and '" + b + "' ", baglan);
 baglan.Open();
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Dispose();
 baglan.Close(); */
 }

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {

}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {

 }
 void goster()
 {
 OleDbDataAdapter getir = new OleDbDataAdapter("SELECT * FROM emlak", baglan);
 baglan.Open();
 DataSet goster = new DataSet();
 getir.Fill(goster, "emlak");
 dataGridView1.DataSource = goster.Tables["emlak"];
 getir.Dispose();
 baglan.Close();
 }
 private void button2_Click(object sender, EventArgs e)
 {
 int stırno = dataGridView1.SelectedCells[0].RowIndex;
 string d ;
 d = dataGridView1.Rows[stırno].Cells[6].Value.ToString();

if (d == "satıldı")
 {
 MessageBox.Show("emlak satıldı lütfen başka emlaklara bakın");
 }
 else
 {
 baglan.Open();
 OleDbCommand guncelle = new OleDbCommand("UPDATE emlak SET [adres]=@adres,[durum]=@durum WHERE [adres]=@adres", baglan);

guncelle.Parameters.AddWithValue("@adres", label12.Text);
 guncelle.Parameters.AddWithValue("@durum", "satıldı");
 guncelle.ExecuteNonQuery();
 MessageBox.Show("Kayıt Güncellendi");
 baglan.Close();
 goster();
 }
 }
 }
}
<pre>

1.220 defa okundu.

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Powered by WordPress | Designed by: credit repair | Thanks to st louis web design, essay writing and fire glass
c# örnekleri , csharp örnekleri , c# örnek , C# Örnekleri , örnekleri c# , C# ÖRNEKLERİ
BTT Sınavları

C# Uygulamaları

Müdür Yardımcılığı Sınavına Hazırlık Sayfası

Müdür Yardımcılığı Çalışma Notları

C# Uygulamaları

Yazılı Soruları Php Dersleri Bilişim Teknolojileri Alanı Yazılı Soruları C# Dersleri C# Örnekleri