Пример #1
0
        private void AracEkleButon_Click(object sender, EventArgs e) // ARAÇ EKLEME İŞLEMİ
        {
            E_Arac arac = new E_Arac();

            if (SubeComboBox1.SelectedIndex > -1 && KategoriComboBox2.SelectedIndex > -1 && MarkaComboBox.SelectedIndex > -1 && YakitComboBox.SelectedIndex > -1 && SanzimanComboBox.SelectedIndex > -1)
            {
                arac.SubeID     = Convert.ToInt32(SubeComboBox1.SelectedValue);
                arac.KategoriID = Convert.ToInt32(KategoriComboBox2.SelectedValue);
                arac.MarkaID    = Convert.ToInt32(MarkaComboBox.SelectedValue);
                arac.Plaka      = AracPlakaTxtBox.Text;
                arac.Model      = AracModelTxtBox.Text;
                arac.ModelYili  = Convert.ToInt32(AracYilTxtBox.Text);
                arac.Hacim      = AracHacimTxtBox.Text;
                arac.Guc        = AracGucTxtBox.Text;
                arac.Yakit      = YakitComboBox.SelectedItem.ToString();
                arac.Sanziman   = SanzimanComboBox.SelectedItem.ToString();
                arac.Kilometre  = Convert.ToDouble(AracKMTxtBox.Text);
                arac.Renk       = AracRenkTxtBox.Text;
                arac.Donanim    = AracDonanimTxtBox.Text;
                arac.Ucret      = Convert.ToDouble(AracUcretTxtBox.Text);
                if (ResimAdLabel.Text != "-")
                {
                    FileStream   fs = new FileStream(AracResimFileDg.FileName, FileMode.Open, FileAccess.Read);
                    BinaryReader br = new BinaryReader(fs);
                    arac.Resim = br.ReadBytes((int)fs.Length);
                }
                else
                {
                    arac.Resim = null;
                }

                int durum = BLL_Arac.AracEkle(arac);

                if (durum == -1)
                {
                    MessageBox.Show("Lütfen girdiğiniz verileri kontrol ediniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (durum == 0)
                {
                    MessageBox.Show("Bu plaka zaten kayıtlı.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (durum == 1)
                {
                    MessageBox.Show(AracPlakaTxtBox.Text + " Plakalı araç başarıyla eklendi.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    TextBoxTemizle();
                    ResimAdLabel.Text               = "-";
                    SubeComboBox1.SelectedIndex     = -1;
                    KategoriComboBox2.SelectedIndex = -1;
                    YakitComboBox.SelectedIndex     = -1;
                    SanzimanComboBox.SelectedIndex  = -1;
                    MarkaComboBox.DataSource        = null;
                    TumAraclarGridVerileri();
                }
            }
            else
            {
                MessageBox.Show("Lütfen girdiğiniz verileri kontrol ediniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        void TumAraclarGridVerileri() // YÖNETİCİ İÇİN TÜM ARAÇLAR
        {
            TumAraclarGridView.DataSource = null;
            DataTable dt = BLL_Arac.TumAraclar();

            TumAraclarGridView.DataSource = dt;
            TumAraclarGridView.Refresh();
        }
Пример #3
0
        void SubemdekiAraclar() // ŞUBEDEKİ TÜM ARAÇLAR
        {
            AracGridView.DataSource = null;
            DataTable dt = BLL_Arac.TekSubeninAraclari(Session.SubeID);

            AracGridView.DataSource = dt;
            AracGridView.Refresh();
            AracGridView.ClearSelection();
        }
Пример #4
0
        private void TumAraclardaAraTxtBox_TextChanged(object sender, EventArgs e) // ARAÇ ARAMAK İÇİN TEXTCHANGED
        {
            TumAraclarGridView.DataSource = null;
            DataTable dt = BLL_Arac.TumAraclardaAra(TumAraclardaAraTxtBox.Text.ToString());

            TumAraclarGridView.DataSource = dt;

            TumAraclarGridView.Refresh();
        }
Пример #5
0
 private void KiralaButon_Click(object sender, EventArgs e)
 {
     tabControl1.SelectTab(OdemePage);
     byte[] resim = BLL_Arac.AracResimGetir(PlakaLabel.Text);
     if (resim != null)
     {
         MemoryStream mem = new MemoryStream(resim);
         O_PictureBox.Image = Image.FromStream(mem);
     }
 }
Пример #6
0
        private void uzatTimePicker_ValueChanged(object sender, EventArgs e)
        {
            double   uyeucreti   = BLL_Arac.UyeUcretiGetir(uzatPlakaLabel.Text);
            TimeSpan GunHesapla  = uzatTimePicker.Value - Convert.ToDateTime(UzatBaslangicLabel.Text);
            int      Gun         = Convert.ToInt32(GunHesapla.TotalDays);
            double   Toplamucret = uyeucreti * Gun;
            double   ekucret     = Toplamucret - Convert.ToDouble(uzatOdenenLabel.Text);

            uzatEkUcretLabel.Text = ekucret.ToString();
        }
Пример #7
0
 private void AracGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) // SEÇİLEN ARACI SİLME - ARAÇ RESMİ GÖRÜNTÜLEME
 {
     if (e.ColumnIndex == 0)
     {
         string plaka = AracGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString();
         byte[] resim = BLL_Arac.AracResimGetir(plaka);
         if (resim == null)
         {
             MessageBox.Show("Araç resmi bulunmamaktadır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MemoryStream  mem        = new MemoryStream(resim);
             AracResimForm resimformu = new AracResimForm();
             resimformu.AracResimPictureBox.Image = Image.FromStream(mem);
             resimformu.Text = plaka + " - Resim";
             resimformu.ShowDialog();
         }
     }
     else if (e.ColumnIndex == 1)
     {
         string plaka = AracGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString();
         if (AracGridView.Rows[e.RowIndex].Cells["Durum"].Value.ToString() == "Kirada")
         {
             MessageBox.Show("Araç kirada olduğundan işleminiz gerçekleştirilmedi.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             DialogResult result = MessageBox.Show(plaka + " Plakalı aracı silmek üzeresiniz!\nAracı sildiğiniz takdirde bu plakaya ait tüm bilgiler(Kiralama,İptal Edilenler,Bitenler,Teslim Alınanlar) silinecek ve geri dönüşü olmayacaktır.\nDevam etmek istiyormusunuz ?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (result == DialogResult.Yes)
             {
                 int durum = BLL_Arac.SubedenAracSil(plaka);
                 if (durum == 0)
                 {
                     MessageBox.Show("İşlem gerçekleştirilirken bir hata oluştu.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else if (durum > 0)
                 {
                     MessageBox.Show(plaka + " Plakalı araç başarıyla silindi.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     SubemdekiAraclar();
                 }
             }
         }
     }
     else if (e.ColumnIndex == 2)
     {
         Presentation.AracGuncelle yeni = new Presentation.AracGuncelle();
         yeni.Text                = AracGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString() + "-Güncelle";
         yeni.PlakaLabel.Text     = AracGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString();
         yeni.EskiKMLabel.Text    = AracGridView.Rows[e.RowIndex].Cells["Kilometre"].Value.ToString() + " KM";
         yeni.EskiUcretLabel.Text = AracGridView.Rows[e.RowIndex].Cells["Ucret"].Value.ToString() + " TL";
         yeni.ShowDialog();
         SubemdekiAraclar();
     }
 }
Пример #8
0
 private void SubeComboBox_SelectedIndexChanged(object sender, EventArgs e) //ŞUBEYE GÖRE ARAÇ GETİRME
 {
     if (SubeComboBox.SelectedValue is int)
     {
         AracGridView.DataSource = null;
         DataTable dt = BLL_Arac.TekSubeninAraclari(Convert.ToInt32(SubeComboBox.SelectedValue));
         AracGridView.DataSource = dt;
         AracGridView.Refresh();
         AracGridView.ClearSelection();
     }
 }
Пример #9
0
 private void AracTeslimGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         string plaka = AracTeslimGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString();
         TeslimTCLabel.Text         = AracTeslimGridView.Rows[e.RowIndex].Cells["TC"].Value.ToString();
         TeslimTakipLabel.Text      = AracTeslimGridView.Rows[e.RowIndex].Cells["TakipKod"].Value.ToString();
         TeslimPlakaLabel.Text      = plaka;
         TeslimOncekiKMLabel.Text   = BLL_Arac.AracKMGetir(plaka).ToString();
         AracTeslimGroupBox.Enabled = true;
     }
 }
Пример #10
0
        void KategoriMarkaComboDoldur() //ARAÇ EKLEME KATEGORİ COMBOBOX'I
        {
            KategoriComboBox2.DataSource = null;
            List <E_Arac> ktgr = new List <E_Arac>();

            ktgr = BLL_Arac.Kategoriler();

            KategoriComboBox2.DataSource = ktgr;

            KategoriComboBox2.DisplayMember = "Kategori";
            KategoriComboBox2.ValueMember   = "KategoriID";
            KategoriComboBox2.SelectedIndex = -1;
        }
Пример #11
0
        void KategoriMarkaComboDoldur() //KATEGORİLER
        {
            KategoriComboBox1.DataSource = null;
            List <E_Arac> ktgr = new List <E_Arac>();

            ktgr = BLL_Arac.Kategoriler();

            KategoriComboBox1.DataSource = ktgr;

            KategoriComboBox1.DisplayMember = "Kategori";
            KategoriComboBox1.ValueMember   = "KategoriID";
            KategoriComboBox1.SelectedIndex = -1;
        }
Пример #12
0
        private void AracGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                if (AracGridView.Rows[e.RowIndex].Cells["Durum"].Value.ToString() == "Kirada")
                {
                    MessageBox.Show("Seçtiğiniz araç kirada olduğundan işlem yapılamaz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (AracGridView.Rows[e.RowIndex].Cells["Durum"].Value.ToString() == "Teslim Bekliyor")
                {
                    MessageBox.Show("Seçtiğiniz araç henüz teslim edilmediğinden işlem yapılamaz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    AracBilgiGroupBox.Enabled = true;
                    string plaka = AracGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString();
                    PlakaLabel.Text      = plaka;
                    KategoriLabel.Text   = AracGridView.Rows[e.RowIndex].Cells["Kategori"].Value.ToString();
                    MarkaLabel.Text      = AracGridView.Rows[e.RowIndex].Cells["Marka"].Value.ToString();
                    ModelLabel.Text      = AracGridView.Rows[e.RowIndex].Cells["Model"].Value.ToString();
                    ModelYilLabel.Text   = AracGridView.Rows[e.RowIndex].Cells["ModelYili"].Value.ToString();
                    MotorHacmiLabel.Text = AracGridView.Rows[e.RowIndex].Cells["Hacim"].Value.ToString();
                    MotorGucuLabel.Text  = AracGridView.Rows[e.RowIndex].Cells["Guc"].Value.ToString();
                    YakitLabel.Text      = AracGridView.Rows[e.RowIndex].Cells["Yakit"].Value.ToString();
                    SanzimanLabel.Text   = AracGridView.Rows[e.RowIndex].Cells["Sanziman"].Value.ToString();
                    KilometreLabel.Text  = AracGridView.Rows[e.RowIndex].Cells["Kilometre"].Value.ToString();
                    RenkLabel.Text       = AracGridView.Rows[e.RowIndex].Cells["Renk"].Value.ToString();
                    DonanimLabel.Text    = AracGridView.Rows[e.RowIndex].Cells["Donanim"].Value.ToString();
                    if (Session.Yetki == 1)
                    {
                        GunlukUcretLabel.Text = BLL_Arac.UyeUcretiGetir(plaka).ToString();
                    }
                    else
                    {
                        GunlukUcretLabel.Text = AracGridView.Rows[e.RowIndex].Cells["Ucret"].Value.ToString();
                    }

                    byte[] resim = BLL_Arac.AracResimGetir(plaka);
                    if (resim != null)
                    {
                        MemoryStream mem = new MemoryStream(resim);
                        AracPictureBox.Image = Image.FromStream(mem);
                    }
                    else
                    {
                        AracPictureBox.Image = null;
                    }
                }
            }
        }
Пример #13
0
        private void KategoriComboBox2_SelectedIndexChanged(object sender, EventArgs e) // Her kategori değişiminde marka listesi yenilenir.
        {
            if (KategoriComboBox2.SelectedValue is int)                                 //KATEGORİCOMBOBOX'INA İLK VERİLER EKLENİRKEN İNT GELMEYEN DEĞER İÇİN KONTROL
            {
                MarkaComboBox.DataSource = null;

                List <E_Arac> marka = new List <E_Arac>();
                int           id    = Convert.ToInt32(KategoriComboBox2.SelectedValue);
                marka = BLL_Arac.Markalar(id);
                if (marka != null)
                {
                    MarkaComboBox.DataSource    = marka;
                    MarkaComboBox.DisplayMember = "Marka";
                    MarkaComboBox.ValueMember   = "MarkaID";
                }
            }
        }
Пример #14
0
        private void KategoriComboBox1_SelectedIndexChanged(object sender, EventArgs e) // KATEGORİ SEÇİMİNE GÖRE ARAÇLAR
        {
            if (KategoriComboBox1.SelectedValue is int)                                 //KATEGORİCOMBOBOX'INA İLK VERİLER EKLENİRKEN İNT GELMEYEN DEĞER İÇİN KONTROL
            {
                AracMarkaComboBox.DataSource = null;

                List <E_Arac> marka = new List <E_Arac>();
                int           id    = Convert.ToInt32(KategoriComboBox1.SelectedValue);
                marka = BLL_Arac.Markalar(id);
                if (marka != null)
                {
                    AracMarkaComboBox.DataSource    = marka;
                    AracMarkaComboBox.DisplayMember = "Marka";
                    AracMarkaComboBox.ValueMember   = "MarkaID";
                }
            }
        }
Пример #15
0
        private void GuncelleButon_Click(object sender, EventArgs e)
        {
            E_Arac arac = new E_Arac();

            arac.Plaka     = PlakaLabel.Text;
            arac.Kilometre = Convert.ToDouble(KMTxtBox.Text);
            arac.Ucret     = Convert.ToDouble(UcretTxtBox.Text);
            int durum = BLL_Arac.AracGuncelle(arac);

            if (durum == 0 || durum == -1)
            {
                MessageBox.Show("Güncellerken bir hata oluştu.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (durum > 0)
            {
                MessageBox.Show(PlakaLabel.Text + " Plakalı araç başarıyla güncellendi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
Пример #16
0
 private void TumAraclarGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         string aracplaka = TumAraclarGridView.Rows[e.RowIndex].Cells["Plaka"].Value.ToString();
         byte[] resim     = BLL_Arac.AracResimGetir(aracplaka);
         if (resim == null)
         {
             MessageBox.Show("Araç resmi bulunmamaktadır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MemoryStream  mem        = new MemoryStream(resim);
             AracResimForm resimformu = new AracResimForm();
             resimformu.AracResimPictureBox.Image = Image.FromStream(mem);
             resimformu.Text = aracplaka + " - Resim";
             resimformu.ShowDialog();
         }
     }
 }
Пример #17
0
 private void uzatTimePicker_ValueChanged(object sender, EventArgs e)
 {
     if (KiradakilerGridView.CurrentRow.Cells["Uyelik"].Value.ToString() == "Var")
     {
         double   uyeucreti   = BLL_Arac.UyeUcretiGetir(uzatPlakaLabel.Text);
         TimeSpan GunHesapla  = uzatTimePicker.Value - Convert.ToDateTime(UzatBaslangicLabel.Text);
         int      Gun         = Convert.ToInt32(GunHesapla.TotalDays);
         double   Toplamucret = uyeucreti * Gun;
         double   ekucret     = Toplamucret - Convert.ToDouble(uzatOdenenLabel.Text);
         uzatEkUcretLabel.Text = ekucret.ToString();
     }
     else
     {
         double   uyeolmayanucreti = Convert.ToDouble(KiradakilerGridView.CurrentRow.Cells["GunlukUcret"].Value);
         TimeSpan GunHesapla       = uzatTimePicker.Value - Convert.ToDateTime(UzatBaslangicLabel.Text);
         int      Gun         = Convert.ToInt32(GunHesapla.TotalDays);
         double   Toplamucret = uyeolmayanucreti * Gun;
         double   ekucret     = Toplamucret - Convert.ToDouble(uzatOdenenLabel.Text);
         uzatEkUcretLabel.Text = ekucret.ToString();
     }
 }