Пример #1
0
        public static Abone SporHaberAboneOl(string threadName)
        {
            Abone abone = new Abone(threadName);

            abone.AboneOlSpor();
            return(abone);
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Tarih.Format       = DateTimePickerFormat.Custom;
            Tarih.CustomFormat = "MM-yyyy";
            Tarih.ShowUpDown   = true;

            btnKaydet.Enabled = false;
            GroupBoxFaturaBilgileri.Enabled = false;

            using (IzsuDBContext context = new IzsuDBContext())
            {
                var result = context.AboneTuru.ToList();

                foreach (var item in result)
                {
                    cBoxAboneTuru.Items.Add(item);
                }

                //int yeniAboneNo = context.Abone.OrderByDescending(a => a.AboneNo).FirstOrDefault().AboneNo++;

                Abone _abone      = context.Abone.OrderByDescending(a => a.AboneNo).FirstOrDefault();
                int   yeniAbeneNo = _abone.AboneNo;
                yeniAbeneNo++;

                txtAdoneNo.Text = yeniAbeneNo.ToString();
            }
        }
Пример #3
0
 public static void AddAbone(Abone abone)
 {
     using (IzsuDBContext db = new IzsuDBContext())
     {
         db.Abone.Add(abone);
         db.SaveChanges();
     }
 }
Пример #4
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Abone abone = db.Abones.Find(id);

            if (abone == null)
            {
                return(HttpNotFound());
            }
            abone.Faturalar = db.Faturas.Where(i => i.AboneId == abone.Id).ToList();
            if (abone.Faturalar != null)
            {
                int borc = abone.Borc;
                foreach (var item in abone.Faturalar)
                {
                    if (item.OdemeDurum == false && item.Tarih < DateTime.Now)
                    {
                        borc += item.Tutar;
                    }
                }

                if (abone.Depozito == borc)
                {
                    abone.Depozito = abone.Depozito - borc;
                    foreach (var fatura in db.Faturas.Where(i => i.AboneId == abone.Id).ToList())
                    {
                        db.Faturas.Remove(fatura);
                    }

                    db.Abones.Remove(abone);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else if (abone.Depozito > borc)
                {
                    abone.Depozito = abone.Depozito - borc;
                    foreach (var fatura in db.Faturas.Where(i => i.AboneId == abone.Id).ToList())
                    {
                        db.Faturas.Remove(fatura);
                    }
                    //ViewBag.iade = "İade edilecek tutar : " + abone.Depozito;
                    TempData["iade"] = "İade edilecek tutar : " + abone.Depozito;
                    db.Abones.Remove(abone);
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }

            Session["hata"] = "Depozito miktarı borcunuzu odeyecek tutarda degil !";

            return(RedirectToAction("Index"));
        }
Пример #5
0
 public static void UpdateAbone(Abone abone)
 {
     using (IzsuDBContext db = new IzsuDBContext())
     {
         var result = db.Abone.FirstOrDefault(a => a.AboneID == abone.AboneID);
         result.AboneAdSoyad = abone.AboneAdSoyad;
         result.AboneTuruID  = abone.AboneTuruID;
         db.SaveChanges();
     }
 }
Пример #6
0
 public ActionResult Edit([Bind(Include = "Id,Ad,Soyad,Numara,Tur,Depozito,Borc,KullaniciAdi,Sifre,GiseId")] Abone abone)
 {
     if (ModelState.IsValid)
     {
         db.Entry(abone).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GiseId = new SelectList(db.Gises, "Id", "KullaniciAdi", abone.GiseId);
     return(View(abone));
 }
Пример #7
0
        // GET: Abones/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Abone abone = db.Abones.Find(id);

            if (abone == null)
            {
                return(HttpNotFound());
            }
            return(View(abone));
        }
Пример #8
0
        // GET: Abones/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Abone abone = db.Abones.Find(id);

            if (abone == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GiseId = new SelectList(db.Gises, "Id", "KullaniciAdi", abone.GiseId);
            return(View(abone));
        }
Пример #9
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            Abone a = new Abone();

            a.AboneNo      = int.Parse(txtAdoneNo.Text);
            a.AboneAdSoyad = txtAdSoyad.Text;

            AboneTuru at = (AboneTuru)cBoxAboneTuru.SelectedItem;

            a.AboneTuruID  = at.AboneTuruID;
            at.AboneTuruAd = "hususi";

            using (IzsuDBContext context = new IzsuDBContext())
            {
                context.Abone.Add(a);
                context.SaveChanges();
            }
        }
        protected void kaydet_Click(object sender, EventArgs e)
        {
            Abone yeniAbone = new Abone();

            yeniAbone.AboneAdSoyad = TxtAdSoyad.Text;


            if (DropDownListAboneTipi.SelectedIndex == 0)
            {
                yeniAbone.AboneTuruID = 1;
            }
            else
            {
                yeniAbone.AboneTuruID = 2;
            }

            AboneRepository.AddAbone(yeniAbone);

            Response.Redirect("TumAboneler.aspx");
        }
