public ActionResult Edit(int id, urunler urun, HttpPostedFileBase resim)
        {
            ViewBag.kategoriID = new SelectList(db.kategorilers, "kategoriID", "kategoriAdi", urun.kategoriID);

            var urun1 = db.urunlers.Where(u => u.urunID == id).SingleOrDefault();

            if (resim != null)
            {
                if (System.IO.File.Exists(Server.MapPath(urun1.resim)))
                {
                    System.IO.File.Delete(Server.MapPath(urun1.resim));
                }

                WebImage img = new WebImage(resim.InputStream);

                FileInfo resiminfo = new FileInfo(resim.FileName);

                string newfoto = Guid.NewGuid().ToString() + resiminfo.Extension;
                img.Resize(800, 350);
                img.Save("~/Uploads/urunler/" + newfoto);
                urun1.resim      = "/Uploads/urunler/" + newfoto;
                urun1.urunAdi    = urun.urunAdi;
                urun1.urunİcerik = urun.urunİcerik;
                urun1.kategoriID = urun.kategoriID;
                urun1.tarih      = urun.tarih;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }



            return(View(urun));
        }
예제 #2
0
        public ActionResult UrunOnay(string urun_id, string miktar, string k_id, string urun, string fiyat, string onay)
        {                                        //admin onaylamak itediğinde
            int u_id = Convert.ToInt32(urun_id); //ürün ekleyen kişinin id si

            if (onay == "1")                     //admin ürün eklemeyi onayladı ise
            {
                urunler urun1 = new urunler()    //ürün oluşturuluyor
                {
                    u_id   = u_id,
                    k_id   = Convert.ToInt32(k_id),
                    miktar = Convert.ToInt32(miktar),
                    fiyat  = Convert.ToInt32(fiyat),
                    urun   = urun
                };
                db.urunler.Add(urun1);//ürün ekleniyor

                var b = db.ourunler.FirstOrDefault(x => x.urun_id == u_id);
                db.ourunler.Remove(b);//ürün ekleme isteği siliniyor
                db.SaveChanges();

                OtoSatis();// ürün eklendiğinde sipariş veren kişi var ise satış yapılıypr
            }
            else//admin ürün eklemeyi onaylamadı ise
            {
                var b = db.ourunler.FirstOrDefault(x => x.urun_id == u_id);
                db.ourunler.Remove(b);//ürün ekleme isyeği siliniyor
                db.SaveChanges();
            }

            return(Redirect("Urunler"));
        }
        public ActionResult Create(urunler urun, HttpPostedFileBase resim)
        {
            ViewBag.kategoriID  = new SelectList(db.kategorilers, "kategoriID", "kategoriAdi");
            ViewBag.kullaniciID = new SelectList(db.kullanicilars, "kullaniciID", "adsoyad");
            ViewBag.memleketID  = new SelectList(db.memlekets, "memleketID", "memleketAdi");
            if (ModelState.IsValid)
            {
                if (resim != null)
                {
                    WebImage img = new WebImage(resim.InputStream);

                    FileInfo resiminfo = new FileInfo(resim.FileName);

                    string newfoto = Guid.NewGuid().ToString() + resiminfo.Extension;
                    img.Resize(800, 350);
                    img.Save("~/Uploads/urunler/" + newfoto);
                    urun.resim = "/Uploads/urunler/" + newfoto;
                }


                db.urunlers.Add(urun);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(urun));
        }
        public ActionResult Urun_ekle(FormCollection collection, HttpPostedFileBase imageFile)
        {
            if (imageFile != null && imageFile.ContentLength > 0)
            {
                if (imageFile.ContentType == "image/jpeg" || imageFile.ContentType == "image/png")
                {
                    myfuctions func      = new myfuctions();
                    string     imageName = System.IO.Path.GetFileNameWithoutExtension(imageFile.FileName);
                    imageName = func.sameNameImageChange(imageName);

                    string path = System.IO.Path.Combine(Server.MapPath("~/Assets/uploads/products_img"), imageName + ".jpg");
                    imageFile.SaveAs(path);

                    var urunModel = new urunler();
                    urunModel.resim         = imageName + ".jpg";
                    urunModel.adi           = collection["adi"];
                    urunModel.stok          = 1;
                    urunModel.taban_fiyati  = Convert.ToDecimal(collection["taban_fiyati"]);
                    urunModel.tavan_fiyati  = Convert.ToDecimal(collection["tavan_fiyati"]);
                    urunModel.kategori_id   = Convert.ToInt32(collection["kategori"]);
                    urunModel.durum         = "Pasif";
                    urunModel.description   = collection["description"];
                    urunModel.keywords      = collection["keywords"];
                    urunModel.aciklama      = collection["aciklama"];
                    urunModel.tarih         = DateTime.Now;
                    urunModel.uye_id        = Convert.ToInt32(Session["uye_id"]);
                    urunModel.yayin_durumu  = "Hayır";
                    urunModel.teklif_durumu = "Hayır";
                    urunModel.onay_durumu   = "Hayır";

                    projeEntities1 db = new projeEntities1();
                    db.urunler.Add(urunModel);
                    db.SaveChanges();

                    /* Yeni Sistem
                     * int last_id = db.urunler.Max(x => x.id);
                     * var kargoModel = new kargolar();
                     * kargoModel.tur = "Alınan";
                     * kargoModel.durum = "Ürün Onayı Bekleniyor";
                     * kargoModel.tarih = DateTime.Now;
                     * kargoModel.uye_id = Convert.ToInt32(Session["uye_id"]);
                     * kargoModel.urun_id = last_id;
                     * db.kargolar.Add(kargoModel);
                     * db.SaveChanges();
                     */

                    TempData["UrunEklemeSonucu"] = collection["adi"] + " adlı ürünü eklediniz.";

                    return(RedirectToAction("Urun_ekle_sonuc", "Hesabim"));
                }
                else
                {
                    TempData["ResimTuruHata"] = "Sadece jpeg ve png türündeki resimleri yükleyebilirsiniz";
                    return(RedirectToAction("Urun_ekle", "Hesabim"));
                }
            }

            return(RedirectToAction("Urun_ekle", "Hesabim"));
        }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            urunler urunler = db.urunlers.Find(id);

            db.urunlers.Remove(urunler);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
        public ActionResult UrunEkle(urunler p1)
        {
            var ktr = db.kategoriler.Where(m => m.kategoriid == p1.kategoriler.kategoriid).FirstOrDefault();

            p1.kategoriler = ktr;
            db.urunler.Add(p1);
            db.SaveChanges();
            return(RedirectToAction("index"));
        }
        public ActionResult Create(urunler newProduct)
        {
            var category = dbstokEntities.kategoriler.Where(x => x.KategoriId == newProduct.kategoriler.KategoriId).FirstOrDefault();

            newProduct.kategoriler = category;
            dbstokEntities.urunler.Add(newProduct);
            dbstokEntities.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #8
0
 public ActionResult YeniUrun(urunler ekle)
 {
     if (!ModelState.IsValid)
     {
         return(View("YeniUrun"));
     }
     db.urunlers.Add(ekle);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #9
0
        public ActionResult Guncelle(urunler p1)
        {
            var urun = db.urunlers.Find(p1.urunid);

            urun.urunkodu   = p1.urunkodu;
            urun.urunadi    = p1.urunadi;
            urun.urundegeri = p1.urundegeri;
            urun.urunkilifi = p1.urunkilifi;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #10
0
        static void Main(string[] args)
        {
            urunler urun1 = new urunler();

            urun1.urunAd    = "Masaüstü Bilgisayar";
            urun1.urunFiyat = 3500;
            urun1.urunResmi = "1. Ürün Resmi";

            urunler urun2 = new urunler();

            urun2.urunAd    = "Dizüstü Bilgisayar";
            urun2.urunFiyat = 6500;
            urun2.urunResmi = "2. Ürün Resmi";

            urunler urun3 = new urunler();

            urun3.urunAd    = "Tablet";
            urun3.urunFiyat = 1500;
            urun3.urunResmi = "3. Ürün Resmi";

            urunler[] urunListe = { urun1, urun2, urun3 };

            Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
            Console.WriteLine("------------------------------------");

            for (int i = 0; i < urunListe.Length; i++)
            {
                Console.WriteLine("Ürün : " + urunListe[i].urunAd + " " + "Fiyatı : " + urunListe[i].urunFiyat + " " + urunListe[i].urunResmi);
            }

            Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
            Console.WriteLine("------------------------------------");

            foreach (urunler liste in urunListe)
            {
                Console.WriteLine("Ürün : " + liste.urunAd + " " + "Fiyatı: " + liste.urunFiyat + " " + liste.urunResmi);
            }

            Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
            Console.WriteLine("------------------------------------");

            int x = 0;

            while (x < urunListe.Length)
            {
                Console.WriteLine("Ürün : " + urunListe[x].urunAd + " " + "Fiyatı: " + urunListe[x].urunFiyat + " " + urunListe[x].urunResmi);
                x++;
            }

            Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
            Console.WriteLine("------------------------------------");
        }
예제 #11
0
        static void Main(string[] args)

        {
            urunler urunler1 = new urunler();

            urunler1.urunadi    = "Bilgisayar";
            urunler1.urunfiyati = 30;

            urunler urunler2 = new urunler();

            urunler2.urunadi    = "Tablet";
            urunler2.urunfiyati = 20;

            urunler urunler3 = new urunler();

            urunler3.urunadi    = "Telefon";
            urunler3.urunfiyati = 10;


            urunler[] urunlerabc = new urunler[] { urunler1, urunler2, urunler3 };
            //for
            Console.WriteLine("for");
            for (int i = 0; i < urunlerabc.Length; i++)
            {
                Console.WriteLine(urunlerabc[i].urunadi + " : " + urunlerabc[i].urunfiyati);
            }

            Console.WriteLine("foreach");
            //foreach
            foreach (var urunler in urunlerabc)
            {
                Console.WriteLine(urunler.urunadi + " : " + urunler.urunfiyati);
            }

            Console.WriteLine("while");

            //while

            int y = 0;

            while (y < urunlerabc.Length)
            {
                ;
            }
            {
                Console.WriteLine(urunlerabc[y].urunadi);
                Console.WriteLine(urunlerabc[y].urunfiyati);

                int i = y++;
            }
        }
예제 #12
0
        public ActionResult UrunSil(int urunID)
        {
            urunler  urun  = entities.urunler.FirstOrDefault(x => x.urun_id == urunID);
            resimler resim = entities.resimler.FirstOrDefault(x => x.urun_id == urunID);

            entities.urunler.Remove(urun);
            if (resim != null)
            {
                entities.resimler.Remove(resim);
            }

            entities.SaveChanges();
            return(RedirectToAction("Urunler"));
        }
        public ActionResult Update(urunler product)
        {
            var category      = dbstokEntities.kategoriler.Where(x => x.KategoriId == product.kategoriler.KategoriId).FirstOrDefault();
            var updateProduct = dbstokEntities.urunler.Find(product.UrunId);

            updateProduct.UrunAd       = product.UrunAd;
            updateProduct.Marka        = product.Marka;
            updateProduct.UrunKategori = category.KategoriId;
            updateProduct.Fiyat        = product.Fiyat;
            updateProduct.Stok         = product.Stok;
            dbstokEntities.SaveChanges();

            return(RedirectToAction("Index"));
        }
        // GET: AdminUrun/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            urunler urun = db.urunlers.Find(id);

            if (urun == null)
            {
                return(HttpNotFound());
            }
            return(View(urun));
        }
        public ActionResult Kaydet(urunler gelenUrun)
        {
            using (kahve2019Entities db = new kahve2019Entities())
            {
                if (!ModelState.IsValid) //formun doğru dolduruludu mu?
                {
                    return(View("UrunForm", gelenUrun));
                }

                if (gelenUrun.id == 0)//Yeni ürün kaydı
                {
                    if (gelenUrun.fotoFile == null)
                    {
                        ViewBag.HataFoto = "Lütfen Resim Yükleyin";
                        return(View("UrunForm", gelenUrun));
                    }
                    string fotoAdi = Turkce.DosyaAdiDuzenle(gelenUrun.fotoFile.FileName);

                    gelenUrun.foto = fotoAdi;
                    db.urunler.Add(gelenUrun);
                    gelenUrun.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(fotoAdi)));
                    TempData["urunEkle"] = "ekle";
                }
                else  //Güncelleme
                {
                    var GuncellenecekVeri = db.urunler.Find(gelenUrun.id);
                    if (!ModelState.IsValid)
                    {
                        return(View("UrunForm", gelenUrun));
                    }

                    if (gelenUrun.fotoFile != null)
                    {
                        string fotoAdi = Turkce.DosyaAdiDuzenle(gelenUrun.fotoFile.FileName);

                        gelenUrun.foto = fotoAdi;
                        //kaydetme
                        gelenUrun.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(fotoAdi)));
                    }

                    //güncelleme
                    db.Entry(GuncellenecekVeri).CurrentValues.SetValues(gelenUrun);
                    TempData["urunGuncelle"] = "güncelleme";
                }

                db.SaveChanges();
                return(RedirectToAction("/index"));
            }
        }
