private void BiletSatis_Load(object sender, EventArgs e)
        {
            this.Dock = DockStyle.Fill;
            string sorgu_ilKalkis = "select distinct i.ilKodu,i.ilAdi from Seferler s, iller i where i.ilKodu=s.Kalkis";

            Asistan.comboBoxDoldur(comboBoxKalkis, sorgu_ilKalkis, "ilAdi", "ilKodu"); comboBoxKalkis.SelectedIndex = -1; comboBoxKalkis.Text = "Lütfen Seçiniz";


            comboBoxOSekli.Text = "Lütfen Seçiniz";
        }
Esempio n. 2
0
        public static DataTable dataTable(string sorgu)
        {
            SqlConnection baglanti = Asistan.baglan();

            baglanti.Open();
            SqlCommand     cmd = new SqlCommand(sorgu, baglanti);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            da.Fill(dt); return(dt);
        }
Esempio n. 3
0
        public static void KulListele(string sorgu, DataGridView dgv)
        {
            SqlConnection baglanti = Asistan.baglan();

            baglanti.Open();
            SqlCommand     cmd = new SqlCommand(sorgu, baglanti);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            dgv.DataSource = dt;
            baglanti.Close();
        }
Esempio n. 4
0
        public static void comboBoxDoldur(ComboBox cmb, string sorgu, string displayMember, string ValueMember)
        {
            SqlConnection baglanti = Asistan.baglan();

            baglanti.Open();
            SqlCommand     cmd = new SqlCommand(sorgu, baglanti);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            cmb.DataSource  = dt; cmb.DisplayMember = displayMember;
            cmb.ValueMember = ValueMember;
            baglanti.Close();
        }
