Ejemplo n.º 1
0
        public bool Transfer(string GonderenHesapNo, string AlanHesapNo, decimal Miktar)
        {
            try
            {
                Hesap GonderenHesap = null;
                Hesap AlanHesap     = null;
                using (var repo = new HesapRepository())
                {
                    GonderenHesap = repo.HesapNoSec(GonderenHesapNo);
                    if (GonderenHesap.Bakiye >= Miktar)
                    {
                        AlanHesap = repo.HesapNoSec(AlanHesapNo);

                        repo.HesapNoBakiyeGuncelle(GonderenHesapNo, GonderenHesap.Bakiye - Miktar);
                        repo.HesapNoBakiyeGuncelle(AlanHesapNo, AlanHesap.Bakiye + Miktar);
                        return(true);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("HesapBusiness:HesapRepository:Seçme Hatası", ex);
            }
        }
Ejemplo n.º 2
0
        public bool BorcOde(int AboneNo, string HesapNo)
        {
            var repo2 = new HesapRepository();

            try
            {
                using (var repo = new OdemeRepository())
                {
                    Odeme o      = repo.AboneNoSec(AboneNo);
                    Hesap h      = repo2.HesapNoSec(HesapNo);
                    var   bakiye = h.Bakiye;
                    var   borc   = o.Borc;
                    if (borc > 0 && borc <= bakiye)
                    {
                        bakiye -= borc;
                        borc    = 0;
                        repo2.HesapBakiyeGuncelle(h.HesapID, bakiye);
                        repo.BorcOde(AboneNo);

                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw new Exception("OdemeBusiness:OdemeRepository:Ödeme Hatası", ex);
            }
        }
Ejemplo n.º 3
0
 public IList <Hesap> tumHesaplar()
 {
     using (var repo = new HesapRepository())
     {
         return(repo.TumHesaplar());
     }
 }
Ejemplo n.º 4
0
 public IList <Hesap> hepsiniSec(int MusteriID)
 {
     using (var repo = new HesapRepository())
     {
         return(repo.HepsiniSec(MusteriID));
     }
 }
 public void Delete(int id)
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             hesapRepo.Delete(id);
         }
         catch
         {
             throw;
         }
     }
 }
 public List <HesapDTO> GetByMusteriNo(int?musteriNo)
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             var model = hesapRepo.GetByFilter(x => x.musteriNo == musteriNo, x => x.Musteri, x => x.AcilisPlatformu);
             return(hesapMapper.MapAll(model));
         }
         catch
         {
             throw;
         }
     }
 }
 public HesapDTO GetById(int id)
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             var model = hesapRepo.GetById(x => x.hesapNo == id, x => x.Musteri, x => x.AcilisPlatformu);
             return(hesapMapper.Map(model));
         }
         catch
         {
             throw;
         }
     }
 }
 public List <HesapDTO> Get()
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             var model = hesapRepo.Get(x => x.Musteri, x => x.AcilisPlatformu).ToList();
             return(hesapMapper.MapAll(model));
         }
         catch
         {
             throw;
         }
     }
 }
 public decimal ToplamBakiye(int id)
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             decimal toplamBakiye = hesapRepo.ToplamBakiye(id);
             return(toplamBakiye);
         }
         catch
         {
             throw;
         }
     }
 }
 public void ParaIslem(int hesapNo, decimal tutar)
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             var model = hesapRepo.GetById(x => x.hesapNo == hesapNo, x => x.Musteri, x => x.AcilisPlatformu);
             model.bakiye += tutar;
             hesapRepo.Update(model);
         }
         catch
         {
             throw;
         }
     }
 }
Ejemplo n.º 11
0
 public Hesap HesapIdSec(int HesapId)
 {
     try
     {
         Hesap responseEntitiy = null;
         using (var repo = new HesapRepository())
         {
             responseEntitiy = repo.IdSec(HesapId);
         }
         return(responseEntitiy);
     }
     catch (Exception ex)
     {
         throw new Exception("HesapBusiness:HesapRepository:Seçme Hatası", ex);
     }
 }
Ejemplo n.º 12
0
 public Hesap HesapGoruntule(int musteriID)
 {
     try
     {
         Hesap responseEntitiy = null;
         using (var repo = new HesapRepository())
         {
             responseEntitiy = repo.MusterIDSec(musteriID);
         }
         return(responseEntitiy);
     }
     catch (Exception ex)
     {
         throw new Exception("HesapBusiness:HesapRespository:Goruntuleme Hatası", ex);
     }
 }
Ejemplo n.º 13
0
 public Hesap HesapGuncelle(Hesap entity)
 {
     try
     {
         using (var repo = new HesapRepository())
         {
             if (repo.Guncelle(entity))
             {
                 return(entity);
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new Exception("HesapBusiness:HesapRepository:Güncelleme Hatası", ex);
     }
 }
Ejemplo n.º 14
0
 public Hesap HesapDurumGuncelle(int HesapID, string durum)
 {
     try
     {
         using (var repo = new HesapRepository())
         {
             if (repo.hesapIdGuncelle(HesapID, durum))
             {
                 return(repo.IdSec(HesapID));
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new Exception("HesapBusiness:HesapRepository:Güncelleme Hatası", ex);
     }
 }
        public void HavaleVirman(int aliciHesapNo, int gonderenHesapNo, decimal tutar)
        {
            using (HesapRepository hesapRepo = new HesapRepository())
            {
                try
                {
                    var alici = hesapRepo.GetById(x => x.hesapNo == aliciHesapNo, x => x.Musteri, x => x.AcilisPlatformu);
                    alici.bakiye += tutar;
                    hesapRepo.Update(alici);

                    var gonderen = hesapRepo.GetById(x => x.hesapNo == gonderenHesapNo, x => x.Musteri, x => x.AcilisPlatformu);
                    gonderen.bakiye -= tutar;
                    hesapRepo.Update(gonderen);
                }
                catch
                {
                    throw;
                }
            }
        }
Ejemplo n.º 16
0
        public Hesap HesapEkle(Hesap entity, int MusteriID, int ek)
        {
            string hesap = MusteriID.ToString() + "00" + ek.ToString();

            try
            {
                using (var repo = new HesapRepository())
                {
                    if (repo.Ekle(entity, MusteriID, hesap))
                    {
                        return(entity);
                    }
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw new Exception("HesapBusiness:HesapRepository:Ekleme Hatası", ex);
            }
        }
 public void Add(HesapDTO model)
 {
     using (HesapRepository hesapRepo = new HesapRepository())
     {
         try
         {
             var hesapAdet = GetByMusteriNo(model.musteriNo).Count;
             var hesap     = new Hesap();
             hesap.musteriNo         = model.musteriNo;
             hesap.ekNo              = 10 + hesapAdet;
             hesap.hesapNo           = Convert.ToInt32(model.musteriNo.ToString() + hesap.ekNo.ToString());
             hesap.hesapAcilisTarihi = model.hesapAcilisTarihi;
             hesap.bakiye            = model.bakiye;
             hesap.acilisPlatformID  = model.acilisPlatformID;
             hesapRepo.Add(hesap);
         }
         catch
         {
             throw;
         }
     }
 }