예제 #16
0
        public ActionResult KategoriSil(int kategoriID)
        {
            urunler urun = entities.urunler.FirstOrDefault(x => x.kategori_id == kategoriID);

            if (urun == null)
            {
                kategoriler kategori = entities.kategoriler.FirstOrDefault(x => x.kategori_id == kategoriID);
                entities.kategoriler.Remove(kategori);
                entities.SaveChanges();
            }
            else if (urun != null)
            {
                Session["kategorihata"] = "Lütfen Önce Kategoriye Ait Ürünleri Siliniz.";
            }
            return(RedirectToAction("Kategoriler"));
        }
        public ActionResult Edit(int id, HttpPostedFileBase Foto, urunler urun)
        {
            try
            {
                // TODO: Add update logic here
                var uruns = db.urunlers.Where(u => u.urunId == id).SingleOrDefault();
                if (Foto != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(uruns.foto)))
                    {
                        System.IO.File.Delete(Server.MapPath(uruns.foto));
                    }
                    WebImage img      = new WebImage(Foto.InputStream);
                    FileInfo fotoinfo = new FileInfo(Foto.FileName);

                    string newfoto = Guid.NewGuid().ToString() + fotoinfo.Extension;
                    img.Resize(700, 400);
                    img.Save("~/Uploads/UrunFoto/" + newfoto);
                    uruns.foto       = "/Uploads/UrunFoto/" + newfoto;
                    uruns.urunAdi    = urun.urunAdi;
                    uruns.icerik     = urun.icerik;
                    uruns.kategoriId = urun.kategoriId;

                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    uruns.urunAdi    = urun.urunAdi;
                    uruns.icerik     = urun.icerik;
                    uruns.kategoriId = urun.kategoriId;

                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                //return View();
            }
            catch
            {
                ViewBag.kategoriId = new SelectList(db.kategoris, "kategoriId", "kategoriAdi", urun.kategoriId);
                return(View(urun));
            }
        }
