예제 #1
0
 public bool SehirGuncelle(SehirTumDTO Seh)
 {
     try
     {
         using (var unitOfWork = new UnitOfWork(new QtekBilisim_MuhasebeContext()))
         {
             var temp = unitOfWork.SehirKayitlari.FindData(Seh.SehirID);
             if (temp != null)
             {
                 temp.AktifMi         = Seh.AktifMi;
                 temp.DilID           = Seh.DilID;
                 temp.GuncellemeTarih = Seh.GuncellemeTarih;
                 temp.SehirAd         = Seh.SehirAd;
                 temp.SirketID        = Seh.SirketID;
                 temp.UlkeID          = Seh.UlkeID;
                 temp.KullaniciID     = Seh.KullaniciID;
                 if (unitOfWork.SehirKayitlari.IsModified(temp) == true)
                 {
                     int affect = unitOfWork.Complete();
                     if (affect > 0)
                     {
                         return(true);
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else
                 {
                     throw new NotModifiedDataOnDatabaseCustomException();
                 }
             }
             else
             {
                 throw new NullDataOnDatabaseCustomException();
             }
         }
     }
     catch (NotImplementedException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyNotImplementedException();
     }
     catch (DbEntityValidationException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyDbEntityValidationException();
     }
     catch (ArgumentNullException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyArgumentNullException();
     }
     catch (ArgumentException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyArgumentException();
     }
     catch (InvalidOperationException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyInvalidOperationException();
     }
     catch (NullReferenceException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyNullReferenceException();
     }
     catch (AggregateException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyAggregateException();
     }
     catch (FormatException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyFormatException();
     }
     catch (NullDataOnDatabaseCustomException)
     {
         throw new NullDataOnDatabaseCustomException();
     }
     catch (NotModifiedDataOnDatabaseCustomException)
     {
         throw new NotModifiedDataOnDatabaseCustomException();
     }
     catch (Exception error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new Exception();
     }
 }
예제 #2
0
 public bool SehirEkle(SehirTumDTO seh)
 {
     try
     {
         using (var unitOfWork = new UnitOfWork(new QtekBilisim_MuhasebeContext()))
         {
             unitOfWork.SehirKayitlari.AddData(new Sehir()
             {
                 AktifMi         = seh.AktifMi,
                 DilID           = seh.DilID,
                 GuncellemeTarih = seh.GuncellemeTarih,
                 KayitTarih      = seh.KayitTarih,
                 SehirAd         = seh.SehirAd,
                 SilindiMi       = seh.SilindiMi,
                 SirketID        = seh.SirketID,
                 UlkeID          = seh.UlkeID,
                 KullaniciID     = seh.KullaniciID
             });
             int affect = unitOfWork.Complete();
             if (affect > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (NotImplementedException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyNotImplementedException();
     }
     catch (DbEntityValidationException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyDbEntityValidationException();
     }
     catch (ArgumentNullException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyArgumentNullException();
     }
     catch (ArgumentException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyArgumentException();
     }
     catch (InvalidOperationException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyInvalidOperationException();
     }
     catch (NullReferenceException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyNullReferenceException();
     }
     catch (AggregateException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyAggregateException();
     }
     catch (FormatException error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new MyFormatException();
     }
     catch (NullDataOnDatabaseCustomException)
     {
         throw new NullDataOnDatabaseCustomException();
     }
     catch (NotModifiedDataOnDatabaseCustomException)
     {
         throw new NotModifiedDataOnDatabaseCustomException();
     }
     catch (Exception error)
     {
         HataKayitManager.HataKayitEkle(error);
         throw new Exception();
     }
 }