Esempio n. 5
0
        public static void gridDoldur(string sorgu, DataGridView dgv)
        {
            SqlConnection baglanti = Asistan.baglan();

            baglanti.Open();
            SqlCommand     cmd = new SqlCommand(sorgu, baglanti);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "seferListe";
            da.Fill(dt);
            dgv.DataSource = dt;
            baglanti.Close();
        }
        private void btnEkle_Click(object sender, EventArgs e)
        {
            string srgEkle = "INSERT INTO Kullanici(KullaniciAdi ,Sifre,Adi,Soyadi) VALUES ('" + txtKullaniciAdi.Text + "','" + txtSifre.Text + "','" + txtAd.Text + "','" + txtSoyad.Text + "')";

            try
            {
                Asistan.iduSql(srgEkle);

                MessageBox.Show("İşlem tamamlandı...");
                Asistan.dgvYenile(dgvYenile, dataGridViewListe);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Hata");
            }
        }
 private void comboBoxVaris_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (comboBoxVaris.SelectedIndex != -1)
     {
         if (comboBoxVaris.SelectedValue.ToString() == comboBoxKalkis.SelectedValue.ToString())
         {
             MessageBox.Show("Aynı iller seçilemez");
         }
         else
         {
             string sorgu_sefer = "select s.SeferID,s.Tarih,a.KoltukSayisi from Seferler s, Araclar a where s.Arac=a.Plaka and s.Kalkis=" + comboBoxKalkis.SelectedValue + " and s.Varis=" + comboBoxVaris.SelectedValue;
             Asistan.comboBoxDoldur(comboBoxSefer, sorgu_sefer, "SeferID", "KoltukSayisi"); comboBoxSefer.Enabled = true;
             comboBoxSefer.Text = "Lütfen Seçiniz";
         }
     }
 }
        private void btnSil_Click(object sender, EventArgs e)
        {
            silme = true;
            string srgSil = "delete from Kullanici where KullaniciID=" + dataGridViewListe.CurrentRow.Cells[0].Value.ToString();

            SqlConnection con = Asistan.baglan();
            SqlCommand    cmd = new SqlCommand(srgSil, con);

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close(); DialogResult sonuc = MessageBox.Show("Silme onaylansın mı ?", "Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (sonuc == DialogResult.Yes)
            {
                Asistan.dgvYenile(dgvYenile, dataGridViewListe);
            }
        }
        private void Sefer_Load(object sender, EventArgs e)
        {
            this.Dock = DockStyle.Fill;
            string sorgu_il    = "SELECT  ilKodu,ilAdi FROM iller";
            string sorgu_arac  = "SELECT Plaka FROM Araclar";
            string sorgu_sofor = "SELECT  SoforID,Adi +' '+ Soyadi as Ad_Soyad FROM Soforler";

            Asistan.comboBoxDoldur(comboBoxKalkis, sorgu_il, "ilAdi", "ilKodu");
            Asistan.comboBoxDoldur(comboBoxVaris, sorgu_il, "ilAdi", "ilKodu");
            Asistan.comboBoxDoldur(comboBoxArac, sorgu_arac, "Plaka", "Plaka");
            Asistan.comboBoxDoldur(comboBoxSofor, sorgu_sofor, "Ad_Soyad", "SoforID");

            string sorgu_sefer = "SELECT SeferID,Plaka,Kalkis as Kalkış,Varis as Varış,Tarih as TarihSaat  FROM seferListe";


            Asistan.gridDoldur(sorgu_sefer, dgvSefer);
        }
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Boş alan bırakmayınız");
            }
            else
            {
                string tarih       = dateTimePicker1.Value.ToString("yyyy-MM-dd ");
                string saat        = textBox1.Text + ":" + textBox2.Text + ":00.000";
                string sorgu_Kayit = "INSERT INTO Seferler (Kalkis ,Varis,Tarih,Arac ,Sofor) VALUES(" + comboBoxKalkis.SelectedValue + "," + comboBoxVaris.SelectedValue + ",'" + tarih + saat + "','" + comboBoxArac.SelectedValue + "'," + comboBoxSofor.SelectedValue + ")";


                Asistan.iduSql(sorgu_Kayit);
                MessageBox.Show("İşlem Tamamlandı...");
            }
        }
        private void btnBiletSil_Click(object sender, EventArgs e)
        {
            DialogResult secim = MessageBox.Show("Silmek istiyor musunuz ?", "Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (secim == DialogResult.Yes)
            {
                string srg1 = "delete from Yolcu  where YolcuID= " + lbIDYolcu.Text;
                string srg  = "DELETE FROM Bilet WHERE KoltukNo= " + lblBiletNo.Text;


                Asistan.iduSql(srg1);
                Asistan.iduSql(srg);

                lbIDYolcu.Text = "*";
                lblAd.Text     = "*";
                lblSoyad.Text  = "*"; lbCinsiyet.Text = "*"; lbTelefon.Text = "*"; lblSeferTarih.Text = "*"; lblSeferNo.Text = "*";  lblSatisTipi.Text = "*"; lblKoltukNo.Text = "*"; lblBiletNo.Text = "*"; lblBİletFiyati.Text = "*";
            }
        }
        private void KullaniciIslem_Load(object sender, EventArgs e)
        {
            this.Dock = DockStyle.Fill;
            Form1 frm = new Form1();

            if (frm.ekleSilDüzenleToolStripMenuItem.Enabled == false)
            {
                panel1.Visible = false;
            }
            string srg = "SELECT KullaniciID,Adi,Soyadi,KullaniciAdi ,Sifre FROM Kullanici";

            SqlConnection  con = Asistan.baglan();
            SqlCommand     cmd = new SqlCommand(srg, con);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            dataGridViewListe.DataSource = dt;
        }
        private void comboBoxKalkis_SelectionChangeCommitted(object sender, EventArgs e)
        {
            comboBoxVaris.Enabled = true;
            string sorgu_ilVaris = "select distinct i.ilKodu,i.ilAdi from Seferler s, iller i where i.ilKodu=s.Varis and s.Kalkis=" + comboBoxKalkis.SelectedValue.ToString();

            Asistan.comboBoxDoldur(comboBoxVaris, sorgu_ilVaris, "ilAdi", "ilKodu"); comboBoxVaris.SelectedIndex = -1; comboBoxVaris.Text = "Lütfen Seçiniz";
            if (comboBoxVaris.SelectedIndex != -1)
            {
                if (comboBoxVaris.SelectedValue.ToString() == comboBoxKalkis.SelectedValue.ToString())
                {
                    MessageBox.Show("Aynı iller seçilemez");
                }
                else
                {
                    string sorgu_sefer = "SELECT SeferID,Tarih FROM Seferler where Kalkis=" + comboBoxKalkis.SelectedValue + " and Varis=" + comboBoxVaris.SelectedValue;
                    Asistan.iduSql(sorgu_sefer); Asistan.comboBoxDoldur(comboBoxSefer, sorgu_sefer, "SeferID", "SeferID");
                    comboBoxSefer.Enabled = true; comboBoxSefer.Text = "Lütfen Seçiniz";
                }
            }
        }
        private void dataGridViewListe_SelectionChanged(object sender, EventArgs e)
        {
            if (silme)
            {
                goto bitis;
            }


            string srgSifre = "SELECT Sifre FROM Kullanici";

            txtAd.Text           = dataGridViewListe.CurrentRow.Cells[1].Value.ToString();
            txtKullaniciAdi.Text = dataGridViewListe.CurrentRow.Cells[3].Value.ToString();

            txtSoyad.Text = dataGridViewListe.CurrentRow.Cells[2].Value.ToString();
            DataTable dtSifre = Asistan.dataTable(srgSifre);

            txtSifre.Text = dtSifre.Rows[0][0].ToString();


            bitis :;
        }
        private void btnBiletAra_Click(object sender, EventArgs e)
        {
            DataTable dtBilet = new DataTable();

            dtBilet = Asistan.dataTable("select * from Bilet where BiletID=" + txtBiletNo.Text);
            DataTable dtYolcu = new DataTable();

            dtYolcu = Asistan.dataTable("select * from Yolcu Inner Join Bilet on Yolcu.YolcuID=Bilet.YolcuID and Yolcu.SeferID=Bilet.SeferID where Bilet.BiletID=" + txtBiletNo.Text);
            DataTable dtSefer = new DataTable();

            dtSefer = Asistan.dataTable("select Tarih from Seferler where SeferID=" + dtBilet.Rows[0]["SeferID"].ToString());

            if (dtYolcu.Rows.Count > 0 && dtBilet.Rows.Count > 0)
            {
                lblBiletNo.Text     = dtBilet.Rows[0][0].ToString();
                lblAd.Text          = dtYolcu.Rows[0]["Adi"].ToString();
                lblSoyad.Text       = dtYolcu.Rows[0]["Soyadi"].ToString();
                lblBİletFiyati.Text = dtBilet.Rows[0]["Fiyat"].ToString();
                lblKoltukNo.Text    = dtBilet.Rows[0]["KoltukNo"].ToString();
                lbCinsiyet.Text     = dtYolcu.Rows[0]["Cinsiyet"].ToString();
                lbTelefon.Text      = dtYolcu.Rows[0]["Telefon"].ToString();
                lbIDYolcu.Text      = dtYolcu.Rows[0]["YolcuID"].ToString();

                lblSeferTarih.Text = dtSefer.Rows[0]["Tarih"].ToString();
                lblSeferNo.Text    = dtBilet.Rows[0]["SeferID"].ToString();
                if (dtBilet.Rows[0]["OdemeSekli"].ToString() == "True")
                {
                    lblSatisTipi.Text = "Nakit";
                }
                else
                {
                    lblSatisTipi.Text = "Kredi Kartı";
                }
            }
            else
            {
                MessageBox.Show("Biletbulunamadı...");
            }
        }
Esempio n. 16
0
        private void btnGiris_Click(object sender, EventArgs e)
        {
            bool[] yetki = new bool[7];
            string sorgu = "select KullaniciID,KullaniciAdi,Sifre,Adi,Soyadi from Kullanici where KullaniciAdi='" + txtKullaniciAdi.Text + "' and Sifre ='" + txtSifre.Text + "'";

            try
            {
                SqlConnection cnn = Asistan.baglan();

                SqlCommand komut = new SqlCommand(sorgu, cnn);

                SqlDataAdapter da = new SqlDataAdapter(komut);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    Form1.mdi.yönetimselİşlemlerToolStripMenuItem.Enabled = true;
                    Form1.mdi.BiletToolStripMenuItem.Enabled = true;
                    Form1.mdi.lblKullanici.Text = "Kullanıcı : " + dt.Rows[0][3].ToString() + " " + dt.Rows[0][4].ToString(); this.Close();
                    Form1.mdi.kullanıcıİşlemleriToolStripMenuItem.Enabled   = true;
                    Form1.mdi.biletSatisToolStripMenuItem.Enabled           = true;
                    Form1.mdi.biletSilToolStripMenuItem.Enabled             = true;
                    Form1.mdi.seferlerToolStripMenuItem.Enabled             = true;
                    Form1.mdi.otobüslerToolStripMenuItem.Enabled            = true;
                    Form1.mdi.şoförlerToolStripMenuItem.Enabled             = true;
                    Form1.mdi.oturumuKapatToolStripMenuItem.Enabled         = true;
                    Form1.mdi.kullanıcılarıListeleToolStripMenuItem.Enabled = true;
                    Form1.mdi.ekleSilDüzenleToolStripMenuItem.Enabled       = true;
                }
                else
                {
                    MessageBox.Show("Hatalı Giriş ...");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Bağlantı Hatası", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void koltuklarClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            BasılanButon = (Button)sender;
            int          koltukNo = int.Parse(BasılanButon.Text);
            string       cinsiyet = "";
            DialogResult secim    = MessageBox.Show("Bu koltuğa kayıt yapılsın mı ?", "Koltuk Onay", MessageBoxButtons.YesNo);

            if (secim == DialogResult.Yes)
            {
                if (txtUcret.Text == "" || comboBoxOSekli.SelectedIndex == -1)
                {
                    MessageBox.Show("Ödeme bilgilerini giriniz."); goto hata;
                }
                if (rdoBayan.Checked == true)
                {
                    cinsiyet               = "K";
                    koltukcins[koltukNo]   = "K";
                    BasılanButon.BackColor = Color.LightPink;
                }
                else if (rdoErkek.Checked == true)
                {
                    cinsiyet               = "E";
                    koltukcins[koltukNo]   = "E";
                    BasılanButon.BackColor = Color.LightBlue;
                }
                else
                {
                    MessageBox.Show("Hata ! Lütfen seçimlerinizi kontrol ediniz..."); goto hata;
                }
                BasılanButon.Enabled   = false;
                yolcular[koltukNo - 1] = txtAd.Text.PadRight(12, ' ') + txtSoyad.Text.PadRight(12, ' ') + cinsiyet.PadRight(8, ' ');
                yolcuSayisi++;
                string odeme = "";
                if (comboBoxOSekli.Text == "Nakit")
                {
                    odeme = "1";
                }
                else
                {
                    odeme = "2";
                }
                string tarih = Asistan.tarihFormat(DateTime.Now.Day.ToString(), DateTime.Now.Month.ToString(), DateTime.Now.Year.ToString());

                string    Yolcu_kayit  = " Insert into Yolcu(SeferID,Adi,Soyadi,Cinsiyet,Telefon,Aciklama) VALUES (" + comboBoxSefer.Text + ",'" + txtAd.Text + "','" + txtSoyad.Text + "','" + cinsiyet + "','" + txtTel.Text + "',' ')"; Asistan.iduSql(Yolcu_kayit);
                DataTable dtSefer      = Asistan.dataTable("Select * from Seferler where SeferID=" + comboBoxSefer.GetItemText(comboBoxSefer.SelectedItem));
                DataTable dtYolcu      = Asistan.dataTable("Select * from Yolcu where SeferID=" + comboBoxSefer.Text + " and Adi='" + txtAd.Text + "' and  Soyadi='" + txtSoyad.Text + "'");
                string    koltuk_kayit = "Insert into Koltuk(Plaka,KoltukNo,SeferID,YolcuID,Fiyat,OdemeSekli,AlınmaTarihi) VALUES ('" + dtSefer.Rows[0]["Arac"].ToString() + "','" + BasılanButon.Text + "'," + comboBoxSefer.Text + "," + dtYolcu.Rows[0]["YolcuID"] + "," + txtUcret.Text + "," + odeme + ",'" + tarih + "')";

                Asistan.iduSql(koltuk_kayit);
                SqlConnection cnn = Asistan.baglan();
                cnn.Open();

                SqlCommand cmd = new SqlCommand("Insert into Bilet(Plaka,SeferID,KoltukNo,Fiyat,OdemeSekli,YolcuID) values(@Plaka,@SeferID,@KoltukNo,@Fiyat,@OdemeSekli,@YolcuID)", cnn);


                cmd.Parameters.AddWithValue("@Plaka", dtSefer.Rows[0]["Arac"].ToString());
                cmd.Parameters.AddWithValue("@KoltukID", "Koltuk.KoltukID");
                cmd.Parameters.AddWithValue("@SeferID", comboBoxSefer.Text);
                cmd.Parameters.AddWithValue("@KoltukNo", BasılanButon.Text);
                cmd.Parameters.AddWithValue("@Fiyat", txtUcret.Text);
                cmd.Parameters.AddWithValue("@OdemeSekli", odeme);
                cmd.Parameters.AddWithValue("@YolcuID", dtYolcu.Rows[0]["YolcuID"]);


                cmd.ExecuteNonQuery(); cnn.Close();


                formTemizle();
                hata :;
            }
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            string sorgu_sefer = "SELECT SeferID,Kalkis as Kalkış,Varis as Varış,Tarih as TarihSaat  FROM Seferler";

            Asistan.gridDoldur(sorgu_sefer, dgvSefer);
        }