예제 #18
0
        public ActionResult ekle(FormCollection frmgelen, HttpPostedFileBase resim)
        {
            if (resim != null)
            {
                String dosyayolu = Path.Combine(Server.MapPath("~/arayuz/urunres"),
                                                Path.GetFileName(resim.FileName));
                resim.SaveAs(dosyayolu);

                urunler yeniurun = new urunler();
                yeniurun.urun_adi = frmgelen["vurunad"];
                yeniurun.resimadi = resim.FileName;
                yeniurun.katid    = 2;

                db.urunler.Add(yeniurun);
                db.SaveChanges();
            }

            return(View());
        }
예제 #19
0
        public ActionResult Kaydet(urunler gelenUrun)
        {
            if (!ModelState.IsValid)
            {
                return(View("urunForm", gelenUrun));
            }

            using (site2020Entities db = new site2020Entities())
            {
                if (gelenUrun.id == 0)//yeni ürün
                {
                    if (gelenUrun.fotoFile == null)
                    {
                        ViewBag.HataFoto = "Lütfen Fotograf Yükleyiniz.";
                        return(View("urunForm", gelenUrun));
                    }
                    string fotoAdi = Seo.DosyaAdiDuzenle(gelenUrun.fotoFile.FileName);
                    gelenUrun.foto = fotoAdi;
                    db.urunler.Add(gelenUrun);
                    gelenUrun.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(gelenUrun.foto)));
                    TempData["urun"] = "Ürün Başarılı bir şekilde eklendi.";
                }
                else//guncelleme
                {
                    var guncellenecekVeri = db.urunler.Find(gelenUrun.id);
                    if (gelenUrun.fotoFile != null)
                    {
                        string fotoAdi = Seo.DosyaAdiDuzenle(gelenUrun.fotoFile.FileName);
                        gelenUrun.foto = fotoAdi;
                        gelenUrun.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(gelenUrun.foto)));
                    }

                    db.Entry(guncellenecekVeri).CurrentValues.SetValues(gelenUrun);
                    TempData["urun"] = "Ürün başarılı bir şekilde güncellendi.";
                }
                db.SaveChanges();

                return(RedirectToAction("index"));
            }
        }
