public SubscriberService(UnitofWork uow) { _uow = uow; _aboneRepo = _uow.GetRepository <Abone>(); _aboneDTO = new AboneDTO(); _giriscikisRepo = _uow.GetRepository <AboneGiriCikis>(); _giriscikisDTO = new AboneGirisCikisDTO(); _odemeRepo = _uow.GetRepository <AboneOdeme>(); _odemeDTO = new AboneOdemeDTO(); }
public void Update(AboneDTO abone) { try { var aboneEntity = _aboneRepo.Find(abone.AboneID); AutoMapper.Mapper.DynamicMap(abone, aboneEntity); _aboneRepo.Update(aboneEntity); _uow.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult SubscriberInsert(AboneDTO abone, UyeDTO uye, AracDTO arac) { uye.KullaniciAdi = (abone.Adi + abone.Soyad).Trim().Replace(" ", string.Empty).ToLower(); uye.Parola = PassManager.Base64Encrypt(abone.TCNO); int uyeID = _uyeService.Insert(uye); int aracID; aracID = _aracService.GetCar(arac.Plaka); if (aracID == 0) { aracID = _aracService.Insert(arac); } _aboneService.Insert(abone, uyeID, aracID); return(RedirectToAction("SubscriberList", "Subscriber")); }
public void Insert(AboneDTO abone, int uyeID, int aracID) { try { var entity = AutoMapper.Mapper.DynamicMap <Abone>(abone); entity.Durum = true; entity.KayitTarihi = DateTime.Now; entity.YetkiID = 3; entity.UyeID = uyeID; entity.AracID = aracID; entity.KayitTarihi = DateTime.Now; entity.Islem = "Giriş Yaptı"; _aboneRepo.Insert(entity); _uow.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult AracPlakaOkumaModel(string Plaka, string Bolge, string Marka, string Kasa, string Model, string Renk) { int aracID; aracID = _aracService.GetCar(Plaka); if (aracID == 0) { AracDTO arac = new AracDTO(); arac.Bolge = Bolge; arac.Plaka = Plaka; arac.Renk = Renk; arac.Kasa = Kasa; AracMarkaDTO marka = _aracService.GetCarBrand(Marka); if (marka != null) { arac.MarkaID = marka.MarkaID; AracModelDTO model = _aracService.GetCarModel(marka.MarkaID, Model.Split('_')[1]); if (model != null) { arac.ModelID = model.ModelID; } else { AracModelDTO mo = new AracModelDTO(); mo.MarkaID = marka.MarkaID; mo.Model = Model.Split('_')[1]; int modelId = _aracService.CarModelInsert(mo); arac.ModelID = modelId; } } else { AracMarkaDTO m = new AracMarkaDTO(); m.Marka = Marka; int markaId = _aracService.CarBrandInsert(m); arac.MarkaID = markaId; AracModelDTO mo = new AracModelDTO(); mo.MarkaID = markaId; mo.Model = Model; int modelId = _aracService.CarModelInsert(mo); arac.ModelID = modelId; } aracID = _aracService.Insert(arac); } if (!_aracService.GetBlackListCarControl(aracID)) { AboneDTO abone = _aboneService.GetSubscriber(aracID); if (abone != null) { AboneGirisCikisDTO kontrol = new AboneGirisCikisDTO(); kontrol.AboneId = abone.AboneID; kontrol.Durum = true; kontrol.Tarih = DateTime.Now; bool durum = _aboneService.SubscriberInputOutput(kontrol); if (durum == true) { var islemdurum = abone.Islem; if (islemdurum == "Giriş Yaptı") { abone.Islem = "Çıkış Yaptı"; } else if (islemdurum == "Çıkış Yaptı") { abone.Islem = "Giriş Yaptı"; } _aboneService.Update(abone); } } else { MusteriDTO musteri = new MusteriDTO(); musteri.HizmetTuru = "Park"; if (musteri.Aciklama == null) { musteri.Aciklama = "Açıklama Girilmedi."; } if (musteri.Tutar == null) { musteri.Tutar = 0; } int musteriID = _musteriService.CustomerInsert(musteri, aracID); MusteriParkDTO park = new MusteriParkDTO(); park.MusteriID = musteriID; park.GirisTarihi = DateTime.Now; _musteriService.CustomerParkInsert(park, musteriID); } } else { return(Json("fail", JsonRequestBehavior.AllowGet)); } return(Json("success", JsonRequestBehavior.AllowGet)); }