コード例 #1
0
        private void frmOtobusIslemleri_Load(object sender, EventArgs e)
        {
            DataTable dtKoltuk = MSSQLDataConnection.SelectDataFromDB("SELECT ID,KoltukTuru FROM tblKoltukTurleri", null);

            cmbKoltukTuru.DataSource = dtKoltuk;
            cmbKoltukTuru.Text       = "Seçiniz";
            Goster();
        }
コード例 #2
0
ファイル: frmSatis.cs プロジェクト: UfukCaglayan/KingsTP
        private void frmSatis_Load(object sender, EventArgs e)
        {
            DataTable dtKalkis = MSSQLDataConnection.SelectDataFromDB("SELECT ID,TerminalAdi FROM tblTerminaller", null);
            DataTable dtVaris  = MSSQLDataConnection.SelectDataFromDB("SELECT ID,TerminalAdi FROM tblTerminaller", null);

            cmbKalkis.DataSource = dtKalkis;
            cmbVaris.DataSource  = dtVaris;
        }
コード例 #3
0
 private void frmSeferIslemleri_Load(object sender, EventArgs e)
 {
     DataTable dtOtobusler = MSSQLDataConnection.SelectDataFromDB("SELECT ID,Plaka FROM tblOtobusler", null);
     cmbOtobus.DataSource = dtOtobusler;
     DataTable dtKalkis = MSSQLDataConnection.SelectDataFromDB("SELECT ID,TerminalAdi FROM tblTerminaller", null);
     cmbKalkis.DataSource = dtKalkis;
     DataTable dtVaris = MSSQLDataConnection.SelectDataFromDB("SELECT ID,TerminalAdi FROM tblTerminaller", null);
     cmbVaris.DataSource = dtVaris;
 }
コード例 #4
0
        private void txtArama_TextChanged(object sender, EventArgs e)
        {
            DataTable dt = MSSQLDataConnection.SelectDataFromDB("SELECT * FROM tblTerminaller WHERE TerminalAdi LIKE '%" + txtArama.Text + "%'", null);

            dgvTerminaller.DataSource = dt;
            if (dt.Rows.Count > 0)
            {
                dgvTerminaller.Columns[0].Visible = false;
            }
        }
コード例 #5
0
        private void Goster()
        {
            DataTable dt = MSSQLDataConnection.SelectDataFromDB("SELECT * FROM tblTerminaller", null);

            dgvTerminaller.DataSource = dt;
            Temizle();
            if (dt.Rows.Count > 0)
            {
                dgvTerminaller.Columns[0].Visible = false;
            }
        }