예제 #20
0
 public ActionResult Urunler(urunler urun)
 {
     if (Session["guncelle"] != null)
     {
         var varOlanUrun = (from nesne in veri.urunler where nesne.urunid == urun.urunid select nesne).FirstOrDefault();
         varOlanUrun.urunad       = urun.urunad;
         varOlanUrun.urunfiyat    = urun.urunfiyat;
         varOlanUrun.urunkategori = urun.urunkategori;
         varOlanUrun.urunozellik  = urun.urunozellik;
         if (urun.urunresim != null)
         {
             varOlanUrun.urunresim = urun.urunresim;
         }
         varOlanUrun.urunstokadet = urun.urunstokadet;
         veri.SaveChanges();
         Session["guncelle"] = null;
     }
     else
     {
         veri.urunler.Add(urun);
         veri.SaveChanges();
     }
     return(RedirectToAction("UrunListele"));
 }
        public ActionResult Create(urunler urun, HttpPostedFileBase Foto)
        {
            try
            {
                // TODO: Add insert logic here
                if (Foto != null)
                {
                    WebImage img      = new WebImage(Foto.InputStream);
                    FileInfo fotoinfo = new FileInfo(Foto.FileName);

                    string newfoto = Guid.NewGuid().ToString() + fotoinfo.Extension;
                    img.Resize(700, 400);
                    img.Save("~/Uploads/UrunFoto/" + newfoto);
                    urun.foto = "/Uploads/UrunFoto/" + newfoto;
                }
                db.urunlers.Add(urun);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(urun));
            }
        }
        public ActionResult Yeni()
        {
            var model = new urunler();

            return(View("UrunForm", model));
        }
        public void YeniUrunEkle(UrunEkleViewModel model)
        {
            Random  rnd     = new Random();
            urunler dbModel = new urunler();

            dbModel.UrunKategoriID = model.UrunKategoriID;
            dbModel.UrunKodu       = model.UrunKodu;
            dbModel.UrunAdi        = model.UrunAdi;


            //Ürünün Ana Görseli için
            if (model.UrunResmi != null && model.UrunResmi.ContentLength > 0)
            {
                int    rasgele = rnd.Next(999, 9999999);
                string gelen_resim_uzantisi = model.UrunResmi.FileName.Substring(model.UrunResmi.FileName.Length - 3);
                if (gelen_resim_uzantisi == "png" || gelen_resim_uzantisi == "jpg" || gelen_resim_uzantisi == "jpeg" || gelen_resim_uzantisi == "gif")
                {
                    model.UrunResmi.SaveAs(Server.MapPath("~/Uploads/Products/" + rasgele + "." + gelen_resim_uzantisi));
                    dbModel.UrunResmi = rasgele + "." + gelen_resim_uzantisi;
                }
            }
            else
            {
                dbModel.UrunResmi = "default";
            }

            //Ürünün diğer görselleri için
            string coklu_resimler = "";

            if (model.UrunResimleri.Length > 1)
            {
                foreach (var file in model.UrunResimleri)
                {
                    int    rasgele = rnd.Next(100, 999999);
                    string gelen_resim_uzantisi = file.FileName.Substring(file.FileName.Length - 3);
                    if (gelen_resim_uzantisi == "png" || gelen_resim_uzantisi == "jpg" || gelen_resim_uzantisi == "jpeg" || gelen_resim_uzantisi == "gif")
                    {
                        file.SaveAs(Server.MapPath("~/Uploads/Products/" + rasgele + "." + gelen_resim_uzantisi));
                        coklu_resimler += rasgele + "." + gelen_resim_uzantisi + ",";
                    }
                }
            }
            else
            {
                coklu_resimler += "default";
            }
            dbModel.UrunResimleri  = coklu_resimler;
            dbModel.UrunAciklamasi = model.UrunAciklamasi;
            dbModel.UrunEtiketleri = model.UrunEtiketleri;
            dbModel.UrunFiyati     = model.UrunFiyati;
            dbModel.UrunStokAdeti  = model.UrunStokAdeti;

            if (model.UrunOnayi == true)
            {
                dbModel.UrunOnayi = "1";
            }
            else
            {
                dbModel.UrunOnayi = "0";
            }

            db.urunler.Add(dbModel);
            db.SaveChanges();
            Response.Redirect("~/UyeUrunYonetimi/Index");
        }
        public void UrunGuncelle(FormCollection form)
        {
            try
            {
                int    urunID         = int.Parse(form["ProductID"].ToString());
                string urunKodu       = form["UrunKodu"].ToString();
                string urunAdi        = form["UrunAdi"].ToString();
                string kategoriID     = form["Kategori"].ToString();
                string urunStokAdeti  = form["UrunStokAdeti"].ToString();
                string urunFiyati     = form["UrunFiyati"].ToString();
                string urunAciklamasi = form["UrunAciklamasi"].ToString();
                string urunEtiketleri = form["UrunEtiketleri"].ToString();
                string urunOnayi      = "";
                if (form["UrunOnayi"] != null)
                {
                    urunOnayi = "1";
                }
                else
                {
                    urunOnayi = "0";
                }

                //Ana resimdeki değişimi algıla
                string guncellenecek_ana_resim = "";
                string mevcut_ana_resim        = form["mevcut_ana_resim"].Trim().ToString();
                if (form["yeni_ana_resim"] != null)
                {
                    string secilen_ana_resim = form["yeni_ana_resim"].Trim().ToString();
                    guncellenecek_ana_resim = secilen_ana_resim;
                }
                else
                {
                    guncellenecek_ana_resim = mevcut_ana_resim;
                }
                //Ana resim işlemi bitti

                //Multi resim işlemleri
                string guncellenecek_multi_resimler = "";
                if (form["resimler"] != null)
                {
                    int mevcut_multi_resimler = form["resimler"].Length;
                    foreach (var val in form["resimler"])
                    {
                        guncellenecek_multi_resimler += val.ToString();
                    }
                }
                else
                {
                    guncellenecek_multi_resimler = "default";
                }
                if (form["yeni_secilen_coklu_resimler"] != null)
                {
                    guncellenecek_multi_resimler += ",";
                    foreach (var item in form["yeni_secilen_coklu_resimler"])
                    {
                        guncellenecek_multi_resimler += item;
                    }
                }
                //Multi resim işlemleri bitti

                urunler urun = db.urunler.FirstOrDefault(m => m.id == urunID);
                if (urun != null)
                {
                    urun.UrunKategoriID = kategoriID;
                    urun.UrunKodu       = urunKodu;
                    urun.UrunAdi        = urunAdi;
                    urun.UrunResmi      = guncellenecek_ana_resim;
                    urun.UrunResimleri  = guncellenecek_multi_resimler;
                    urun.UrunAciklamasi = urunAciklamasi;
                    urun.UrunEtiketleri = urunEtiketleri;
                    urun.UrunFiyati     = urunFiyati;
                    urun.UrunStokAdeti  = urunStokAdeti;
                    urun.UrunOnayi      = urunOnayi;
                    db.SaveChanges();
                    Response.Redirect("~/UyeUrunYonetimi?state=success");
                }
                else
                {
                    Response.Redirect("~/UyeUrunYonetimi?state=urun_yok");
                }
            }
            catch (FormatException)
            {
                Response.Redirect("~/UyeUrunYonetimi?state=islem_uygun_degil");
            }
        }
        public void YeniUrunEkleTest(FormCollection form)
        {
            string urunKodu       = form["UrunKodu"].ToString();
            string urunAdi        = form["UrunAdi"].ToString();
            string kategoriID     = form["UrunKategoriID"].ToString();
            string urunStokAdeti  = form["UrunStokAdeti"].ToString();
            string urunFiyati     = form["UrunFiyati"].ToString();
            string urunAciklamasi = form["UrunAciklamasi"].ToString();
            string urunEtiketleri = form["UrunEtiketleri"].ToString();
            string urunOnayi      = "";

            if (form["UrunOnayi"] != null)
            {
                urunOnayi = "1";
            }
            else
            {
                urunOnayi = "0";
            }
            //Ana resim işlemi
            string ana_resim = "";

            if (form["ana_resim"] != null)
            {
                ana_resim = form["ana_resim"].ToString();
            }
            else
            {
                ana_resim = "default";
            }
            //Ana resim işlemi sonu

            //Çoklu ürün resim işlemleri
            string secilen_resimler = "";

            if (form["secilen_coklu_resimler"] != null)
            {
                foreach (var item in form["secilen_coklu_resimler"])
                {
                    secilen_resimler += item;
                }
            }
            else
            {
                secilen_resimler = "default";
            }
            //Çoklu ürün resim işlemleri sonu
            urunler dbModel = new urunler();

            dbModel.UrunKategoriID = kategoriID;
            dbModel.UrunKodu       = urunKodu;
            dbModel.UrunAdi        = urunAdi;
            dbModel.UrunResmi      = ana_resim;
            dbModel.UrunResimleri  = secilen_resimler;
            dbModel.UrunAciklamasi = urunAciklamasi;
            dbModel.UrunEtiketleri = urunEtiketleri;
            dbModel.UrunFiyati     = urunFiyati;
            dbModel.UrunStokAdeti  = urunStokAdeti;
            dbModel.UrunOnayi      = urunOnayi;
            db.urunler.Add(dbModel);
            db.SaveChanges();
            Response.Redirect("~/UyeUrunYonetimi?state=success");
        }
