public UserAdress AddUserAdress(Guid userId, CheckoutViewModel checkoutViewModel) { VotedressUserManager votedressUserManager = new VotedressUserManager(); VotedressUser votedressUser = unitOfWork.Repository <VotedressUser>().Find(x => x.id == userId); if (votedressUser != null) { UserAdress userAdress = new UserAdress() { Adress = checkoutViewModel.Adres, AdressTitle = checkoutViewModel.AdresBasligi, Email = checkoutViewModel.Email, Name = checkoutViewModel.Isim, PhoneNumber = checkoutViewModel.TelefonNumarasi, SurName = checkoutViewModel.Soyisim, User = votedressUser, City = unitOfWork.Repository <City>().Find(x => x.CityID == checkoutViewModel.Sehir), County = unitOfWork.Repository <County>().Find(x => x.CountyID == checkoutViewModel.Ilce), Neighborhood = unitOfWork.Repository <Neighborhood>().Find(x => x.NeighborhoodID == checkoutViewModel.Mahalle), }; userAdress = unitOfWork.Repository <UserAdress>().Insert(userAdress); unitOfWork.SaveChanges(); return(userAdress); } return(null); }
public ActionResult Index(string sekme) { if (sekme == null || sekme == "") { sekme = "anasayfa"; } VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; VotedressUserManager votedressUserManager = new VotedressUserManager(); VotedressUser votedressUser = votedressUserManager.KullaniciGetir(user.id); var JsonModel = new { myId = votedressUser.id, myFullName = votedressUser.UserDetail.Name + " " + user.UserDetail.SurName, myProfileImage = votedressUser.ProfileImage, myCollectionCount = votedressUser.Collections.Count, myVoteCount = votedressUser.Votes.Count, myVotedCount = votedressUser.MyVoteds.Count, sekme = sekme }; return(View(JsonModel)); }
public JavaScriptResult signalr_js() { VotedressUser kullanici = Session["login"] as VotedressUser; string js = "var kullanici_id = \"" + kullanici.id + "\"; $(function(){var chat = $.connection.messanger;$.connection.hub.start().done(function(){ chat.server.onlineOl(kullanici_id);$('#ozelMesaj_gonder').click(function(){var e=$('#ozelMesaj_gonder').attr('data-id'),a=$('#ozelMesaj_input').val();chat.server.ozel_sendMessage(\"" + kullanici.id + "\",e,a),$('#ozelMesaj_input').val(''); $('#ozelMesaj_input').focus(); var oylamaScroll = $('#messageArea');var scrollPosition = oylamaScroll.scrollTop(); var scrollTo_int = oylamaScroll.prop('scrollHeight');console.log(scrollTo_int - scrollPosition);if (scrollTo_int-scrollPosition <= 795){} }); $('#ozelMesaj_input').keypress(function(d){if(13==d.which){var e=$('#ozelMesaj_gonder').attr('data-id'),f=$('#ozelMesaj_input').val();chat.server.ozel_sendMessage(kullanici_id,e,f),$('#ozelMesaj_input').val('')}}); }); });"; return(JavaScript(js)); }
public JsonResult OdemeyiTamamla(CheckoutViewModel newAdress) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; CartManager cartManager = new CartManager(); if (newAdress.id == 0) { UserAdressManager userAdressManager = new UserAdressManager(); UserAdress adress = userAdressManager.AddUserAdress(user.id, newAdress); OrderManager orderManager = new OrderManager(); orderManager.AddOrder(user.id, adress.id); cartManager.SepetiBosalt(user.id); return(Json(true, JsonRequestBehavior.AllowGet)); } else { OrderManager orderManager = new OrderManager(); orderManager.AddOrder(user.id, newAdress.id); cartManager.SepetiBosalt(user.id); return(Json(true, JsonRequestBehavior.AllowGet)); } }
public JsonResult SepetiGuncelle(int cartDetailId, int count) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; CartManager cartManager = new CartManager(); CartDetail cartDetail = cartManager.SepetiGuncelle(user.id, cartDetailId, count); Cart_sade cart_Sade = new Cart_sade(); if (cartDetail != null) { cart_Sade.id = cartDetail.id; cart_Sade.Count = cartDetail.ProductCount; cart_Sade.ProductId = cartDetail.Product.id; cart_Sade.ProductImage = cartDetail.Product.ProductImage; cart_Sade.ProductName = cartDetail.Product.ProductName; cart_Sade.ProductPrice = cartDetail.Product.Price; cart_Sade.Size = cartDetail.Size; cart_Sade.ProductColorId = cartDetail.ProductColorId; } return(Json(cart_Sade, JsonRequestBehavior.AllowGet)); }
public ActionResult UrunEkle(UrunEkle urun_bilgileri) { ViewBag.Urunler = "active open"; ProductManager res = new ProductManager(); VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; List <Category> kategoriler = res.KategorileriniGetir(user.id); ViewBag.KategoriId = new SelectList(kategoriler, "id", "CategoryName"); bool sonuc = res.UrunEkle(urun_bilgileri, user.id); if (sonuc != false) { ViewBag.UrunEklendiMi = "Ürün Başarıyla Eklendi."; } else { ViewBag.UrunEklendiMi = "Ürün Ekleme Başarısız."; } return(View()); }
public JsonResult ArkadaslariGetir() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; VotedressUser votedressUser = new VotedressUser(); VotedressUserManager votedressUserManager = new VotedressUserManager(); votedressUser = votedressUserManager.KullaniciGetir(user.id); var JsonModel = new { friends = votedressUser.Friends.Where(x => x.Durum == true).Select(x => new { friendId = x.MyFriend.id, friendFullName = x.MyFriend.UserDetail.Name + " " + x.MyFriend.UserDetail.SurName, friendProfileImage = x.MyFriend.ProfileImage, friendDate = x.ArkadaslikTarihi, friendCount = x.MyFriend.Friends.Count() }) }; string viewContent = ConvertViewToString("Arkadaslar", JsonModel); return(Json(new { PartialView = viewContent }, JsonRequestBehavior.AllowGet)); }
public bool Oyla(VotedressUser kullanici, int oylanan_id) { if (kullanici != null && oylanan_id != 0) { VoteProduct eklenen_oy = unitOfWork.Repository <VoteProduct>().Find(x => x.id == oylanan_id); eklenen_oy.VoteCount++; unitOfWork.Repository <VoteProduct>().Update(eklenen_oy); unitOfWork.SaveChanges(); Vote deneme = eklenen_oy.Vote; MyVoted oyladim = new MyVoted(); VotedressUser yeni_kullanici = unitOfWork.Repository <VotedressUser>().Find(x => x.id == kullanici.id); Vote yeni_vote = unitOfWork.Repository <Vote>().Find(x => x.id == eklenen_oy.Vote.id); oyladim.User = yeni_kullanici; oyladim.Vote = yeni_vote; unitOfWork.Repository <MyVoted>().Insert(oyladim); int result = unitOfWork.SaveChanges(); if (result > 0) { return(true); } } return(false); }
public VoteMessage_sade OylamaMesajEkle(Guid gonderen_id, Guid oylama_id, string mesaj) { VotedressUser user = unitOfWork.Repository <VotedressUser>().Find(x => x.id == gonderen_id); Vote vote = unitOfWork.Repository <Vote>().Find(x => x.id == oylama_id); VoteMessage voteMessage = new VoteMessage(); voteMessage.Message = mesaj; voteMessage.User = user; voteMessage.Vote = vote; voteMessage.GondermeTarihi = DateTime.Now; unitOfWork.Repository <VoteMessage>().Insert(voteMessage); unitOfWork.SaveChanges(); VoteMessage_sade voteMessage_sade = new VoteMessage_sade(); voteMessage_sade.id = voteMessage.id; voteMessage_sade.GondermeTarihi = voteMessage.GondermeTarihi; voteMessage_sade.Message = voteMessage.Message; voteMessage_sade.MesajSahibi.id = user.id; voteMessage_sade.MesajSahibi.Name = user.UserDetail.Name; voteMessage_sade.MesajSahibi.ProfileImage = user.ProfileImage; voteMessage_sade.MesajSahibi.Sex = user.UserDetail.Sex; voteMessage_sade.MesajSahibi.SocialId = user.SocialId; voteMessage_sade.MesajSahibi.SocialName = user.SocialName; voteMessage_sade.MesajSahibi.SurName = user.UserDetail.SurName; voteMessage_sade.MesajSahibi.Email = user.Email; voteMessage_sade.MesajSahibi.Birthday = user.UserDetail.Birthday; return(voteMessage_sade); }
public ActionResult KısaYollar() { VotedressUser kullanici = Session["login"] as VotedressUser; KısaYollarViewModel view_model = new KısaYollarViewModel(); PrivateMessageManager privatemessage_manager = new PrivateMessageManager(); view_model.GorulmemisMesajlar = privatemessage_manager.GorulmemisMesajlariGetir(kullanici.id).Select(x => new PrivateMessage_sade() { userId = x.User.id, adSoyad = x.User.UserDetail.Name + " " + x.User.UserDetail.SurName, GonderilmeTarihi = x.GöndermeTarihi.ToString(), Message = x.Message, ProfilImage = x.User.ProfileImage, Sahip = (x.User.id == kullanici.id) ? true : false }).ToList(); BahsedilenManager bahsedilenManager = new BahsedilenManager(); List <Bahsedilen_sade> bahsedenler = bahsedilenManager.BahsedenleriGetir(kullanici.id); view_model.Bahsedenler = bahsedenler; FriendManager friendManager = new FriendManager(); List <Friend> arkadaslikIstekleri = friendManager.ArkadaslikIsteklerimiGetir(kullanici.id); view_model.ArkadaslikIsteklerim = arkadaslikIstekleri.Select(x => new Friend_sade() { UserId = x.User.id, UserNameSurname = x.User.UserDetail.Name + " " + x.User.UserDetail.SurName, UserProfileImage = x.User.ProfileImage, Tarih = x.ArkadaslikTarihi, }).ToList(); CartManager cartManager = new CartManager(); Cart carts = cartManager.SepetimiGetir(kullanici.id); if (carts != null) { List <Cart_sade> cart_Sades = carts.CartDetail.Select(x => new Cart_sade() { id = x.id, Count = x.ProductCount, ProductId = x.Product.id, ProductName = x.Product.ProductName, ProductImage = x.Product.ProductImage, ProductPrice = x.Product.Price, ProductColorId = x.ProductColorId, Size = x.Size }).ToList(); view_model.Cart_Sades = cart_Sades; } return(View(view_model)); }
public void MagazadakilerinSayisiniAzalt(string magazaId) { Guid magaza_id = new Guid(magazaId); VotedressUser user = KullaniciGetir(magaza_id); user.OnlineCount--; unitOfWork.Repository <VotedressUser>().Update(user); unitOfWork.SaveChanges(); }
public ActionResult Index() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; ViewBag.SessionID = user.id.ToString(); return(View()); }
public void urunYorumunaCevapYap(Guid urunId, int yorumId, Guid yorumaCevapYapanId, string yorum, List <Guid> bahsedilenler) { if (urunId != Guid.Empty && yorumaCevapYapanId != Guid.Empty && yorumId != 0) { VotedressUserManager votedressUserManager = new VotedressUserManager(); VotedressUser bahseden = votedressUserManager.KullaniciGetir(yorumaCevapYapanId); BahsedilenManager bahsedilenManager = new BahsedilenManager(); for (int i = 0; i < bahsedilenler.Count; i++) { bahsedilenManager.BahsedilenEkleUrun(urunId, yorumaCevapYapanId, bahsedilenler[i], yorum); } ProductManager productManager = new ProductManager(); ProductCommentReply productComment = productManager.UrunYorumunaYorumEkle(yorumId, yorumaCevapYapanId, yorum); OnlineUserManager onlineUserManager = new OnlineUserManager(); List <OnlineUser> bahsedilenlerOnlineMi = onlineUserManager.OnlineKullaniciyiGetir(bahsedilenler); Clients.Group(urunId.ToString()).UrunYorumunaCevapYapildi(productComment.id, yorumId, bahseden.id, bahseden.UserDetail.Name + " " + bahseden.UserDetail.SurName, bahseden.ProfileImage, yorum, DateTime.Now); VotedressUser_sade votedressUser_sade_bahseden; Bahsedilen_sade bahsedilen_sade; for (int i = 0; i < bahsedilenlerOnlineMi.Count; i++) { votedressUser_sade_bahseden = new VotedressUser_sade() { id = bahsedilenlerOnlineMi[i].UserId, Birthday = bahsedilenlerOnlineMi[i].User.UserDetail.Birthday, Email = bahsedilenlerOnlineMi[i].User.Email, Name = bahsedilenlerOnlineMi[i].User.UserDetail.Name, ProfileImage = bahsedilenlerOnlineMi[i].User.ProfileImage, Sex = bahsedilenlerOnlineMi[i].User.UserDetail.Sex, SocialId = bahsedilenlerOnlineMi[i].User.SocialId, SocialName = bahsedilenlerOnlineMi[i].User.SocialName, SurName = bahsedilenlerOnlineMi[i].User.UserDetail.SurName }; bahsedilen_sade = new Bahsedilen_sade(); bahsedilen_sade.GorulmeDurumu = false; bahsedilen_sade.BahsetmeTarihi = DateTime.Now; bahsedilen_sade.Mesaj = yorum; bahsedilen_sade.TipId = urunId; bahsedilen_sade.Tip = "product"; bahsedilen_sade.bahsedilenYerAdi = productManager.UrunGetir(urunId).User.UserDetail.CompanyName; bahsedilen_sade.Bahseden = votedressUser_sade_bahseden; Clients.Client(bahsedilenlerOnlineMi[i].ConnectionId).SizdenBahsedildi(bahsedilen_sade); } } }
public JsonResult FisiltiyiAktiflestir(Guid fisiltiSahibiId) { VotedressUser kullanici = Session["login"] as VotedressUser; WhisperManager whisperManager = new WhisperManager(); whisperManager.ActivedWhisper(kullanici.id, fisiltiSahibiId); return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult KullaniciEngelle(Guid engellenenKullaniciId) { VotedressUser kullanici = Session["login"] as VotedressUser; BlockedUserManager blockedUserManager = new BlockedUserManager(); blockedUserManager.Engelle(kullanici.id, engellenenKullaniciId); return(Json(kullanici.id, JsonRequestBehavior.AllowGet)); }
public JsonResult SepettenSil(int sepetId) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; CartManager cartManager = new CartManager(); cartManager.SepettenSil(user.id, sepetId); return(Json(sepetId, JsonRequestBehavior.AllowGet)); }
public JsonResult ArkadasSil(Guid SilinecekArkadasId) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; FriendManager friendManager = new FriendManager(); friendManager.DeleteFriend(user.id, SilinecekArkadasId); return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); }
public void OnActionExecuting(ActionExecutingContext context) { HttpContextWrapper wrapper = new HttpContextWrapper(HttpContext.Current); VotedressUser SessionControl = context.HttpContext.Session["login"] as VotedressUser; if (SessionControl == null) { context.Result = new RedirectToRouteResult(new RouteValueDictionary { { "controller", "Account" }, { "action", "Giris" }, { "url", context.HttpContext.Request.RawUrl } }); } }
public ActionResult Oylamalarim() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; OylamaManager oylamaManager = new OylamaManager(); OylamalarimViewModel oylamalarimViewModel = new OylamalarimViewModel(); oylamalarimViewModel = oylamaManager.OylamalarimSayfasi(user.id); return(View(oylamalarimViewModel)); }
public JsonResult ArkadaslikIstegiKabulEt(Guid userId) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; FriendManager friendManager = new FriendManager(); friendManager.AcceptFriendRequest(user.id, userId); return(Json(new { IsSuccess = true }, JsonRequestBehavior.AllowGet)); }
//action metot çalıştırıldığı an devreye giriyor public void OnActionExecuting(ActionExecutingContext context) { HttpContextWrapper wrapper = new HttpContextWrapper(HttpContext.Current); VotedressUser SessionControl = context.HttpContext.Session["login"] as VotedressUser; if (SessionControl.Role == "bireysel") { context.Result = new RedirectToRouteResult(new RouteValueDictionary { { "controller", "Oylama" }, { "action", "Index" }, { "url", context.HttpContext.Request.RawUrl } }); } }
public JsonResult OylamamiGetir(Guid oylamaId) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; OylamaManager oylamaManager = new OylamaManager(); Vote_sade vote_Sade = oylamaManager.OylamaGetir(oylamaId, user.id); return(Json(vote_Sade, JsonRequestBehavior.AllowGet)); }
public ActionResult OdemeYeri() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; CartManager cartManager = new CartManager(); Cart cart = cartManager.SepetimiGetir(user.id); if (cart != null) { var JsonModel = new { carts = cart.CartDetail.Select(x => new { id = x.id, ProductId = x.Product.id, ProductName = x.Product.ProductName, ProductImage = x.Product.ProductImage, ProductPrice = x.Product.Price, Count = x.ProductCount, ProductColor = x.ProductColor.ProductColorDetail.Select(k => new { colorName = k.Color.ColorName, colorCode = k.Color.ColorCode }), Size = x.Size }), adresses = cart.User.UserAdresses.Select(x => new { id = x.id, AdresBasligi = x.AdressTitle, Adres = x.Adress, Mahalle = x.Neighborhood.NeighborhoodName, Ilce = x.County.CountyName, Sehir = x.City.CityName, TelefonNumarasi = x.PhoneNumber, Email = x.Email, Isim = x.Name, Soyisim = x.SurName, }) }; return(View(JsonModel)); } else { return(View()); } }
public ActionResult UrunleriGetir() { ProductManager res = new ProductManager(); VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; ViewBag.Urunler = "active open"; List <Product> products = res.UrunleriGetir(user.id); return(View(products)); }
public JsonResult Ayarlar() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; var JsonModel = new { }; string viewContent = ConvertViewToString("Ayarlar", JsonModel); return(Json(new { PartialView = viewContent }, JsonRequestBehavior.AllowGet)); }
public JsonResult WhisperEkle(Guid alanId) { VotedressUser kullanici = Session["login"] as VotedressUser; PrivateMessageManager res = new PrivateMessageManager(); FriendManager friendManager = new FriendManager(); Friend friend = friendManager.ArkadasKontrol(kullanici.id, alanId); if (friend == null) { WhisperManager whisperManager = new WhisperManager(); whisperManager.AddWhisper(kullanici.id, alanId); } return(Json(null, JsonRequestBehavior.AllowGet)); }
public JsonResult SepetimiGetir() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; VotedressUser votedressUser = new VotedressUser(); VotedressUserManager votedressUserManager = new VotedressUserManager(); votedressUser = votedressUserManager.KullaniciGetir(user.id); CartManager cartManager = new CartManager(); Cart myCart = cartManager.SepetimiGetir(user.id); string viewContent; if (myCart != null) { var JsonModel = new { carts = myCart.CartDetail.Select(x => new { id = x.id, ProductId = x.Product.id, ProductName = x.Product.ProductName, ProductImage = x.Product.ProductImage, ProductPrice = x.Product.Price, Count = x.ProductCount, ProductColor = x.ProductColor.ProductColorDetail.Select(k => new { colorName = k.Color.ColorName, colorCode = k.Color.ColorCode }), Size = x.Size }) }; viewContent = ConvertViewToString("Sepet", JsonModel); return(Json(new { PartialView = viewContent }, JsonRequestBehavior.AllowGet)); } viewContent = ConvertViewToString("Sepet", null); return(Json(new { PartialView = viewContent }, JsonRequestBehavior.AllowGet)); }
public void OylamalardanMesajlariniSil(Guid userId, Guid voteId) { OnlineUserManager onlineUserManager = new OnlineUserManager(); VotedressUserManager votedressUserManager = new VotedressUserManager(); VotedressUser engellenenUser = votedressUserManager.KullaniciGetir(userId); OnlineUser engelleyenKisi = onlineUserManager.OnlineKullaniciyiGetirConId(Context.ConnectionId); if (engelleyenKisi != null && engellenenUser != null) { VoteMessageManager voteMessageManager = new VoteMessageManager(); voteMessageManager.OylamadanMesajlariSil(userId, voteId); Clients.Group(voteId.ToString()).OylamadanMesalariSil(userId, voteId); } }
public ActionResult OylamaBaslat(string oylama_suresi, bool paylasima_acikmi, bool kimlik_durumu, string oylama_tipi, string urun_1, string urun_2, string urun_3, string urun_aciklamasi_1_1, string urun_aciklamasi_1_2, string urun_aciklamasi_1_3, string urun_aciklamasi_2_1, string urun_aciklamasi_2_2, string urun_aciklamasi_2_3, string urun_aciklamasi_3_1, string urun_aciklamasi_3_2, string urun_aciklamasi_3_3) { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; OylamaManager oylama_manager = new OylamaManager(); bool sonuc = oylama_manager.OylamaEkle(user.id, oylama_suresi, oylama_tipi, paylasima_acikmi, kimlik_durumu, Request.Files, urun_1, urun_2, urun_3, urun_aciklamasi_1_1, urun_aciklamasi_1_2, urun_aciklamasi_1_3, urun_aciklamasi_2_1, urun_aciklamasi_2_2, urun_aciklamasi_2_3, urun_aciklamasi_3_1, urun_aciklamasi_3_2, urun_aciklamasi_3_3); if (sonuc == true) { return(RedirectToAction("Oylamalarim", "Profile")); } return(RedirectToAction("OylamaBaslatilamadi")); }
public int MesajGonder(Guid gonderen_id, Guid alan_id, string mesaj, DateTime gonderme_tarihi) { PrivateMessage privateMessage = new PrivateMessage(); VotedressUser gonderen_kullanici = unitOfWork.Repository <VotedressUser>().Find(x => x.id == gonderen_id); VotedressUser alan_kullanici = unitOfWork.Repository <VotedressUser>().Find(x => x.id == alan_id); privateMessage.AlanId = alan_kullanici; privateMessage.User = gonderen_kullanici; privateMessage.Message = mesaj; privateMessage.GöndermeTarihi = gonderme_tarihi; privateMessage.GorulmeDurumu = false; unitOfWork.Repository <PrivateMessage>().Insert(privateMessage); unitOfWork.SaveChanges(); return(privateMessage.id); }