Пример #11
0
        // GET: Home
        public ActionResult Index()
        {
            if (db.Gises.Count() == 0)
            {
                Gise gise = new Gise();
                gise.KullaniciAdi = "gise";
                gise.Sifre        = "gise";
                db.Gises.Add(gise);
                db.SaveChanges();
            }

            Abone abone = (Abone)Session["CurrentAbone"];

            if (abone == null)
            {
                ViewBag.isim = "deneme";
                return(View());
            }
            ViewBag.isim = abone.Ad;
            return(View());
        }
Пример #12
0
        static void Main(string[] args)
        {
            SporHaber    shaber = SporHaber.getInstance();
            EkonomiHaber ehaber = EkonomiHaber.getInstance();

            #region thread 1,3,5
            Thread th1 = new Thread(() => abone1 = SporHaberAboneOl("th1"));
            Thread th3 = new Thread(() => abone3 = SporHaberAboneOl("th3"));
            Thread th5 = new Thread(() => abone5 = SporHaberAboneOl("th5"));
            th1.Start(); th3.Start(); th5.Start();
            #endregion

            #region thread 2,4,6
            Thread th2 = new Thread(() => EkonomiHaberAboneOl("th2"));
            Thread th4 = new Thread(() => EkonomiHaberAboneOl("th4"));
            Thread th6 = new Thread(() => EkonomiHaberAboneOl("th6"));
            th2.Start(); th4.Start(); th6.Start();
            #endregion


            ehaber.notifyObserver();
            Console.WriteLine("------------------");
            shaber.notifyObserver();

            #region Abone1 Spor haberlerinden ayrılıyor
            Console.WriteLine("-------------");
            abone1.AbonelikSilSpor();
            shaber.notifyObserver();
            #endregion

            #region Abone3 Ekonomi haberlerini ekliyor
            abone3.AboneOlEkonomi();
            Console.WriteLine("--------------");
            ehaber.notifyObserver();
            #endregion



            Console.Read();
        }
Пример #13
0
        public ActionResult AboneOl(string Email)
        {
            var deger = 0;

            if (Email.Contains("@") == true)
            {
                if (!_unitOfWork.Abone.Any(x => x.EMail == Email))
                {
                    Abone abone = new Abone
                    {
                        EMail       = Email,
                        AboneMi     = true,
                        CreatedDate = DateTime.Now
                    };
                    _unitOfWork.Abone.Insert(abone);
                    _unitOfWork.Save();
                    string mailbody = "";
                    mailbody += "Lütfen bu maili cevaplamayın <br/>";
                    mailbody += "Bültenden çıkmak için <a href=\"https://www.becomingtur.com/abone-cikis?source=" + abone.EMail + "\" target=\"_blank\">bu linke</a> tıklayın. <br/>";

                    Smtp.AboneMailGonder(mailbody, Email);
                    deger = 1;
                    //1
                    return(Json(deger));
                }
                else
                {
                    //0
                    return(Json(deger));
                }
            }
            else
            {
                //2
                deger = 2;
                return(Json(deger));
            }
        }
        protected void ButtonKaydet_Click(object sender, EventArgs e)
        {
            Abone degisenAbone = new Abone();

            degisenAbone.AboneID = int.Parse(AboneNo.Value);

            degisenAbone.AboneAdSoyad = TxtAdSoyad.Text;

            if (DropDownListAboneTipi.SelectedIndex == 0) //Ev
            {
                degisenAbone.AboneTuruID = 1;
            }
            else
            {
                degisenAbone.AboneTuruID = 2;
            }


            AboneRepository.UpdateAbone(degisenAbone);


            Response.Redirect("TumAboneler.aspx");
        }
Пример #15
0
        public static void EkonomiHaberAboneOl(string threadName)
        {
            Abone abone = new Abone(threadName);

            abone.AboneOlEkonomi();
        }