public ActionResult CustomerParkInsert(MusteriDTO musteri, MusteriParkDTO park) { AracDTO arac = new AracDTO(); arac.MarkaID = musteri.MarkaID; arac.ModelID = musteri.ModelID; arac.Plaka = musteri.Plaka; int aracID; aracID = _aracService.GetCar(arac.Plaka); if (aracID == 0) { aracID = _aracService.Insert(arac); } 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); _musteriService.CustomerParkInsert(park, musteriID); return(RedirectToAction("CustomerList", "Customer")); }
public ActionResult CustomerPaymentInsert(MusteriParkDTO park) { DateTime bas = Convert.ToDateTime(park.GirisTarihi); DateTime son = Convert.ToDateTime(park.CikisTarihi); var fark = (son - bas).Hours; var fiyat = fark * 10; MusteriDTO musteri = _musteriService.Customer(park.MusteriID); musteri.Tutar = fiyat; musteri.Durum = false; bool durum = _musteriService.CustomerUpdate(musteri); if (durum == true) { bool parkdurum = _musteriService.CustomerParkUpdate(park); if (parkdurum == true) { GelirlerDTO gelir = new GelirlerDTO(); gelir.GelirTuru = "Müsteri Park Ödeme"; gelir.OdemeTarihi = Convert.ToDateTime(park.CikisTarihi); gelir.Tutar = Convert.ToDecimal(fiyat); gelir.AracID = Convert.ToInt32(musteri.AracId); _gelirService.Insert(gelir); } } return(RedirectToAction("CustomerList", "Customer")); }
public ActionResult CustomerPayment(int id) { MusteriDTO musteri = _musteriService.Customer(id); MusteriParkDTO park = _musteriService.CustomerPark(id); MusteriViewModel model = new MusteriViewModel(); model.Musteri = musteri; model.Park = park; return(View(model)); }
public CustomerService(UnitofWork uow) { _uow = uow; _musteriRepo = _uow.GetRepository <Musteri>(); _parkRepo = _uow.GetRepository <MusteriPark>(); _yikamaRepo = _uow.GetRepository <MusteriYikama>(); _aracRepo = _uow.GetRepository <Arac>(); _markaRepo = _uow.GetRepository <AracMarka>(); _modelRepo = _uow.GetRepository <AracModel>(); _musteriDTO = new MusteriDTO(); _parkDTO = new MusteriParkDTO(); _yikamaDTO = new MusteriYikamaDTO(); }
public void CustomerParkInsert(MusteriParkDTO park, int musteriID) { try { var entity = AutoMapper.Mapper.DynamicMap <MusteriPark>(park); entity.MusteriID = musteriID; entity.GirisTarihi = DateTime.Now; _parkRepo.Insert(entity); _uow.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool CustomerParkUpdate(MusteriParkDTO park) { try { var parkEntity = _parkRepo.Find(park.ParkID); AutoMapper.Mapper.DynamicMap(park, parkEntity); _parkRepo.Update(parkEntity); _uow.SaveChanges(); return(true); } catch (Exception ex) { return(false); 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)); }