コード例 #6
0
        private void btnSil_Click(object sender, EventArgs e)
        {
            DialogResult sil = MessageBox.Show("Terminal kaydını silmek istediğinizden emin misiniz ?", "Kayıt Silme", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (sil == DialogResult.Yes)
            {
                int ID = Convert.ToInt32(dgvTerminaller.CurrentRow.Cells[0].Value.ToString());
                MSSQLDataConnection.DeleteDataFromDB("DELETE FROM tblTerminaller WHERE ID = @param1", new SqlParameter[] { new SqlParameter("param1", ID) });
                MessageBox.Show("Kayıt Başarıyla Silindi.", "Kayıt Silme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Goster();
            }
        }
コード例 #7
0
        private void Goster()
        {
            DataTable dt = MSSQLDataConnection.SelectDataFromDB("SELECT O.ID,Plaka,KoltukTuru,KoltukTuruID FROM tblOtobusler O INNER JOIN tblKoltukTurleri KT ON O.KoltukTuruID = KT.ID", null);

            dgvOtobusler.DataSource = dt;
            if (dt.Rows.Count > 0)
            {
                dgvOtobusler.Columns[0].Visible = false;
                dgvOtobusler.Columns[3].Visible = false;
            }

            Temizle();
        }
コード例 #8
0
ファイル: ucSefer.cs プロジェクト: UfukCaglayan/KingsTP
        private void ucSefer_Load(object sender, EventArgs e)
        {
            DataTable dt = MSSQLDataConnection.SelectDataFromDB("SELECT (SELECT TerminalAdi FROM tblTerminaller WHERE ID = KalkisTerminalID) AS KalkisTerminal,(SELECT TerminalAdi FROM tblTerminaller WHERE ID = VarisTerminalID) AS VarisTerminal,TarihSaat,HareketSuresi,KalanKoltuk,CONVERT(INT, FLOOR(Fiyat)),S.ID,KoltukTuru FROM tblSeferler S INNER JOIN tblOtobusler O ON S.OtobusID = O.ID INNER JOIN tblKoltukTurleri KT ON O.KoltukTuruID = KT.ID WHERE S.ID = @param1", new SqlParameter[] { new SqlParameter("param1", Sefer.dtSeferler.Rows[Sefer.row][0].ToString()) });

            lbKalkisTerminal.Text = dt.Rows[0][0].ToString();
            lbVarisTerminal.Text  = dt.Rows[0][1].ToString();
            lbKalkisSaat.Text     = dt.Rows[0][2].ToString();
            lbHareket.Text        = dt.Rows[0][3].ToString() + " Saat";
            lbKalanKoltuk.Text    = dt.Rows[0][4].ToString();
            lbFiyat.Text          = dt.Rows[0][5].ToString() + " TL";
            lbSeferID.Text        = dt.Rows[0][6].ToString();
            lbKoltukTuru.Text     = dt.Rows[0][7].ToString();
            Sefer.row++;
        }
コード例 #9
0
ファイル: frmSatis.cs プロジェクト: UfukCaglayan/KingsTP
        private void btnListele_Click(object sender, EventArgs e)
        {
            string kalkisTarih = dtTarih.Value.ToString("yyyy-MM-dd");

            Sefer.row        = 0;
            Sefer.dtSeferler = MSSQLDataConnection.SelectDataFromDB("SELECT ID FROM tblSeferler WHERE KalkisTerminalID = @param1 AND VarisTerminalID = @param2 AND CONVERT(DATE, TarihSaat) = @param3", new SqlParameter[] { new SqlParameter("param1", cmbKalkis.SelectedValue), new SqlParameter("param2", cmbVaris.SelectedValue), new SqlParameter("param3", kalkisTarih) });

            for (int i = 0; i < Sefer.dtSeferler.Rows.Count; i++)
            {
                ucSefer uc1 = new ucSefer();
                uc1.Top = i * 70;
                pnlSeferler.Controls.Add(uc1);
            }
        }
コード例 #10
0
        private void btnOdeme_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("SeferID", typeof(int));
            dt.Columns.Add("KoltukID", typeof(int));
            dt.Columns.Add("TCKimlikNo", typeof(string));
            dt.Columns.Add("Ad", typeof(string));
            dt.Columns.Add("Soyad", typeof(string));
            dt.Columns.Add("Cinsiyet", typeof(string));

            for (int i = 0; i < koltuklar.Count; i++)
            {
                UserControl uc           = this.Controls.Find("ucRezerve" + i, true).FirstOrDefault() as UserControl;
                TextBox     txTCKimlikNo = uc.Controls.Find("txTCKimlikNo", true).FirstOrDefault() as TextBox;
                TextBox     txtAd        = uc.Controls.Find("txtAd", true).FirstOrDefault() as TextBox;
                TextBox     txtSoyad     = uc.Controls.Find("txtSoyad", true).FirstOrDefault() as TextBox;
                dt.Rows.Add(sefer, koltuklar[i], txTCKimlikNo.Text, txtAd.Text, txtSoyad.Text, "E");
            }
            MSSQLDataConnection.InsertRezerveTablo(dt);
            MessageBox.Show("İŞLEM TAMAM");
        }
コード例 #11
0
 private void btnKaydet_Click(object sender, EventArgs e)
 {
     if (txtPlaka.Text != null && cmbKoltukTuru.Text != "Seçiniz")
     {
         if (txtPlaka.Text.Length == 8)
         {
             int cnt = MSSQLDataConnection.SelectIntFromDB("SELECT COUNT(*) FROM tblOtobusler WHERE Plaka = @param1", new SqlParameter[] { new SqlParameter("param1", txtPlaka.Text) });
             if (kaydet == true)
             {
                 if (cnt == 0)
                 {
                     MSSQLDataConnection.InsertDataToDB("INSERT INTO tblOtobusler (Plaka,KoltukTuruID) VALUES (@param1,@param2)", new SqlParameter[] { new SqlParameter("param1", txtPlaka.Text), new SqlParameter("param2", cmbKoltukTuru.SelectedValue) });
                     Goster();
                     MessageBox.Show("Kayıt Başarıyla Eklendi.", "Kayıt Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 }
                 else
                 {
                     MessageBox.Show("Bu Plakaya Sahip Otobüs Daha Önce Sisteme Kayıt Edildi", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                 }
             }
             else
             {
                 MSSQLDataConnection.UpdateDataToDB("UPDATE tblOtobusler SET Plaka = @param1,KoltukTuruID= @param2 WHERE ID = @param3 ", new SqlParameter[] { new SqlParameter("param1", txtPlaka.Text), new SqlParameter("param2", cmbKoltukTuru.SelectedValue), new SqlParameter("param3", seciliID) });
                 MessageBox.Show("Kayıt Başarıyla Güncellendi.", "Kayıt Güncelleme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 Goster();
                 kaydet = true;
             }
         }
         else
         {
             MessageBox.Show("Plaka 8 Haneli Olmalıdır", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         }
     }
     else
     {
         MessageBox.Show("Bilgileri Eksik Girdiniz", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
コード例 #12
0
 private void btnKaydet_Click(object sender, EventArgs e)
 {
     if (txtTerminal.Text != "")
     {
         if (kaydet == true)
         {
             int cnt = MSSQLDataConnection.SelectIntFromDB("SELECT COUNT(*) FROM tblTerminaller WHERE TerminalAdi = @param1", new SqlParameter[] { new SqlParameter("param1", txtTerminal.Text) });
             if (cnt == 0)
             {
                 MSSQLDataConnection.InsertDataToDB("INSERT INTO tblTerminaller (TerminalAdi) VALUES (@param1)", new SqlParameter[] { new SqlParameter("param1", txtTerminal.Text) });
                 Goster();
                 MessageBox.Show("Kayıt Başarıyla Eklendi.", "Kayıt Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
         }
         else
         {
             MSSQLDataConnection.UpdateDataToDB("UPDATE tblTerminaller SET TerminalAdi = @param1 WHERE ID = @param2 ", new SqlParameter[] { new SqlParameter("param1", txtTerminal.Text), new SqlParameter("param2", seciliID) });
             MessageBox.Show("Kayıt Başarıyla Güncellendi.", "Kayıt Güncelleme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             Goster();
             kaydet = true;
         }
     }
 }
コード例 #13
0
        public void KoltukDoldur(int seferID)
        {
            int sag = 0, sol = 0;

            sefer = seferID;
            int koltukTuru = MSSQLDataConnection.SelectIntFromDB("SELECT KoltukTuruID FROM tblSeferler S INNER JOIN tblOtobusler O ON S.OtobusID = O.ID WHERE S.ID = @param1", new SqlParameter[] { new SqlParameter("param1", seferID) });

            if (koltukTuru == 1)
            {
                sag = 1;
                sol = 1;
            }
            else if (koltukTuru == 2)
            {
                sag = 2;
                sol = 1;
            }
            else if (koltukTuru == 3)
            {
                sag = 2;
                sol = 2;
            }
            int sagSon = 0;

            for (int i = 0; i < sag; i++)
            {
                for (int k = 1; k <= 20; k++)
                {
                    Button btnSag = new Button();
                    btnSag.Width    = 50;
                    btnSag.Height   = 40;
                    btnSag.Location = new Point(90 + (k * 60), 80 + (i * 45));
                    string koltukText = "";
                    if (sag == 2)
                    {
                        if (i == 0)
                        {
                            koltukText = (k * 2 - 1).ToString();
                        }
                        else if (i == 1)
                        {
                            koltukText = (k * 2).ToString();
                        }
                    }
                    else if (sag == 1)
                    {
                        koltukText = k.ToString();
                    }
                    btnSag.Click += btnKoltuk_Click;
                    btnSag.Text   = koltukText;
                    btnSag.Name   = "btnKoltuk" + koltukText;
                    this.Controls.Add(btnSag);
                }
            }
            sagSon = sag * 20;
            for (int i = 0; i < sol; i++)
            {
                for (int k = 1; k <= 20; k++)
                {
                    Button btnSol = new Button();
                    btnSol.Width    = 50;
                    btnSol.Height   = 40;
                    btnSol.Location = new Point(90 + (k * 60), 220 + (i * 45));
                    string koltukText = "";
                    if (sol == 2)
                    {
                        if (i == 0)
                        {
                            koltukText = (k * 2 - 1 + sagSon).ToString();
                        }
                        else if (i == 1)
                        {
                            koltukText = (k * 2 + sagSon).ToString();
                        }
                    }
                    else if (sol == 1)
                    {
                        koltukText = (sagSon + k).ToString();
                    }
                    btnSol.Click += btnKoltuk_Click;
                    btnSol.Text   = koltukText;
                    btnSol.Name   = "btnKoltuk" + koltukText;
                    this.Controls.Add(btnSol);
                }
            }


            DataTable dt = MSSQLDataConnection.SelectDataFromDB("SELECT KoltukNo FROM tblKoltukRezerve WHERE SeferID = @param1", new SqlParameter[] { new SqlParameter("param1", seferID) });

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string koltuk    = dt.Rows[i][0].ToString();
                Button btnKoltuk = this.Controls.Find("btnKoltuk" + koltuk, true).FirstOrDefault() as Button;
                btnKoltuk.Enabled = false;
            }
        }