public static Dictionary<int, SatilanUrun> kayitliSepetiGetir(int kullaniciID) { Dictionary<int, SatilanUrun> getirilenSepet = new Dictionary<int, SatilanUrun>(); foreach (Int32 satilanUrunID in new DBConnection().ConnectDB.GetProductsFromCart(kullaniciID)) { SatilanUrun u = new SatilanUrun(); u.SatilanUrunID = satilanUrunID; getirilenSepet.Add(satilanUrunID, u); } try { DBConnection db = new DBConnection(); db.ConnectDB.DeleteCart(kullaniciID); db.ConnectDB.SaveChanges(); } catch (EntityCommandExecutionException) { throw new Exception("Sepet silinirken hata oluştu."); } return getirilenSepet; }
public static List<SatilanUrun> tekUrunGetir(int stockID) { List<SatilanUrun> list = new List<SatilanUrun>(); foreach (GetSingleProduct_Result product in new DBConnection().ConnectDB.GetSingleProduct(stockID)) { SatilanUrun satilanUrun = new SatilanUrun(); Urun urun = new Urun(); urun.ProductID = product.ProductID; satilanUrun.Numara = product.Size; Uretici uretici = new Uretici(); uretici.Ad = product.ProducerName; uretici.ID = product.ProducerID; urun.Uretici = uretici; urun.Description = product.Description; urun.Cinsiyet = Convert.ToChar( product.Gender); satilanUrun.Fiyat = product.PricePerPiece; satilanUrun.Stok = product.Count; satilanUrun.Renk = product.Color; satilanUrun.Urun = urun; satilanUrun.SatilanUrunID = product.StockID; list.Add(satilanUrun); } return list; }
public static Dictionary<int, SatilanUrun> sepettekiUrunleriGetir(Dictionary<int, SatilanUrun> sepettekiUrunIDs) { Dictionary<int,SatilanUrun> al = new Dictionary<int,SatilanUrun>(); foreach (int sepettekiUrunID in sepettekiUrunIDs.Keys) { foreach (GetSingleProduct_Result product in new DBConnection().ConnectDB.GetSingleProduct(sepettekiUrunID)) { SatilanUrun satilanUrun = new SatilanUrun(); satilanUrun.SatilanUrunID = product.StockID; satilanUrun.Urun.ProductID = product.ProductID; satilanUrun.Fiyat = product.PricePerPiece; al.Add(product.StockID,satilanUrun); } } return al; }
protected void lstTOP5_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "SepeteEkle") { SatilanUrun u = new SatilanUrun(); u.SatilanUrunID = Convert.ToInt32(e.CommandArgument); (Session[Misc.GecerliKullanici] as Kullanici).sepeteEkle(u); ((Literal)Page.Master.FindControl("lblSepettekiUrunMiktari")).Text = (Session[Misc.GecerliKullanici] as Kullanici).sepettekiElemanSayisi().ToString(); } else if (e.CommandName == "Karsilastir") { SatilanUrun u = new SatilanUrun(); u.SatilanUrunID = Convert.ToInt32(e.CommandArgument); (Session[Misc.Karsilastirilacaklar] as ArrayList).Add(u); } }
public static ArrayList top5UrunGetir() { ArrayList satilanUrunler = new ArrayList(); foreach (GetTOP5Product_Result top5 in new DBConnection().ConnectDB.GetTOP5Product()) { SatilanUrun satilanUrun = new SatilanUrun(); Urun urun = new Urun(); urun.ProductID = top5.ProductID; satilanUrun.Numara = top5.Size; Uretici uretici = new Uretici(); uretici.Ad = top5.ProducerName; urun.Uretici = uretici; urun.Description = top5.Description; satilanUrun.Fiyat = top5.PricePerPiece; satilanUrun.Renk = top5.Color; satilanUrun.Urun = urun; satilanUrun.SatilanUrunID = top5.StockID; satilanUrunler.Add(satilanUrun); } return satilanUrunler; }
public void sepeteEkle(SatilanUrun yeniUrun) { sepet.Add(yeniUrun.SatilanUrunID,yeniUrun); }
public static ArrayList urunAra(string kriter) { ArrayList satilanUrunler = new ArrayList(); foreach (SearchProduct_Result product in new DBConnection().ConnectDB.SearchProduct(kriter)) { SatilanUrun satilanUrun = new SatilanUrun(); Urun urun = new Urun(); urun.ProductID = product.ProductID; satilanUrun.Numara = product.Size; Uretici uretici = new Uretici(); uretici.Ad = product.ProducerName; urun.Uretici = uretici; urun.Description = product.Description; satilanUrun.Fiyat = product.PricePerPiece; satilanUrun.Renk = product.Color; satilanUrun.Urun = urun; satilanUrun.SatilanUrunID = product.StockID; satilanUrunler.Add(satilanUrun); } return satilanUrunler; }
public static object tumunuCek() { ArrayList al = new ArrayList(); foreach (TumUrunleriCek_Result product in new DBConnection().ConnectDB.TumUrunleriCek()) { SatilanUrun u = new SatilanUrun(); u.Urun.Uretici.Ad = product.ProducerName; u.Urun.Uretici.ID = product.ProducerID; u.Urun.ProductID = product.ProductID; u.SatilanUrunID = product.StockID; u.Stok = product.Count; u.Urun.Cinsiyet = Convert.ToChar( product.Gender); u.Renk = product.Color; u.Fiyat = product.PricePerPiece; u.Numara = product.Size; al.Add(u); } return al; }