public ActionResult Edit([Bind(Include = "ReferansID,FirmaAd,ReferansURL,ReferansImageUrl")] Referans referans, HttpPostedFileBase ReferansImage)
        {
            if (ModelState.IsValid)
            {
                var p = db.Referanslar.Find(referans.ReferansID);
                if (ReferansImage != null)
                {
                    var path = Server.MapPath("/Uploads/Referans/");

                    if (p.ReferansImageUrl != null)
                    {
                        System.IO.File.Delete(path + p.ReferansImageUrl);
                    }

                    //string old = path + ;
                    string _new = path + ReferansImage.FileName;
                    ReferansImage.SaveAs(_new);
                    p.ReferansImageUrl = ReferansImage.FileName;
                }
                p.FirmaAd         = referans.FirmaAd;
                p.ReferansURL     = referans.ReferansURL;
                db.Entry(p).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(referans));
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            KurumsalContext ctx = new KurumsalContext();

            var gelenid = Request.QueryString["ID"];

            if (!string.IsNullOrEmpty(gelenid))
            {
                r    = ctx.Referanslar.Find(Convert.ToInt32(gelenid));
                ekle = false;
            }

            if (IsPostBack)
            {
                r.AdSoyad = Request.Form["adsoyad"];
                r.Mesaj   = Request.Form["mesaj"];

                if (ekle)
                {
                    ctx.Referanslar.Add(r);
                }
                else
                {
                    ctx.Entry(r).State = System.Data.Entity.EntityState.Modified;
                }
                ctx.SaveChanges();
            }
        }
