コード例 #1
0
        public ActionResult Mesajlarim()
        {
            if (Session["giris"] == null)
            {
                return(RedirectToAction("Giris", "Home"));
            }
            KullaniciYönetici ky     = new KullaniciYönetici();
            MesajYonetici     my     = new MesajYonetici();
            List <Mesajlasma> msjlar = new List <Mesajlasma>();
            Kullanici         giris  = Session["giris"] as Kullanici;
            long id = 0;

            msjlar = my.MesajlariAl(giris).OrderByDescending(x => x.mesajtarihsaat).ToList();
            if (msjlar.Count > 0)
            {
                if (msjlar[0].kullaniciAliciId != giris.kullaniciId)
                {
                    id = msjlar[0].kullaniciAliciId;
                }
                else if (msjlar[0].kullaniciGonderenId != giris.kullaniciId)
                {
                    id = msjlar[0].kullaniciGonderenId;
                }
                Kullanici klnc = ky.SecilenKullaniciIdIle(id);
                mvm.msjlar = msjlar;
                mvm.klnc   = klnc;
            }
            return(View("Mesajlarim", mvm));
        }
コード例 #2
0
        public ActionResult Giris(LoginViewModel lvm)
        {
            if (ModelState.IsValid)
            {
                KullaniciYönetici ky = new KullaniciYönetici();
                BusinessLayerResult <Kullanici> res = ky.GirisKullanici(lvm);

                if (res.Errors.Count > 0)
                {
                    res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                    return(View(lvm));
                }
                if (res.Errors.Count == 0 && lvm.BeniHatirla)
                {
                    HttpCookie grs = new HttpCookie("giris");
                    grs.Expires = DateTime.Now.AddSeconds(3600);
                    grs.Value   = lvm.Username;
                    Response.Cookies.Add(grs);

                    HttpCookie sfr = new HttpCookie("sifre");
                    sfr.Expires = DateTime.Now.AddSeconds(3600);
                    sfr.Value   = lvm.Password;
                    Response.Cookies.Add(sfr);
                }
                Session["giris"] = res.Result;
                return(RedirectToAction("Index"));
            }

            return(View());
        }
コード例 #3
0
        public ActionResult Index()
        {
            UrunYonetici uy    = new UrunYonetici();
            Kullanici    giris = GirisKontrol();

            if (giris != null)
            {
                KullaniciYönetici ky  = new KullaniciYönetici();
                LoginViewModel    lvm = new LoginViewModel();
                lvm.Username = giris.kullaniciAdi;
                lvm.Password = giris.kullaniciSifre;
                BusinessLayerResult <Kullanici> res = ky.GirisKullanici(lvm);
                if (res.Errors.Count > 0)
                {
                    HttpCookie grs = new HttpCookie("giris");
                    grs.Expires = DateTime.Now.AddSeconds(-1d);
                    Response.Cookies.Add(grs);

                    HttpCookie sfr = new HttpCookie("sifre");
                    sfr.Expires = DateTime.Now.AddSeconds(-1d);
                    Response.Cookies.Add(sfr);
                }
                else
                {
                    Session["giris"] = res.Result;
                }
            }
            return(View(uy.UrunleriAl().OrderByDescending(x => x.satistarihsaat).ToList()));
        }
コード例 #4
0
        public JsonResult MesajGetir(long id)
        {
            MesajYonetici     my     = new MesajYonetici();
            KullaniciYönetici ky     = new KullaniciYönetici();
            Kullanici         klnc   = ky.Find(x => x.kullaniciId == id);
            List <Mesajlasma> msjlar = my.MesajlariAl(klnc).OrderByDescending(x => x.mesajtarihsaat).ToList();

            mvm.msjlar = msjlar;
            mvm.klnc   = klnc;
            return(Json(mvm));
        }
        public ActionResult Aktivasyon(Guid id)
        {
            KullaniciYönetici ky = new KullaniciYönetici();
            BusinessLayerResult<Kullanici> res = ky.KullaniciAktiflestir(id);

            if (res.Errors.Count > 0)
            {
                TempData["errors"] = res.Errors;
                return RedirectToAction("AktivasyonIptal");
            }
            return RedirectToAction("AktivasyonTamam");
        }
コード例 #6
0
        public ActionResult Mesaj(int id)
        {
            if (Session["giris"] == null)
            {
                return(RedirectToAction("Giris", "Home"));
            }
            KullaniciYönetici ky    = new KullaniciYönetici();
            Kullanici         giris = Session["giris"] as Kullanici;
            Kullanici         klnc  = ky.SecilenKullaniciIdIle(id);

            mvm.klnc = klnc;
            return(View("Mesajlarim", mvm));
        }
コード例 #7
0
        public ActionResult HesabiSil()
        {
            if (Session["giris"] == null)
            {
                return(RedirectToAction("Giris", "Home"));
            }
            KullaniciYönetici ky   = new KullaniciYönetici();
            Kullanici         klnc = Session["giris"] as Kullanici;

            Session.Remove("giris");
            ky.Delete(klnc);
            return(RedirectToAction("Index", "Home"));
        }
