protected void Button1_Click(object sender, EventArgs e) { AltKategoriler k = new AltKategoriler(); k.AltKategoriAd = txtad.Text; k.AltKategoriAciklama = txtaciklama.Text; k.KategoriID = ks.GetKategoriIDByKategoriName(ddlkategoriler.SelectedValue.ToString()); if (txtad.Text.Trim() != "" && txtaciklama.Text.Trim() != "") { if (aks.AltKategoriEkle(k)) { //true lblsuccess.Text = "AltKategori başarılı bir şekilde kaydedildi..."; lblalert.Visible = false; Temizle(); } else { //false txtad.Focus(); lblsuccess.Visible = false; lblalert.Text = "Kayıt Başarısız ..."; } } else { txtad.Focus(); lblsuccess.Visible = false; lblalert.Text = "Boş Geçilemez ..."; } }
public void AltKategoriSiraNoGuncelle(AltKategoriler altkategoriler) { using (var db = new ContextDataModel()) { db.AltKategoriler.Attach(altkategoriler); db.Entry(altkategoriler).Property(x => x.SiraNo).IsModified = true; db.SaveChanges(); } }
protected void grdAltKategoriler_RowUpdating(object sender, GridViewUpdateEventArgs e) { // Find COntrolle bilgilerimiz aldık ve değişiklikleri yaptık. int AltID = Convert.ToInt32((this.grdAltKategoriler.Rows[e.RowIndex].FindControl("lblID") as Label).Text); AltKategoriler altkategori = et.AltKategorilers.Single(v => v.ALTID == AltID); altkategori.ALTAD = (this.grdAltKategoriler.Rows[e.RowIndex].FindControl("txtAD") as TextBox).Text; altkategori.AKID = Convert.ToInt32((this.grdAltKategoriler.Rows[e.RowIndex].FindControl("DropDownList2") as DropDownList).SelectedValue); et.SubmitChanges(); AltKategorileriGetir(); Response.Redirect("Yonetim.aspx?ad=altkategoriler"); //Sayfa Yenileme işlemini yaptık. }
public AltKategoriler AltKategoriSiraBul(int AltKategoriId) { var query = (from m in _context.AltKategoriler join n in _context.AltKategoriler on m.UstKategoriId equals n.UstKategoriId where n.AltKategoriId == AltKategoriId select new { n.SiraNo, m.UstKategoriId }).FirstOrDefault(); AltKategoriler alt = new AltKategoriler { SiraNo = query.SiraNo, UstKategoriId = query.UstKategoriId }; return(alt); }
public bool AltKategoriEkle(AltKategoriler ak) { ent.AltKategoriler.Add(ak); try { ent.SaveChanges(); return(true); } catch (Exception ex) { string mesaj = ex.Message; } return(false); }
public void AltKAtegoriSiraNoGuncelleDeleteIsleminde(int SiraNo, int UstKategoriId) { var query = (from l in _context.AltKategoriler where l.SiraNo == SiraNo && l.UstKategoriId == UstKategoriId select l).FirstOrDefault(); SiraNo = SiraNo - 1; AltKategoriler kategoriler = new AltKategoriler() { UstKategoriId = query.UstKategoriId, SiraNo = SiraNo, AltKategoriId = query.AltKategoriId }; ContextDataModel db = new ContextDataModel(); db.AltKategoriler.Attach(kategoriler); db.Entry(kategoriler).Property(x => x.SiraNo).IsModified = true; db.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ID"] != null) { int AltKategoriID = Convert.ToInt32(Request.QueryString["ID"]); if (!IsPostBack) { KategoriDoldur(); AltKategoriler k = aks.GetAltKategoriByID(AltKategoriID); txtad.Text = k.AltKategoriAd; txtaciklama.Text = k.AltKategoriAciklama; ddlaltkategoriler.SelectedValue = ks.GetKategoriNameByID(k.KategoriID); } } }
public bool AltKategoriGuncelle(AltKategoriler k) { var sonuc = ent.AltKategoriler.Where(x => x.AltKategoriID == k.AltKategoriID).FirstOrDefault(); sonuc.AltKategoriAd = k.AltKategoriAd; sonuc.AltKategoriAciklama = k.AltKategoriAciklama; sonuc.KategoriID = k.KategoriID; try { ent.SaveChanges(); return(true); } catch (Exception ex) { string mesaj = ex.Message; } return(false); }
public ActionResult EditSubCategory(AltKategoriler altKategori, HttpPostedFileBase yuklenecekDosya, bool cbSlug) { if (altKategori.KategoriId == null) { return(RedirectToAction("SubCategory")); } AltKategoriler kat = db.AltKategoriler.Where(k => k.AltKategoriId == altKategori.AltKategoriId).FirstOrDefault(); if (kat == null) { return(RedirectToAction("SubCategory")); } if (yuklenecekDosya != null) { string dosyaAdi = Path.GetFileName(Kontrol.SayiOlustur() + "-" + yuklenecekDosya.FileName); var yuklemeYeri = Path.Combine(Server.MapPath("~/Upload/icon"), dosyaAdi); yuklenecekDosya.SaveAs(yuklemeYeri); kat.Ikon = dosyaAdi; } if (cbSlug == true) { kat.Slug = Kontrol.ToSlug(altKategori.Slug); } kat.KategoriId = altKategori.KategoriId; kat.AltKategoriAdi = altKategori.AltKategoriAdi; kat.Aktif = altKategori.Aktif; kat.Depart = altKategori.Depart; kat.Area = altKategori.Area; kat.Sira = altKategori.Sira; kat.Url = altKategori.Url; db.SaveChanges(); return(RedirectToAction("SubCategory")); }
public ActionResult AddSubCategory(AltKategoriler altKategori, HttpPostedFileBase yuklenecekDosya) { if (altKategori.AltKategoriAdi == null) { return(View()); } if (yuklenecekDosya != null) { string dosyaAdi = Path.GetFileName(Kontrol.SayiOlustur() + "-" + yuklenecekDosya.FileName); var yuklemeYeri = Path.Combine(Server.MapPath("~/Upload/icon"), dosyaAdi); yuklenecekDosya.SaveAs(yuklemeYeri); altKategori.Ikon = dosyaAdi; } altKategori.Slug = Kontrol.ToSlug(altKategori.AltKategoriAdi); db.AltKategoriler.Add(altKategori); db.SaveChanges(); return(RedirectToAction("SubCategory")); }
protected void Button1_Click(object sender, EventArgs e) { if (txtad.Text.Trim() != "" && txtaciklama.Text.Trim() != "") { if (aks.AltKategoriKontrol(txtad.Text, Convert.ToInt32(Request.QueryString["ID"]))) { //güncelleme yap AltKategoriler k = new AltKategoriler(); k.AltKategoriID = Convert.ToInt32(Request.QueryString["ID"]); k.AltKategoriAd = txtad.Text; k.AltKategoriAciklama = txtaciklama.Text; k.KategoriID = ks.GetKategoriIDByKategoriName(ddlaltkategoriler.SelectedValue); if (aks.AltKategoriGuncelle(k)) { lblsuccess.Text = "Güncelleme Başarılı"; lblalert.Visible = false; Response.Redirect("../Admin/Default.aspx"); } else { lblalert.Text = "Güncelleme Başarısız"; lblsuccess.Visible = false; txtad.Focus(); } } else { //zaten var uyar lblalert.Text = "Aynı isimde Altkategori zaten var !!!!"; txtad.Text = ""; txtad.Focus(); } } }
public ActionResult DeleteSubCategory(int id, string returnUrl) { AltKategoriler kategori = db.AltKategoriler.Where(k => k.AltKategoriId == id).FirstOrDefault(); if (kategori == null) { return(RedirectToAction("SubCategory")); } try { db.AltKategoriler.Remove(kategori); db.SaveChanges(); } catch (Exception ex) { TempData["hata"] = "Uyarı: Bu kategoriye Ürün olduğu için, Kategoriyi silmenize izin verilmedi."; return(Redirect(returnUrl)); } return(RedirectToAction("SubCategory")); }
public Market() { GomlekDugum.veri = Gomleklist; GomlekDugum.Adı = "GÖMLEK"; PantolonDugum.veri = Pantolonlist; PantolonDugum.Adı = "PANTOLON"; TshirtDugum.veri = Tshirtlist; TshirtDugum.Adı = "TSHİRT"; LaptopDugum.veri = Laptoplist; LaptopDugum.Adı = "LAPTOP"; MasaustuDugum.veri = Masaustulist; MasaustuDugum.Adı = "Masaüstü"; NotebookDugum.veri = Notebooklist; NotebookDugum.Adı = "Notebook"; FırınDugum.veri = Fırınlist; FırınDugum.Adı = "FIRIN"; BuzdolabıDugum.veri = Buzdolabılist; BuzdolabıDugum.Adı = "BUZDOLABI"; CamasirMakinasiDugum.veri = CamasirMakinasilist; CamasirMakinasiDugum.Adı = "ÇAMAŞIR MAKİNASI"; // yukarıda düğümlerin verilerinin(listelerinin) ve isimlerinin atanması yapılmıştır.. // kategorileri(agaçları) Kategori listesine ekliyorum Kategoriler.Add(Bilgisayar); Kategoriler.Add(BeyazEsya); Kategoriler.Add(GiyimUrunleri); //Altkategorileri kategorilerimize ekliyoruz.. Bilgisayar.Ekle(MasaustuDugum); Bilgisayar.Ekle(LaptopDugum); Bilgisayar.Ekle(NotebookDugum); BeyazEsya.Ekle(FırınDugum); BeyazEsya.Ekle(BuzdolabıDugum); BeyazEsya.Ekle(CamasirMakinasiDugum); GiyimUrunleri.Ekle(GomlekDugum); GiyimUrunleri.Ekle(PantolonDugum); GiyimUrunleri.Ekle(TshirtDugum); // altkategorileri agaçlarla beraber özel oluşturduğumuz altkategori listesini ekliyorum AltKategoriler.Add(MasaustuDugum); AltKategoriler.Add(LaptopDugum); AltKategoriler.Add(NotebookDugum); AltKategoriler.Add(FırınDugum); AltKategoriler.Add(BuzdolabıDugum); AltKategoriler.Add(CamasirMakinasiDugum); AltKategoriler.Add(GomlekDugum); AltKategoriler.Add(PantolonDugum); AltKategoriler.Add(TshirtDugum); }