Beispiel #3
0
        public ActionResult Ekle(Referans referans, HttpPostedFileBase ResimURL)
        {
            if (referans.ResimURL != null)
            {
                if (ResimURL.ContentLength > 0)
                {
                    string Dosya     = Guid.NewGuid().ToString().Replace("-", "");
                    string Uzanti    = System.IO.Path.GetExtension(Request.Files[0].FileName);
                    string ResimYolu = "/External/Referans/" + Dosya + Uzanti;

                    ResimURL.SaveAs(Server.MapPath(ResimYolu));
                    referans.ResimURL = ResimYolu;
                }

                try
                {
                    db.Referans.Add(referans);
                    db.SaveChanges();
                    return(RedirectToAction("Index", "Referans"));
                }
                catch (Exception)
                {
                    return(View(referans));
                }
            }
            return(View(referans));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Referans referans = db.Referanslar.Find(id);

            db.Referanslar.Remove(referans);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public JsonResult DeleteReference(Referans reference)
        {
            _referenceData.DeleteReference(reference.ReferansId);

            return(Json(new Response {
                ErrorMessage = "Silinmiştir", IsSuccess = false
            }, JsonRequestBehavior.AllowGet));
        }
        public static void ReferansEkle(this PaketOzeti paketOzeti,
                                        PaketVersiyonTuru paketVersiyon,
                                        OzetAlgoritmaTuru ozetAlgoritma,
                                        byte[] ozetDegeri,
                                        Uri uri,
                                        byte[] ozetDegeriSha512 = null,
                                        bool hariciBilesenMi    = false)
        {
            if (ozetAlgoritma == OzetAlgoritmaTuru.YOK)
            {
                throw new ArgumentException(
                          nameof(ozetAlgoritma) + " değeri " + nameof(OzetAlgoritmaTuru.YOK) + " olmamalıdır.",
                          nameof(ozetAlgoritma));
            }
            if (ozetAlgoritma == OzetAlgoritmaTuru.SHA384 && paketVersiyon == PaketVersiyonTuru.Versiyon1X)
            {
                throw new ArgumentException(
                          nameof(OzetAlgoritmaTuru.SHA384) +
                          " özet algoritması yalnızca e-Yazışma API 2.X versiyonlarında kullanılabilir.",
                          nameof(ozetAlgoritma));
            }

            if (paketOzeti.Referanslar != null && paketOzeti.Referanslar.Count > 0)
            {
                var oncekiReferans = paketOzeti.Referanslar.Find(p =>
                                                                 string.Compare(p.URI, uri.ToString(), StringComparison.InvariantCultureIgnoreCase) == 0);
                if (oncekiReferans != default(Referans))
                {
                    paketOzeti.Referanslar.Remove(oncekiReferans);
                }
            }
            else
            {
                paketOzeti.Referanslar = new List <Referans>();
            }

            var yeniReferans = new Referans
            {
                Ozet = Ozet.Kilavuz.OzetAlgoritmasiAta(OzetAlgoritmasi.Kilavuz.AlgoritmaAta(ozetAlgoritma).Olustur())
                       .OzetDegeriAta(ozetDegeri).Olustur(),
                URI  = uri.ToString(),
                Type = hariciBilesenMi
                    ? Constants.HARICI_PAKET_BILESENI_REFERANS_TIPI
                    : Constants.DAHILI_PAKET_BILESENI_REFERANS_TIPI
            };

            if (paketVersiyon == PaketVersiyonTuru.Versiyon2X)
            {
                yeniReferans.Ozet1 = Ozet.Kilavuz
                                     .OzetAlgoritmasiAta(OzetAlgoritmasi.Kilavuz.AlgoritmaAta(OzetAlgoritmaTuru.SHA512).Olustur())
                                     .OzetDegeriAta(ozetDegeriSha512).Olustur();
            }

            paketOzeti.Referanslar.Add(yeniReferans);
        }
Beispiel #7
0
        public void DeleteReference(int referenceId)
        {
            using (AlacaYazilimWebSiteEntities entities = new AlacaYazilimWebSiteEntities())
            {
                Referans dbReference = entities.Referans.FirstOrDefault(f => f.ReferansId == referenceId);

                entities.Referans.Remove(dbReference);

                entities.SaveChanges();
            }
        }
Beispiel #8
0
        public void SaveReference(Referans reference)
        {
            using (AlacaYazilimWebSiteEntities entities = new AlacaYazilimWebSiteEntities())
            {
                reference.CreateDate = DateTime.Now;
                reference.Aktif      = true;
                entities.Referans.Add(reference);

                entities.SaveChanges();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string gelenid = Request.QueryString["ID"];

            KurumsalContext ctx = new KurumsalContext();
            Referans        r   = ctx.Referanslar.Find(Convert.ToInt32(gelenid));

            ctx.Referanslar.Remove(r);
            ctx.SaveChanges();

            Response.Redirect("/Referanslar.aspx");
        }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         KurumsalContext ctx = new KurumsalContext();
         Referans        r   = new Referans();
         r.AdSoyad = Request.Form["adsoyad"]; //name i adsoyad olan inputa yazılan buraya gelir.
         r.Mesaj   = Request.Form["mesaj"];
         ctx.Referanslar.Add(r);
         ctx.SaveChanges();
     }
 }
        public ActionResult ReferansSilOk(int?id)
        {
            Referans refe = new Referans();

            using (ModelDB db = new ModelDB())
            {
                refe = db.Referans.Where(x => x.id == id).FirstOrDefault();
                db.Referans.Remove(refe);
                db.SaveChanges();
            }
            return(RedirectToAction("referanslar", "Admin"));
        }
        // GET: Panel/Referans/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Referans referans = db.Referanslar.Find(id);

            if (referans == null)
            {
                return(HttpNotFound());
            }
            return(View(referans));
        }
        public ActionResult Create([Bind(Include = "ReferansID,FirmaAd,ReferansURL,ReferansImageUrl")] Referans referans, HttpPostedFileBase ReferansImage)
        {
            if (ModelState.IsValid)
            {
                if (ReferansImage != null)
                {
                    var path = Server.MapPath("/Uploads/Referans/");
                    ReferansImage.SaveAs(path + ReferansImage.FileName);
                    referans.ReferansImageUrl = ReferansImage.FileName;
                }
                db.Referanslar.Add(referans);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(referans));
        }
        public ActionResult ReferansSil(int?id)
        {
            if (Session["ActiveUser"] != null)
            {
                ViewBag.UserName = Session["ActiveUser"].ToString();
            }
            else
            {
                return(RedirectToAction("login"));
            }

            ViewBag.UserName = Session["ActiveUser"].ToString();
            using (ModelDB db = new ModelDB())
            {
                Referans refe = db.Referans.Where(x => x.id == id).SingleOrDefault();
                return(View(refe));
            }
        }
        public JsonResult SaveReference()
        {
            NameValueCollection form = HttpContext.Request.Form;

            var reference = new Referans
            {
                ReferansId       = Convert.ToInt32(form["ReferansId"]),
                ReferansFirmaAdi = form["ReferansFirmaAdi"],
                FirmaUrl         = form["FirmaUrl"],
                Aktif            = Convert.ToBoolean(form["Aktif"]),
                ShowInSlider     = Convert.ToBoolean(form["ShowInSlider"]),
                Sira             = !string.IsNullOrEmpty(form["Sira"]) ? Convert.ToInt32(form["Sira"]) : 0
            };

            if (Session[Constants.SessionInformation] != null)
            {
                var user = (User)Session[Constants.SessionInformation];
                reference.CreateUser = user.Id;
            }

            if (Request.Files != null && Request.Files.Count > 0)
            {
                HttpPostedFileBase file = Request.Files[0];

                file.SaveAs(Server.MapPath("/Upload/ReferenceImage/" + file.FileName));

                reference.ResimUrl = file.FileName;
            }

            if (reference.ReferansId <= 0)
            {
                _referenceData.SaveReference(reference);
            }
            else
            {
                _referenceData.UpdateReference(reference);
            }

            return(Json(new Response {
                ErrorMessage = "Kaydedilmiştir", IsSuccess = false
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #16
0
        public void UpdateReference(Referans reference)
        {
            using (AlacaYazilimWebSiteEntities entities = new AlacaYazilimWebSiteEntities())
            {
                Referans dbReference = entities.Referans.FirstOrDefault(f => f.ReferansId == reference.ReferansId);

                dbReference.ReferansFirmaAdi = reference.ReferansFirmaAdi;

                if (!string.IsNullOrEmpty(reference.ResimUrl))
                {
                    dbReference.ResimUrl = reference.ResimUrl;
                }

                dbReference.FirmaUrl     = reference.FirmaUrl;
                dbReference.Sira         = reference.Sira;
                dbReference.Aktif        = reference.Aktif;
                dbReference.ShowInSlider = reference.ShowInSlider;

                entities.SaveChanges();
            }
        }
        public ActionResult YeniReferans(FormCollection form)
        {
            string   refad    = form["refad"].ToString();
            string   refsoyad = form["refsoyad"].ToString();
            string   sirket   = form["sirket"].ToString();
            string   telefon  = form["telefon"].ToString();
            string   gorev    = form["gorev"].ToString();
            Referans r        = new Referans();

            using (ModelDB db = new ModelDB())
            {
                r.refAd      = refad;
                r.refSoyad   = refsoyad;
                r.refSirket  = sirket;
                r.refTelefon = telefon;
                r.refGorev   = gorev;
                db.Referans.Add(r);
                db.SaveChanges();
            }
            return(RedirectToAction("referanslar"));
        }
        public ActionResult ReferansGuncelle(FormCollection form, int id)
        {
            string refad    = form["refad"].ToString();
            string refsoyad = form["refsoyad"].ToString();
            string sirket   = form["sirket"].ToString();
            string telefon  = form["telefon"].ToString();
            string gorev    = form["gorev"].ToString();

            using (ModelDB db = new ModelDB())
            {
                Referans r = db.Referans.Where(x => x.id == id).SingleOrDefault();
                r.refAd      = refad;
                r.refSoyad   = refsoyad;
                r.refSirket  = sirket;
                r.refTelefon = telefon;
                r.refGorev   = gorev;

                db.SaveChanges();
            }
            return(RedirectToAction("referanslar"));
        }
Beispiel #19
0
        public JsonResult Sil(Referans referans)
        {
            Referans dbReferans = db.Referans.Find(referans.ID);

            if (referans == null)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Referans Bulunamadı ! "
                }));
            }
            try
            {
                if (dbReferans.ResimURL != null)
                {
                    string ResimURL  = dbReferans.ResimURL;
                    string ResimPath = Server.MapPath(ResimURL);

                    FileInfo file = new FileInfo(ResimPath);
                    if (file.Exists)
                    {
                        file.Delete();
                    }
                }
                db.Referans.Remove(dbReferans);
                db.SaveChanges();
                return(Json(new ResultJson {
                    Success = true, Message = "Referans Silme İşleminiz Başarılı ! "
                }));
            }
            catch (Exception ex)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Referans Silme İşleminiz Başarısız ! "
                }));
            }
        }
Beispiel #20
0
 public void Guncelle(Referans referans)
 {
     _referansDal.Guncelle(referans);
 }
Beispiel #21
0
 public void Ekle(Referans referans)
 {
     _referansDal.Ekle(referans);
 }