コード例 #8
0
        public ActionResult Hesabim(KullaniciViewModel kvm, List <HttpPostedFileBase> file)
        {
            var filename = ImageNameGenerator.ProfilFotoIsmiUret(file[0]);
            var path     = "null";

            kvm.fotograf = filename;
            KullaniciYönetici ky   = new KullaniciYönetici();
            Kullanici         klnc = Session["giris"] as Kullanici;
            BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();

            if (klnc != null)
            {
                kvm.KullaniciId = klnc.kullaniciId;
            }
            res = ky.KullaniciGuncelle(kvm, file[0]);
            if (file[0] != null)
            {
                //filename = Path.GetFileName(file[0].FileName);
                path = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename);
                Image imgnew = ResizeImage.Resize(Image.FromStream(file[0].InputStream), 0, 473);  //son eklediğim alan

                //file[0].SaveAs(path);
                imgnew.Save(path);
            }
            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                return(View(kvm));
            }
            if (file != null && file.Count > 1)
            {
                for (int i = 1; i <= file.Count - 1; i++)
                {
                    if (file != null && file[i].ContentLength > 0)
                    {
                        filename     = Path.GetFileName(file[i].FileName);
                        path         = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename);
                        kvm.fotograf = file[i].FileName;
                        KullaniciYönetici ky1 = new KullaniciYönetici();
                        BusinessLayerResult <KullaniciFoto> res1 = ky1.KullaniciFotosuYukle(kvm.Username, file[i]);
                        file[i].SaveAs(path);
                    }
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #9
0
 public ActionResult Kayit(KullaniciViewModel kvm)
 {
     if (ModelState.IsValid)
     {
         KullaniciYönetici ky = new KullaniciYönetici();
         BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();
         Kullanici klnc = new Kullanici();
         res = ky.HizliKullaniciKaydi(kvm);
         if (res.Errors.Count > 0)
         {
             res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
             return(View(kvm));
         }
         return(RedirectToAction("KayitOnay"));
     }
     return(View());
 }
コード例 #10
0
        public ActionResult Select(int?id)
        {
            if (Session["giris"] == null)
            {
                return(RedirectToAction("Giris", "Home"));
            }
            KullaniciYönetici  ky    = new KullaniciYönetici();
            KullaniciViewModel kvm   = new KullaniciViewModel();
            Kullanici          klnc  = null;
            Kullanici          giris = Session["giris"] as Kullanici;

            if (id == null)
            {
                klnc          = Session["giris"] as Kullanici;
                kvm.Username  = klnc.kullaniciAdi;
                kvm.Firstname = klnc.isim;
                kvm.Lastname  = klnc.soyisim;
                kvm.Email     = klnc.kullaniciEmail;
                if (klnc.dogumtarihi != null)
                {
                    if (klnc.dogumtarihi.Value.Day < 10)
                    {
                        kvm.GunAlani = "0" + klnc.dogumtarihi.Value.Day.ToString();
                    }
                    if (klnc.dogumtarihi.Value.Month < 10)
                    {
                        kvm.AyAlani = "0" + klnc.dogumtarihi.Value.Month.ToString();
                    }
                    if (klnc.dogumtarihi.Value.Day >= 10 && klnc.dogumtarihi.Value.Month >= 10)
                    {
                        kvm.GunAlani = klnc.dogumtarihi.Value.Day.ToString();
                        kvm.AyAlani  = klnc.dogumtarihi.Value.Month.ToString();
                    }
                    kvm.YilAlani = klnc.dogumtarihi.Value.Year.ToString();
                }
                if (klnc.ilPlaka != null)
                {
                    kvm.SehirAlani = ky.SehiradiAl(klnc.ilPlaka.Value);
                }
                kvm.CinsiyetAlani = klnc.cinsiyet;
                return(View("Hesabim", kvm));
            }
            else if (id != null && giris != null && giris.kullaniciId == id)
            {
                klnc = Session["giris"] as Kullanici;

                kvm.Username      = klnc.kullaniciAdi;
                kvm.Firstname     = klnc.isim;
                kvm.Lastname      = klnc.soyisim;
                kvm.Email         = klnc.kullaniciEmail;
                kvm.GunAlani      = klnc.dogumtarihi.Value.Day.ToString();
                kvm.AyAlani       = klnc.dogumtarihi.Value.Month.ToString();
                kvm.YilAlani      = klnc.dogumtarihi.Value.Year.ToString();
                kvm.SehirAlani    = ky.SehiradiAl(klnc.ilPlaka.Value);
                kvm.CinsiyetAlani = klnc.cinsiyet;
                return(View("Hesabim", kvm));
            }
            else
            {
                klnc = ky.SecilenKullaniciIdIle(id.Value);
                if (klnc == null)
                {
                    //return HttpNotFound();
                    return(RedirectToAction("Index", "Home"));
                }
                MesajViewModel mvm = new MesajViewModel();
                mvm.AliciKullaniciId = (klnc.kullaniciId).ToString();
                return(View("Kullanici", mvm));
            }
        }