Example #1
0
 public ActionResult Create(HttpPostedFileBase file, bgk_dosya model)
 {
     if (file != null && file.ContentLength > 0)
     {
         var      fileName      = Path.GetFileName(file.FileName);
         string[] fileSplit     = fileName.Split('.');
         string   fileExtension = fileSplit[fileSplit.Length - 1];
         string   fileType      = file.ContentType.Split('/')[0];
         string   filePath      = BGKFunction.CreateCode(6) + "_" + fileName.Replace("." + fileExtension, "").ConvertSeo() + "." + fileExtension;
         var      path          = Server.MapPath("~/Uploads/" + fileType + "/");
         var      path2         = Path.Combine(path, filePath);
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         file.SaveAs(path2);
         model.DosyaAdi       = filePath;
         model.Adres          = Url.Content("~/Uploads/" + fileType + "/" + filePath);
         model.DosyaTipi      = fileType;
         model.YukleyenID     = (int)Session["memberID"];
         model.YuklenmeTarihi = DateTime.Now;
         Db.bgk_dosya.Add(model);
         Db.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
Example #2
0
        public ActionResult Vote()
        {
            int id = Convert.ToInt32(Request.Form["id"]);

            if (!BGKFunction.GetMyRole().OyKullanma)
            {
                return(Content("Oy Kullanma yetkiniz yok :("));
            }
            else if (!BGKFunction.IsPostVoted(id))
            {
                bgk_oylama rating = new bgk_oylama();
                rating.Puan = Convert.ToInt32(Request.Form["point"]);
                if (Session["memberInfo"] != null)
                {
                    rating.UyeID = (int)Session["memberID"];
                }
                else
                {
                    rating.OylayanIP = BGKFunction.GetIPAddress();
                }
                rating.YaziID = id;
                Db.bgk_oylama.Add(rating);
                Db.SaveChanges();
                return(Content("Oy kullandığınız için teşekkür ederiz."));
            }
            else
            {
                return(Content("Daha önce oy kullandınız."));
            }
        }
        public ActionResult Subscribe(int categoryID)
        {
            var category = Db.bgk_gorev_kategori.Find(categoryID);
            var member   = BGKFunction.GetMyAccount();

            if (category == null || category.bgk_gorev_kategori_uye.SingleOrDefault(x => x.UyeID == member.Id) != null)
            {
                return(Content("<script>$.BGK.ErrorModal('Bir sorun oluştu. Lütfen daha sonra tekrar deneyiniz.');</script>"));
            }
            else if (category.OlusturanID == member.Id)
            {
                return(Content("<script>$.BGK.ErrorModal('Kendi oluşturduğun kategoriye abone olamazsın!');</script>"));
            }
            else if (category.PuanSiniri != null && category.PuanSiniri > member.Puan)
            {
                return(Content("<script>$.BGK.ErrorModal('Bu kategoriye abone olabilmeniz için en az " + category.PuanSiniri + " puanınız olmalı! Sizin şuanda " + member.Puan + " puanınız bulunmaktadır.');</script>"));
            }
            ViewBag.category = category;
            var mission_member = new bgk_gorev_kategori_uye()
            {
                UyeID = member.Id, KategoriID = categoryID
            };

            return(PartialView(mission_member));
        }
Example #4
0
        public ActionResult CreateCommentSave(bgk_yorum comment)
        {
            string result;

            if (comment.Yorum == null || (Session["memberInfo"] == null && comment.Yazan == null))
            {
                result = "<font color=red>Boş bıraktığınız alan var..</font>";
            }
            else
            {
                comment.YazilmaTarihi = DateTime.Now;
                if (Session["memberID"].ToString() == "0")
                {
                    comment.Onay = false;
                    result       = "<font color=green>Yorumunuz başarıyla kaydedildi.. Onaylandıktan sonra yayınlanacak..</font><script typr=\"text/javascript\">setTimeout(function (){ ToggleCommentBar(); }, 2000);</script>";
                }
                else
                {
                    comment.Onay = BGKFunction.GetMyRole().YorumOnay;
                    var post = Db.bgk_yazi.Find(comment.YaziID);
                    result = "<font color=green>Yorumunuz başarıyla yayınlandı..</font><script typr=\"text/javascript\">setTimeout(function (){ window.location.href = '" + Url.Action("Details", new { id = comment.YaziID, seo = post.Seo }) + "'; }, 2000);</script>";
                }
                Db.bgk_yorum.Add(comment);
                Db.SaveChanges();
            }
            return(Content(result));
        }
        public ActionResult Vote()
        {
            int id = Convert.ToInt32(Request.Form["id"]);

            if (!BGKFunction.IsVoted(id))
            {
                string[] optionID = Request.Form["optionID"].Replace("%2c", ",").Split(',');
                for (int i = 0; i < optionID.Length; i++)
                {
                    bgk_anket_secim selection = new bgk_anket_secim();
                    if (Session["memberInfo"] != null)
                    {
                        selection.UyeID = (int)Session["memberID"];
                    }
                    else
                    {
                        selection.OylayanIP = BGKFunction.GetIPAddress();
                    }
                    selection.SecenekID   = Convert.ToInt32(optionID[i]);
                    selection.SecimTarihi = DateTime.Now;
                    Db.bgk_anket_secim.Add(selection);
                }
                Db.SaveChanges();
                return(Content("Oy kullandığınız için teşekkür ederiz.<br />Oylar sayılıyor.."));
            }
            else
            {
                return(Content("Daha önce oy kullandınız.."));
            }
        }
Example #6
0
 public ActionResult SendMessage(bgk_mesaj message)
 {
     if (string.IsNullOrEmpty(message.Mesaj))
     {
         return(Content("<font color=\"red\">Mesaj alanını boş bıraktınız!</font>"));
     }
     if (message.AliciID == 0)
     {
         foreach (var member in Db.bgk_uye.Where(x => x.Onay == true && x.Id != Convert.ToInt32(BGKFunction.GetConfig("memberID"))).ToList())
         {
             message.Mesaj      += "<br /><br /><i><b>Not:</b> Bu mesaj kulüp yönetimi tarafından gönderilmiştir.</i>";
             message.GonderenID  = Convert.ToInt32(BGKFunction.GetConfig("adminID"));
             message.AliciID     = member.Id;
             message.Okundu      = false;
             message.Tip         = 2;
             message.YazimTarihi = DateTime.Now;
             Db.bgk_mesaj.Add(message);
             Db.SaveChanges();
         }
     }
     else
     {
         message.Mesaj      += "<br /><br /><i><b>Not:</b> Bu mesaj kulüp yönetimi tarafından gönderilmiştir.</i>";
         message.GonderenID  = Convert.ToInt32(BGKFunction.GetConfig("adminID"));
         message.Okundu      = false;
         message.Tip         = 2;
         message.YazimTarihi = DateTime.Now;
         Db.bgk_mesaj.Add(message);
         Db.SaveChanges();
     }
     return(Content("<script>$.BGK.SuccessModal('Mesajınız başarıyla gönderilmiştir.');</script>"));
 }
Example #7
0
 public ActionResult Create(bgk_uye bgk_uye)
 {
     if (ModelState.IsValid)
     {
         string password = BGKFunction.CreateCode(10);
         bool   issend   = BGKFunction.IsSendEmail(bgk_uye.Email, "BGK Üyeliğiniz Oluşturuldu!", "Merhaba " + bgk_uye.AdSoyad + "<br /><br />" + "Bilgi Güvenliği Kulübü üyeliğiniz oluşturulmuştur. Aşağıdaki bilgiler ile giriş yapabilirsiniz.<br /><b>Email: </b>" + bgk_uye.Email + "<br /><b>Şife: </b>" + password + "</b><br /><a href=\"" + Url.Action("Index", "Home", new { area = "" }) + "\">Siteye giriş için tıklayın.</a><br /><br />Bilgi Güvenliği Kulübü Yönetimi");
         if (Db.bgk_uye.SingleOrDefault(x => x.Email == bgk_uye.Email) != null)
         {
             ModelState.AddModelError("Email", "Bu email adresi kullanılıyor :(");
         }
         else if (!issend)
         {
             ModelState.AddModelError("", "Şifre gönderilemedi. Lütfen tekrar deneyin.");
         }
         else
         {
             bgk_uye.Sifre       = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "md5");
             bgk_uye.Puan        = 0;
             bgk_uye.CezaPuani   = 0;
             bgk_uye.KayitTarihi = DateTime.Now;
             bgk_uye.SonGiris    = DateTime.Now;
             Db.bgk_uye.Add(bgk_uye);
             Db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     ViewBag.Yetki = new SelectList(Db.bgk_yetki, "Kod", "Adi");
     return(View(bgk_uye));
 }
Example #8
0
 public ActionResult Upload(HttpPostedFileBase file, string id, string des)
 {
     if (file != null && file.ContentLength > 0)
     {
         var      fileName      = Path.GetFileName(file.FileName);
         string[] fileSplit     = fileName.Split('.');
         string   fileExtension = fileSplit[fileSplit.Length - 1];
         string   fileType      = file.ContentType.Split('/')[0];
         string   filePath      = BGKFunction.CreateCode(6) + "_" + fileName.Replace("." + fileExtension, "").ConvertSeo() + "." + fileExtension;
         var      path          = Server.MapPath("~/Uploads/" + fileType + "/");
         var      path2         = Path.Combine(path, filePath);
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         file.SaveAs(path2);
         bgk_dosya model = new bgk_dosya();
         model.DosyaAdi       = filePath;
         model.Aciklama       = des;
         model.Adres          = Url.Content("~/Uploads/" + fileType + "/" + filePath);
         model.DosyaTipi      = fileType;
         model.YukleyenID     = (int)Session["memberID"];
         model.YuklenmeTarihi = DateTime.Now;
         Db.bgk_dosya.Add(model);
         Db.SaveChanges();
         return(Content("$.BGK.SuccessModal('Dosyanız başarıyla yüklendi!', function (){ $(\"#" + id + "\").val(" + model.Id + "); }, 1500);"));
     }
     else
     {
         return(Content("$(\".info\").html(\"<font color=\"red\">Dosya seçmediniz.</font>\");"));
     }
 }
 public ActionResult Maintenance()
 {
     if (Session["memberRole"].ToString() == "100" || BGKFunction.GetConfig("site-on/off") == "1")
     {
         return(RedirectToAction("Index"));
     }
     return(View());
 }
 public ActionResult Index()
 {
     if (BGKFunction.GetConfig("site-index") != "0" && Session["Index"].ToString() == "0")
     {
         Session["Index"] = "1";
         return(PartialView());
     }
     return(RedirectToAction("Index", "Post"));
 }
Example #11
0
        public ActionResult Delete(delete_action model)
        {
            bgk_grup bgk_grup = Db.bgk_grup.Find(model);

            BGKFunction.DeleteGroup(bgk_grup);
            Db.bgk_grup.Remove(bgk_grup);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Grup başarılı bir şekilde silindi.', function (){ window.location.href='" + Url.Action("index") + "'; }, 1500);</script>"));
        }
        public ActionResult AcceptMission(bgk_gorev_uye model)
        {
            var bgk_gorev_uye = Db.bgk_gorev_uye.Find(model.Id);

            bgk_gorev_uye.Kabul = true;
            BGKFunction.GetMember(bgk_gorev_uye.UyeID).Puan += bgk_gorev_uye.bgk_gorev.Puan;
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Görevi başarıyla kabul ettiniz.', function (){ window.location.reload(); }, 1500);</script>"));
        }
Example #13
0
 public ActionResult Create()
 {
     if (!BGKFunction.GetMyRole().YaziYazma)
     {
         return(HttpNotFound());
     }
     ViewBag.KategoriID = new SelectList(Db.bgk_kategori.Where(x => x.Onay == true), "Id", "Adi");
     return(View());
 }
        public ActionResult Delete(delete_action model)
        {
            bgk_dokuman bgk_dokuman = Db.bgk_dokuman.Find(model.Id);

            BGKFunction.RemoveUploadFile(bgk_dokuman.bgk_dosya);
            Db.bgk_dokuman.Remove(bgk_dokuman);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Döküman başarılı bir şekilde silindi.', function (){ window.location.href='" + Url.Action("index") + "'; }, 1500);</script>"));
        }
Example #15
0
        public ActionResult Delete(delete_action model)
        {
            bgk_uye bgk_uye = Db.bgk_uye.Find(model.Id);

            BGKFunction.DeleteMember(bgk_uye);
            Db.bgk_uye.Remove(bgk_uye);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Üye başarılı bir şekilde silindi.', function (){ window.location.href='" + Url.Action("index") + "'; }, 1500);</script>"));
        }
Example #16
0
        public ActionResult Delete(delete_action model)
        {
            bgk_kategori category = Db.bgk_kategori.Find(model.Id);

            BGKFunction.DeleteCategory(category);
            Db.bgk_kategori.Remove(category);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Kategori başarılı bir şekilde silindi.', function () { window.location.href='" + Url.Action("index") + "' });</script>"));
        }
        public ActionResult UnapproveMission(bgk_gorev_uye model)
        {
            int memberID      = (int)Session["memberID"];
            var bgk_gorev_uye = Db.bgk_gorev_uye.SingleOrDefault(x => x.GorevID == model.Id && x.UyeID == memberID);

            bgk_gorev_uye.Onay = false;
            BGKFunction.GetMember(bgk_gorev_uye.UyeID).CezaPuani += bgk_gorev_uye.bgk_gorev.Puan;
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Görevi başarılı bir şekilde geri çevirdiniz.', function (){ window.location.reload(); }, 1500);</script>"));
        }
        public ActionResult Delete(delete_action model)
        {
            bgk_etkinlik bgk_etkinlik = Db.bgk_etkinlik.Find(model.Id);

            BGKFunction.DeleteActivity(bgk_etkinlik);
            Db.bgk_dosya.Remove(bgk_etkinlik.bgk_dosya);
            Db.bgk_etkinlik.Remove(bgk_etkinlik);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Etkinlik başarılı bir şekilde silindi.', function () { window.location.href='" + Url.Action("index") + "' });</script>"));
        }
        public ActionResult Index(int num)
        {
            int take         = 20;
            int skip         = take * (num - 1);
            int adminID      = Convert.ToInt32(BGKFunction.GetConfig("adminID"));
            var bgk_bildirim = Db.bgk_bildirim.Where(x => x.UyeID == adminID).OrderByDescending(x => x.Tarih);

            ViewBag.count = bgk_bildirim.Count();
            ViewBag.take  = take;
            return(View(bgk_bildirim.Skip(skip).Take(take)));
        }
        public ActionResult MyNotifications()
        {
            var notifications = BGKFunction.GetMyAccount().bgk_bildirim.OrderByDescending(x => x.Tarih).ToList();

            foreach (var notification in notifications)
            {
                notification.Okundu = true;
            }
            Db.SaveChanges();
            return(PartialView(notifications));
        }
        public ActionResult Comments(int id, int page, string seo)
        {
            int take  = 10;
            int skip  = take * (page - 1);
            var posts = Db.bgk_yorum.Where(x => x.UyeID == id && x.bgk_yazi.Onay == true && x.Onay == true).OrderByDescending(x => x.YazilmaTarihi).ToList();

            ViewBag.Title    = BGKFunction.GetMember(id).AdSoyad + " > Yorumları";
            ViewBag.count    = posts.Count();
            ViewBag.take     = take;
            ViewBag.memberID = id;
            return(View(posts.Skip(skip).Take(take)));
        }
        public ActionResult Uploads(int id, int page, string seo)
        {
            int take    = 10;
            int skip    = take * (page - 1);
            var uploads = Db.bgk_dosya.Where(x => x.YukleyenID == id).OrderByDescending(x => x.YuklenmeTarihi).ToList();

            ViewBag.Title    = BGKFunction.GetMember(id).AdSoyad + " Adlı Üyenin Yüklemeleri";
            ViewBag.count    = uploads.Count();
            ViewBag.take     = take;
            ViewBag.memberID = id;
            return(View(uploads.Skip(skip).Take(take)));
        }
        public ActionResult Groups(int id, int page, string seo)
        {
            int take  = 10;
            int skip  = take * (page - 1);
            var posts = Db.bgk_grup_uye.Where(x => x.UyeID == id).OrderByDescending(x => x.BitisTarihi).ToList();

            ViewBag.Title    = BGKFunction.GetMember(id).AdSoyad + " > Gruplar";
            ViewBag.count    = posts.Count();
            ViewBag.take     = take;
            ViewBag.memberID = id;
            return(View(posts.Skip(skip).Take(take)));
        }
        public ActionResult CreatedMissions(int page)
        {
            int take     = 10;
            int skip     = take * (page - 1);
            var member   = BGKFunction.GetMyAccount();
            var missions = member.bgk_gorev.ToList();

            ViewBag.count   = missions.Count();
            ViewBag.take    = take;
            ViewBag.Title   = "Oluşturduğum Görevler";
            ViewBag.Message = "Henüz oluşturduğun görev yok :(";
            return(View("List", missions.Skip(skip).Take(take)));
        }
        public ActionResult Delete(delete_action model)
        {
            bgk_dokuman_kategori bgk_dokuman_kategori = Db.bgk_dokuman_kategori.Find(model.Id);

            foreach (var document in bgk_dokuman_kategori.bgk_dokuman)
            {
                BGKFunction.RemoveUploadFile(document.bgk_dosya);
                Db.bgk_dokuman.Remove(document);
            }
            Db.bgk_dokuman_kategori.Remove(bgk_dokuman_kategori);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Kategori başarılı bir şekilde silindi.', function (){ window.location.href='" + Url.Action("index") + "'; }, 1500);</script>"));
        }
Example #26
0
        public ActionResult CreatePassword(bgk_uye model)
        {
            var    member   = Db.bgk_uye.Find(model.Id);
            string password = BGKFunction.CreateCode(10);
            bool   issend   = BGKFunction.IsSendEmail(member.Email, "BGK Üyeliğiniz", "Merhaba " + member.AdSoyad + "<br /><br />" + "Bilgi Güvenliği Kulübü üyeliğinizin şifresi değiştirilmiştir. Aşağıdaki bilgiler ile giriş yapabilirsiniz.<br /><b>Email: </b>" + member.Email + "<br /><b>Şife: </b>" + password + "</b><br /><a href=\"" + Url.Action("Index", "Home", new { area = "" }) + "\">Siteye giriş için tıklayın.</a><br /><br />Bilgi Güvenliği Kulübü Yönetimi");

            if (issend)
            {
                member.Sifre = password;
                Db.SaveChanges();
                return(Content("<script>$.BGK.SuccessModal('Şifre başarıyla değiştirildi ve ilgili üyenin email adresine postalandı.');</script>"));
            }
            return(Content("<font color=\"red\">Şifre gönderilemedi. Lütfen tekrar deneyin.</font>"));
        }
 public ActionResult Communication(bgk_communication model)
 {
     if (ModelState.IsValid)
     {
         if (BGKFunction.IsSendEmail(BGKFunction.GetConfig("smtp-username"), model.Konu, model.Mesaj + "<br /><br />Bu mesaj <b>" + model.AdSoyad + "(" + model.Email + ")</b> tarafından gönderilmiştir."))
         {
             ModelState.AddModelError("", "Mesajınız başarıyla gönderilmiştir.");
         }
         else
         {
             ModelState.AddModelError("", "Mesajınız gönderilirken bir sorun oluştu. Lütfen tekrar deneyiniz.");
         }
     }
     return(View(model));
 }
Example #28
0
 public ActionResult Create(bgk_yazi model)
 {
     if (ModelState.IsValid)
     {
         model.Seo         = model.Baslik.ConvertSeo();
         model.YazimTarihi = DateTime.Now;
         model.UyeID       = (int)Session["memberID"];
         model.Onay        = BGKFunction.GetMyRole().YaziOnay;
         model.Manset      = false;
         model.Okunma      = 0;
         Db.bgk_yazi.Add(model);
         Db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     ViewBag.KategoriID = new SelectList(Db.bgk_kategori.Where(x => x.Onay == true), "Id", "Adi");
     return(View(model));
 }
        public ActionResult MyMissions(int page)
        {
            int take   = 10;
            int skip   = take * (page - 1);
            var member = BGKFunction.GetMyAccount();
            List <bgk_gorev> missions = new List <bgk_gorev>();

            foreach (var mission in member.bgk_gorev_uye.ToList())
            {
                missions.Add(mission.bgk_gorev);
            }
            ViewBag.count   = missions.Count();
            ViewBag.take    = take;
            ViewBag.Title   = "Görevlerim";
            ViewBag.Message = "Henüz aldığınız görev yok :(";
            return(View("List", missions.Skip(skip).Take(take)));
        }
        public ActionResult CancelMission(bgk_gorev_uye model)
        {
            bgk_gorev_uye mission = Db.bgk_gorev_uye.Find(model.Id);

            if (mission.UyeID == (int)Session["memberID"] && mission.bgk_gorev.Tip == 1)
            {
                BGKFunction.GetMyAccount().CezaPuani += mission.bgk_gorev.Puan;
                mission.Onay = false;
                Db.SaveChanges();
                return(Content("<script>$.BGK.SuccessModal('Görevi başarılı bir şekilde iptal ettiniz.', function (){ window.location.href='" + Url.Action("MyMissions") + "'; }, 1500);</script>"));
            }
            else
            {
                Db.bgk_gorev_uye.Remove(mission);
                Db.SaveChanges();
                return(Content("<script>$.BGK.SuccessModal('Görevi başarılı bir şekilde iptal ettiniz.', function (){ window.location.href='" + Url.Action("CreatedMissions") + "'; }, 1500);</script>"));
            }
        }