예제 #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (HttpContext.Current.Session["Sepet"] != null)
            {
                DataTable dt = new DataTable();
                dt = (DataTable)HttpContext.Current.Session["Sepet"];
                List <urunler> urunList = new List <urunler>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int      deneme      = Convert.ToInt16(dt.Rows[i]["UrunId"]);
                    DateTime tarih       = Convert.ToDateTime(dt.Rows[i]["tarih"]);
                    int      toplamfiyat = Convert.ToInt32(dt.Rows[i]["toplamfiyat"]);
                    int      adetmiktari = Convert.ToInt32(dt.Rows[i]["adet"]);
                    var      sorgu       = (from o in bd.Urunler
                                            where (o.urun_id == deneme)
                                            select new
                    {
                        o.resim,
                        o.urunismi,
                        adetmiktari,
                        o.fiyat,
                        o.urun_id,
                        tarih,
                        toplamfiyat,
                    }).FirstOrDefault();

                    urunler urun = new urunler();
                    urun.fiyat       = sorgu.fiyat.Value;
                    urun.resim       = sorgu.resim;
                    urun.urunismi    = sorgu.urunismi;
                    urun.urun_adet   = adetmiktari;
                    urun.urun_id     = sorgu.urun_id;
                    urun.tarih       = tarih;
                    urun.toplamfiyat = toplamfiyat;

                    urunList.Add(urun);
                }
                Repeater1.DataSource = urunList;
                Repeater1.DataBind();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Topla       = Topla + Convert.ToInt32(dt.Rows[i]["toplamfiyat"]);
                    Label1.Text = Topla.ToString() + " " + "$";
                }
            }
            else
            {
                Label1.Text = "0 $";
            }
        }


        DataTable dy = new DataTable();

        dy = (DataTable)HttpContext.Current.Session["Sepet"];

        if (dy.Rows.Count == 0)
        {
            Label1.Text = "0 $";
            HttpContext.Current.Session.Remove("Sepet");
        }
    }
