private void BtnYeniKargo_Click(object sender, EventArgs e)
        {
            int          KuryeID       = cbxKuryeler.SelectedIndex + 1;
            Kargo        yeniKargo     = new Kargo(Convert.ToInt32(dgwKargo.CurrentRow.Cells[1].Value), dateTimePicker1.Value);
            KHareketleri guncelHareket = new KHareketleri(Convert.ToInt32(dgwKargo.CurrentRow.Cells[0].Value), Convert.ToInt32(dgwKargo.CurrentRow.Cells[1].Value), KuryeID, tbxDurumGuncel.Text);

            islemler.KargoGuncelle(yeniKargo);
            islemler.KargoHareketGuncelle(guncelHareket);
            islemler.LoadKargoHareket(dgwKargo);
        }
Esempio n. 2
0
        public void KargoGuncelle(Kargo yeniKargo)
        {
            ConnectionControl();
            string     sql     = "UPDATE Kargo SET TeslimTarih=@teslimtarih WHERE KargoID=@kargoID";
            SqlCommand command = new SqlCommand(sql, conn);

            command.Parameters.AddWithValue("kargoID", yeniKargo.KargoID);
            command.Parameters.AddWithValue("teslimtarih", yeniKargo.Teslimtarih);


            command.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 3
0
        public void KargoGuncelle2(Kargo yeniKargo)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("UPDATE Kargo SET AliciID=@aliciID,GondericiID=@gondericiID,KargoturuID=@kargoturuID,TeslimTarih=@teslimtarih,Desi=@desi,Agirlik=@agilik,KimOdeyecek=@kimodeyecek,Ucret=@ucret WHERE KargoID=@kargoID)", conn);

            command.Parameters.AddWithValue("kargoID", yeniKargo.KargoID);
            command.Parameters.AddWithValue("aliciID", yeniKargo.AliciID);
            command.Parameters.AddWithValue("gondericiID", yeniKargo.GondericiID);
            command.Parameters.AddWithValue("kargoturuID", yeniKargo.KargoturuID);
            command.Parameters.AddWithValue("teslimtarih", yeniKargo.Teslimtarih);
            command.Parameters.AddWithValue("desi", yeniKargo.Desi);
            command.Parameters.AddWithValue("agirlik", yeniKargo.Agirlik);
            command.Parameters.AddWithValue("kimodeyecek", yeniKargo.KimOdeyecek);
            command.Parameters.AddWithValue("ucret", yeniKargo.Ucret);

            command.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 4
0
        public List <Kargo> GetKargo()
        {
            ConnectionControl();

            SqlCommand command = new SqlCommand("SELECT * FROM Kargo", conn);

            SqlDataReader reader = command.ExecuteReader();

            List <Kargo> Kargolar = new List <Kargo>();

            while (reader.Read())
            {
                Kargo k = new Kargo(Convert.ToInt32(reader["KargoID"]), Convert.ToInt32(reader["AliciID"]), Convert.ToInt32(reader["GondericiID"]), Convert.ToInt32(reader["KargoTuruID"]), Convert.ToDateTime(reader["TeslimTarih"]), Convert.ToDecimal(reader["Desi"]), Convert.ToDecimal(reader["Agirlik"]), Convert.ToBoolean(reader["KimOdeyecek"]), Convert.ToDecimal(reader["Ucret"]));
                Kargolar.Add(k);
            }

            reader.Close();
            conn.Close();
            return(Kargolar);
        }
Esempio n. 5
0
        //Kargo ve Hareketleri

        public void KargoEkle(Kargo yeniKargo)
        {
            ConnectionControl();
            SqlCommand command = new SqlCommand("INSERT INTO Kargo VALUES (@aliciID,@gondericiID,@kargoturuID,@teslimtarih,@desi,@agirlik,@kimodeyecek,@ucret)", conn);
            DateTime   dt      = new DateTime();

            dt = Convert.ToDateTime("01.01.2000");
            yeniKargo.Teslimtarih = dt;
            command.Parameters.AddWithValue("aliciID", yeniKargo.AliciID);
            command.Parameters.AddWithValue("gondericiID", yeniKargo.GondericiID);
            command.Parameters.AddWithValue("kargoturuID", yeniKargo.KargoturuID);
            command.Parameters.AddWithValue("teslimtarih", yeniKargo.Teslimtarih);
            command.Parameters.AddWithValue("desi", yeniKargo.Desi);
            command.Parameters.AddWithValue("agirlik", yeniKargo.Agirlik);
            command.Parameters.AddWithValue("kimodeyecek", yeniKargo.KimOdeyecek);
            command.Parameters.AddWithValue("ucret", yeniKargo.Ucret);

            command.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 6
0
        private void BtnYeniKargo_Click(object sender, EventArgs e)
        {
            bool secim = true;

            if (rbcGonderici.Checked == true)
            {
                secim = true;
            }

            else if (rdbAlici.Checked == true)
            {
                secim = false;
            }

            Kargo yeniKargo = new Kargo(Convert.ToInt32(lblAliciID.Text), Convert.ToInt32(lblGondericiID.Text), Convert.ToInt32(lblKargoTuruID.Text), Convert.ToDecimal(tbxDesi.Text), Convert.ToDecimal(tbxAgirlik.Text), secim, Convert.ToDecimal(tbxUcret.Text));

            islemler.KargoEkle(yeniKargo);

            KHareketleri yeniHareket = new KHareketleri(islemler.SonKargoIDAl(), islemler.RastgeleKuryeIDAl(), "Kargo oluştu");

            islemler.KargoHareketEkle(yeniHareket);
        }