Example #1
0
        public IActionResult Create(urun urun, IFormFile photo)
        {
            urun.eklemetarihi = DateTime.Now;
            if (photo != null)
            {
                var path   = Path.Combine(_environment.WebRootPath, "images", photo.FileName);
                var stream = new FileStream(path, FileMode.Create);
                photo.CopyTo(stream);
                resim pht = new resim()
                {
                    resimAdi = photo.FileName,
                    urunId   = urun.urunId
                };
                //urunRepo.saveImage(pht);
                urun.Resimyolu = photo.FileName;
                ViewBag.photo  = photo.FileName;
            }


            urunRepo.Save(urun);
            return(RedirectToAction("Index", "urun"));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request["Id"].ToString()))
            {
                int id = Convert.ToInt32(Request["Id"].ToString());

                urun duzenle = urun.Select(id);

                adiTextBox.Text = duzenle.Adi;

                Image1.ImageUrl = duzenle.Resim;
                //DropDownList2.SelectedValue = duzenle.FkKategori.ToString();


                //ListView1.DataSource = urunTablo.SelectByFkUrun(id);
                //ListView1.DataBind();
                int id2 = Convert.ToInt32(Request["Id"].ToString());

                Session.Add("urunid", id2);
            }
        }
    }
 public void urunEkle(urun u)
 {
     urunler.Insert(u);
 }
Example #4
0
        //sql den verileri almak için
        private void Satis_Load(object sender, EventArgs e)
        {
            //combobox1 a sql den veri çekme -->personel
            SqlCommand md1 = new SqlCommand();

            md1.CommandText = "Select *from Employees";
            md1.Connection  = Baglanti;
            md1.CommandType = CommandType.Text;
            SqlDataReader dr1;

            Baglanti.Open();
            dr1 = md1.ExecuteReader();

            while (dr1.Read())
            {
                personel item = new personel();
                item.ID1   = int.Parse(dr1["EmployeeID"].ToString());
                item.Ad    = dr1["Ad"].ToString();
                item.Soyad = dr1["Soyad"].ToString();

                comboBox1.Items.Add(item);
            }
            Baglanti.Close();

            //ComboBox2 a sql den veri çekme --->müşteri

            SqlCommand md2 = new SqlCommand();

            md2.CommandText = "Select *from Customers";
            md2.Connection  = Baglanti;
            md2.CommandType = CommandType.Text;
            SqlDataReader dr2;

            Baglanti.Open();
            dr2 = md2.ExecuteReader();

            while (dr2.Read())
            {
                musteri item = new musteri();
                item.ID2       = int.Parse(dr2["CustomerID"].ToString());
                item.FirstName = dr2["FirstName"].ToString();
                item.LastName  = dr2["LastName"].ToString();

                comboBox2.Items.Add(item);
            }
            Baglanti.Close();


            //ComboBox3 a sql den veri çekme --->ürün

            SqlCommand md3 = new SqlCommand();

            md3.CommandText = "Select *from Products";
            md3.Connection  = Baglanti;
            md3.CommandType = CommandType.Text;
            SqlDataReader dr3;

            Baglanti.Open();
            dr3 = md3.ExecuteReader();

            while (dr3.Read())
            {
                urun item = new urun();
                item.ID3   = int.Parse(dr3["ProductID"].ToString());
                item.UName = dr3["Name"].ToString();

                //ürün adeti yazdırmak için
                item.Adet = int.Parse(dr3["Quantity"].ToString());

                comboBox3.Items.Add(item);
            }
            Baglanti.Close();
        }
Example #5
0
 internal void urunGuncelle(urun u)
 {
     (new MySqlCommand("UPDATE urun set urunAdi='" + u.UrunAdi + "',urunFiyat='" + u.UrunFiyat + "',urunBarkod='" + u.UrunSeriNo + "',urunResim='" + u.UrunResim + "' WHERE(urunID = '" + u.UrunId + "')", (new dbBaglan()).baglantiGetir())).ExecuteNonQuery();
 }
Example #6
0
 internal void urunKaydet(urun u)
 {
     (new MySqlCommand("INSERT INTO urun (urunAdi,urunFiyat,urunBarkod,urunResim) VALUES ('" + u.UrunAdi + "','" + u.UrunFiyat + "','" + u.UrunSeriNo + "','" + u.UrunResim + "')", (new dbBaglan()).baglantiGetir())).ExecuteNonQuery();
 }
Example #7
0
 public ActionResult UrunEkle(urun entity)
 {
     return(View(entity));
 }
Example #8
0
        static void Main(string[] args)
        {
            //string adi = "Tufna ";
            //int yas = 27;

            //Kurs kurs1 = new Kurs()  ;
            //kurs1.Egitmen = "Rngin";
            //kurs1.IzlenmeOrani = 68;
            //kurs1.Kursadi = "c#";



            //Kurs kurs2 = new Kurs();
            //kurs1.Egitmen = "Rngin";
            //kurs1.IzlenmeOrani = 68;
            //kurs1.Kursadi = "Java#";

            //Kurs kurs3 = new Kurs();
            //kurs1.Egitmen = "Engin";
            //kurs1.IzlenmeOrani = 68;
            //kurs1.Kursadi = "python#";


            //Kurs[] Kurslar = new Kurs[] {kurs1, kurs2, kurs3 };


            //foreach (var k in Kurslar)
            //{
            //    Console.WriteLine(k.Kursadi);
            //}


            //string urunadi = "Botlar";
            //int urunayakno = 43;
            //string urunrenk = "siyah";

            urun urun1 = new urun();

            urun1.urunadi    = "yuksek bot";
            urun1.urunayakno = 44;
            urun1.urunrenk   = "siyah";

            urun urun2 = new urun();

            urun2.urunadi    = "düsük bot";
            urun2.urunayakno = 45;
            urun2.urunrenk   = "turuncu";

            urun urun3 = new urun();

            urun3.urunadi    = "çizgili bot";
            urun3.urunayakno = 40;
            urun3.urunrenk   = "bordo";

            urun[] bot = new urun[] { urun1, urun2, urun3 };

            Console.WriteLine("***********************for*************");
            for (int i = 0; i < bot.Length; i++)
            {
                Console.WriteLine("Ürün İsim : " + bot[i].urunadi + " \n", "Ayakkabı Numarası : " + bot[i].urunayakno + "\n", "Renk : " + bot[i].urunrenk + "\n");
            }

            Console.WriteLine("***********************foreach*************");
            foreach (var botlar in bot)
            {
                Console.WriteLine(botlar.urunadi, botlar.urunayakno, botlar.urunrenk);
            }
            Console.WriteLine("***********************while*************");
            int sayi = 1;

            while (sayi <= bot.Length)
            {
                Console.WriteLine("Ürün İsim : " + bot[sayi].urunadi + " \n", "Ayakkabı Numarası : " + bot[sayi].urunayakno + "\n", "Renk : " + bot[sayi].urunrenk + "\n");
                sayi++;
            }
            Console.ReadLine();
        }
Example #9
0
 internal void urunSil(urun urun)
 {
     (new MySqlCommand("delete from urunler where idurunler= " + urun.Id, (new dbBaglanti()).baglantiGetir())).ExecuteNonQuery();
 }
Example #10
0
 internal void urunKaydet(urun urun)
 {
     (new MySqlCommand("insert into urunler(urunad)values('" + urun.Ad + "')", (new dbBaglanti()).baglantiGetir())).ExecuteNonQuery();
 }
Example #11
0
 public IActionResult edit(urun urun)
 {
     urunRepo.Update(urun);
     return(RedirectToAction("Index"));
 }