private void TeslimAlButon_Click(object sender, EventArgs e)
        {
            E_Teslim teslim = new E_Teslim();

            teslim.Plaka    = TeslimPlakaLabel.Text;
            teslim.TakipKod = TeslimTakipLabel.Text;
            teslim.Hasar    = TeslimHasarTxtBox.Text;
            teslim.YeniKM   = Convert.ToDouble(TeslimKMTxtBox.Text);
            int durum = BLL_Teslim.AracTeslimAl(teslim);

            if (durum == -1)
            {
                MessageBox.Show("Araç kilometresi önceki kilometreden küçük olamaz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (durum == 0)
            {
                MessageBox.Show("Teslim alınırken bir sorun oluştu.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(TeslimPlakaLabel.Text + " Plakalı araç başarıyla teslim alındı.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxTemizle();
                TeslimTCLabel.Text         = "-";
                TeslimTakipLabel.Text      = "-";
                TeslimPlakaLabel.Text      = "-";
                TeslimOncekiKMLabel.Text   = "-";
                AracTeslimGroupBox.Enabled = false;
                TeslimAlinanAraclar();
                BitenleriGoster();
                SubemdekiAraclar();
            }
        }
示例#2
0
        public static int AracTeslimAl(E_Teslim teslim)
        {
            SqlCommand komut = null;
            int        donen;

            try
            {
                komut             = new SqlCommand("SP_AracTeslimAl", Baglanti.baglan);
                komut.CommandType = CommandType.StoredProcedure;
                komut.Connection.Open();
                komut.Parameters.AddWithValue("TakipKod", teslim.TakipKod);
                komut.Parameters.AddWithValue("HasarKontrol", teslim.Hasar);
                komut.Parameters.AddWithValue("KM", teslim.YeniKM);
                donen = komut.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Bir hata oluştu.Hata: " + e.ToString(), "Hata");
                donen = 0;
            }
            finally
            {
                Baglanti.baglan.Close();
            }
            return(donen);
        }
        public static int AracTeslimAl(E_Teslim teslim)
        {
            if (teslim.YeniKM > BLL_Arac.AracKMGetir(teslim.Plaka))
            {
                return(F_Teslim.AracTeslimAl(teslim));
            }

            return(-1);
        }