Beispiel #1
0
        private void Sehirler_ekran_Load(object sender, EventArgs e)
        {
            btn_ilce_guncelle.Hide();
            btn_il_guncelle.Hide();


            if (kisayol.yetkim == 1)
            {
                btn_ilce_guncelle.Show();
                btn_il_guncelle.Show();

                String iller = "Select il_ID,ilAdi from Iller_Tablosu Order by ilAdi ";
                combobox_veriler(combo_iller, iller, "il_ID", "ilAdi", il_ID, ilad);
            }
            if (kisayol.yetkim == 2)
            {
                TabControl_ILilce.TabPages.Remove(tab_il);
                this.Text = "İlçe Kaydı";

                String ilce_Sorgu = "Select ilce.ilceAdi from Iller_Tablosu as il JOIN Ilceler_Tablosu as ilce on il.il_ID = ilce.il_id Where il.il_ID = '" + kisayol.Il_Id + "'";
                kisayol.Veritabani_Combobox_Veri(comboBox_ilce, ilce_Sorgu, "ilceAdi");
            }
            else if (kisayol.yetkim == 3)
            {
                TabControl_ILilce.TabPages.Remove(tab_il);
                this.Text = "İlçe Kaydı";
                String ilce_Sorgu = "Select ilce.ilceAdi from Iller_Tablosu as il JOIN Ilceler_Tablosu as ilce on il.il_ID = ilce.il_id Where il.il_ID = '" + kisayol.Il_Id + "'";
                kisayol.Veritabani_Combobox_Veri(comboBox_ilce, ilce_Sorgu, "ilceAdi");
            }
            else
            {
                Sehirler_ekran sehirler = new Sehirler_ekran(kisayol.yetkim, kisayol.Gorevli_ID, kisayol.Il_Id, kisayol.ilce_ID);
                sehirler.Hide();
            }
        }
        private void btn_semtEkle_Click(object sender, EventArgs e)
        {
            btn_semtEkle.TabIndex = 3;
            Sehirler_ekran sehir = new Sehirler_ekran(kisayol.yetkim, kisayol.Gorevli_ID, kisayol.Il_Id, kisayol.ilce_ID);

            if (kisayol.yetkim == 1)
            {
                int ilce_idsi;
                if (txt_semt_ismi.Text == String.Empty)
                {
                    kisayol.mesajBox_Basit("(*) Yildizli Alanlari Bos birakmayiniz.");
                }
                else
                {
                    String     sorgu1      = "select ilce_ID,ilceAdi from Ilceler_Tablosu where ilceAdi ='" + combo_ilce_sec.Text + "'";
                    SqlCommand komut_idcek = new SqlCommand(sorgu1, baglanti);
                    baglanti.Open();
                    object ilce_ID = komut_idcek.ExecuteScalar();
                    ilce_idsi = Convert.ToInt32(ilce_ID);
                    baglanti.Close();

                    String     sorgu = " Insert into Semt_Tablo (semtAdi,ilce_ID) Values (@semt, @ID)";
                    SqlCommand komut = new SqlCommand(sorgu, baglanti);
                    baglanti.Open();
                    komut.Parameters.AddWithValue("@semt", txt_semt_ismi.Text);
                    komut.Parameters.AddWithValue("@ID", ilce_idsi);
                    komut.ExecuteNonQuery();
                    baglanti.Close();
                }
            }
            else if (kisayol.yetkim == 2)
            {
                if (txt_semt_ismi.Text == String.Empty)
                {
                    kisayol.mesajBox_Basit("(*) Yildizli Alanlari Bos birakmayiniz.");
                }
                else
                {
                    String     sorgu1      = "select ilce_ID,ilceAdi from Ilceler_Tablosu where ilceAdi ='" + combo_ilce_sec.Text + "'";
                    SqlCommand komut_idcek = new SqlCommand(sorgu1, baglanti);
                    baglanti.Open();
                    object ilce_ID = komut_idcek.ExecuteScalar();
                    baglanti.Close();

                    baglanti.Open();
                    String     sorgu = "insert into Semt_Tablo(semtAdi,ilce_ID) Values (@semt,@id)";
                    SqlCommand komut = new SqlCommand(sorgu, baglanti);
                    komut.Parameters.AddWithValue("@semt", txt_semt_ismi.Text);
                    komut.Parameters.AddWithValue("@id", ilce_ID);
                    komut.ExecuteNonQuery();
                    baglanti.Close();
                }
            }
            kisayol.mesajBox_Butonlu("Yeni Semt kaydi basariyla tamamlandi !!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Beispiel #3
0
        private void btn_ilce_Click(object sender, EventArgs e)
        {
            Sehirler_ekran sehir = new Sehirler_ekran(kisayol.yetkim, kisayol.Gorevli_ID, kisayol.Il_Id, kisayol.ilce_ID);

            String     sorgu = "update Ilceler_Tablosu SET ilceAdi = @yeni Where ilce_ID = '" + ilce_IDsi + "' ";
            SqlCommand komut = new SqlCommand(sorgu, baglanti);

            komut.Parameters.AddWithValue("@yeni", textBox1.Text);
            baglanti.Open();
            komut.ExecuteNonQuery();
            baglanti.Close();

            MessageBox.Show("Bilgiler Basariyla Guncellendi !", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
        private void btn_kaydet_Click(object sender, EventArgs e)
        {
            Sehirler_ekran sehir = new Sehirler_ekran(kisayol.yetkim, kisayol.Gorevli_ID, kisayol.Il_Id, kisayol.ilce_ID);

            if (kisayol.yetkim == 1)
            {
                if (txt_il_ismi.Text == String.Empty)
                {
                    kisayol.mesajBox_Basit("(*) Yildizli Alanlari Bos birakmayiniz.");
                }
                else
                {
                    baglanti.Open();
                    String     sorgu = " Insert into Iller_Tablosu (ilAdi) Values (@il)";
                    SqlCommand komut = new SqlCommand(sorgu, baglanti);
                    komut.Parameters.AddWithValue("@il", txt_il_ismi.Text);
                    komut.ExecuteNonQuery();
                    baglanti.Close();

                    kisayol.mesajBox_Butonlu("Yeni Il kaydi basariyla tamamlandi !!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            else if (kisayol.yetkim == 2)
            {
                if (txt_ilce_ismi.Text == String.Empty)
                {
                    kisayol.mesajBox_Basit("(*) Yildizli Alanlari Bos birakmayiniz.");
                }
                else
                {
                    baglanti.Open();
                    String     sorgu = "INSERT INTO Iller_Tablosu (ilAdi) VALUES (@il); INSERT INTO Ilceler_Tablosu(il_id) Select TOP 1 il_ID from Iller_Tablosu ORDER BY il_ID DESC";
                    SqlCommand komut = new SqlCommand(sorgu, baglanti);
                    komut.Parameters.AddWithValue("@il", txt_il_ismi.Text);
                    komut.ExecuteNonQuery();

                    sehir.combo_iller.Items.Add(txt_il_ismi.Text);
                    baglanti.Close();

                    kisayol.mesajBox_Butonlu("Yeni Ilce kaydi basariyla tamamlandi !!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
        }
        private void btn_sehirler_Click(object sender, EventArgs e)
        {
            Sehirler_ekran sehir_ekle = new Sehirler_ekran(kisayol.yetkim, kisayol.Gorevli_ID, kisayol.Il_Id, kisayol.ilce_ID);

            sehir_ekle.ShowDialog(this);
        }