예제 #27
0
        private void b_urunler_Click(object sender, EventArgs e)
        {
            urunler nsn = new urunler();

            nsn.ShowDialog();
        }
예제 #28
0
 public ActionResult UrunEkle(urunler urunler)
 {
     entities.urunler.Add(urunler);
     entities.SaveChanges();
     return(RedirectToAction("Urunler"));
 }
예제 #29
0
        private void menu_buton_Click(object sender, EventArgs e)
        {
            string isim = "";
            int    buton_no;

            BunifuFlatButton genel = (sender as BunifuFlatButton);

            isim     = genel.Name;
            buton_no = Convert.ToInt16(isim.Substring(4, 2));

            footer_metin_bilgileri();

            if (buton_no == 1)
            {
                //Sakın Silme !!
                //pl_icerik.Controls.Clear();
                //pl_icerik.Controls.Add(pl_nelervar);

                //pl_nelervar.Location = new Point(
                // pl_icerik.ClientSize.Width / 2 - pl_nelervar.Size.Width / 2,
                //pl_icerik.ClientSize.Height / 2 - pl_nelervar.Size.Height / 2);
                //pl_nelervar.Anchor = AnchorStyles.None;

                //pl_nelervar.Controls.Clear();//formun içini temizliyoruz..
                //neler_sunuyoruz newForm = new neler_sunuyoruz();
                //newForm.TopLevel = false;
                //pl_nelervar.Controls.Add(newForm);
                //newForm.Dock = DockStyle.Fill;
                //newForm.Show();

                alarm.Show("Ana sayfa çok yakında.", alarm.Alarmtur.basarili);
            }
            else if (buton_no == 2)
            {
                pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                masa_butonlari newForm = new masa_butonlari(pl_icerik);
                newForm.TopLevel = false;
                pl_icerik.Controls.Add(newForm);
                newForm.Dock = DockStyle.Fill;
                newForm.Show();
            }
            else if (buton_no == 3)
            {
                personel_giris giris = new personel_giris("yonetici", false);
                giris.ShowDialog();

                if (cGenel.personel_girisi == true)
                {
                    pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                    urunler newForm = new urunler();
                    newForm.TopLevel = false;
                    pl_icerik.Controls.Add(newForm);
                    newForm.Dock = DockStyle.Fill;
                    newForm.Show();
                }
                else
                {
                    alarm.Show("Bu sayfayı görme yetkiniz yok.", alarm.Alarmtur.hata);
                }
            }
            else if (buton_no == 4)
            {
                pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                Sonislemler newForm = new Sonislemler();
                newForm.TopLevel = false;
                pl_icerik.Controls.Add(newForm);
                newForm.Show();
                newForm.Dock = DockStyle.Fill;
            }
            else if (buton_no == 5)
            {
                personel_giris giris = new personel_giris("yonetici", false);
                giris.ShowDialog();

                if (cGenel.personel_girisi == true)
                {
                    pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                    personel newForm = new personel();
                    newForm.TopLevel = false;
                    pl_icerik.Controls.Add(newForm);
                    newForm.Show();
                    newForm.Dock = DockStyle.Fill;
                }
                else
                {
                    alarm.Show("Bu sayfayı görme yetkiniz yok.", alarm.Alarmtur.hata);
                }
            }
            //Hesap Defteri
            else if (buton_no == 6)
            {
                if (ayarlar.internet_var_mi())
                {//internet bağlantısı var ise çalışacak. (Baslangic)
                    personel_giris giris = new personel_giris("yonetici", true);
                    giris.ShowDialog();

                    if (cGenel.personel_girisi == true)
                    {
                        pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                        hesapdefteri newForm = new hesapdefteri();
                        newForm.TopLevel = false;
                        pl_icerik.Controls.Add(newForm);
                        newForm.Show();
                        newForm.Dock = DockStyle.Fill;
                    }//internet bağlantısı var ise çalışacak. (Son)
                    else
                    {
                        alarm.Show("Bu sayfayı görme yetkiniz yok.", alarm.Alarmtur.hata);
                    }
                }
                else
                {//internet bağlantısı yok ise çalışacak.
                    MessageBox.Show("Lütfen internet bağlantınızı kontrol edin.");
                }
            }

            //Raporlar (buton_no == 7)
            else if (buton_no == 7)
            {
                if (ayarlar.internet_var_mi())
                { //İnternet bağlantısı var ise çalışacak. (Baslangic)
                    personel_giris giris = new personel_giris("yonetici", true);
                    giris.ShowDialog();

                    if (cGenel.personel_girisi == true)
                    {
                        pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                    }
                    else
                    {
                        alarm.Show("Bu sayfayı görme yetkiniz yok.", alarm.Alarmtur.hata);
                    }
                }//internet bağlantısı var ise (SON)
                else
                {//internet bağlantısı yok ise çalışacak.
                    MessageBox.Show("Lütfen internet bağlantınızı kontrol edin.");
                }
            }
            else if (buton_no == 8)
            {
                personel_giris giris = new personel_giris("yonetici", false);
                giris.ShowDialog();

                if (cGenel.personel_girisi == true)
                {
                    pl_icerik.Controls.Clear();//formun içini temizliyoruz..
                    ayarlar newForm = new ayarlar();
                    newForm.TopLevel = false;
                    pl_icerik.Controls.Add(newForm);
                    newForm.Show();
                    newForm.Dock = DockStyle.Fill;
                }
                else
                {
                    alarm.Show("Bu sayfayı görme yetkiniz yok.", alarm.Alarmtur.hata);
                }
            }
            //Son işlemler kısımını güncelliyoruz
            veritabani.Sonislem_getir(lv_sonislemler);
            foreach (ListViewItem item in lv_sonislemler.Items)
            {
                item.BackColor = item.Index % 2 == 0 ? Color.White : Color.MistyRose;
            }
        }
예제 #30
0
        public ActionResult UrunDetay(int urunId)
        {
            urunler urun = entities.urunler.FirstOrDefault(x => x.urun_id == urunId);

            return(View(urun));
        }