public List <MusteriDTO> MapAll(IEnumerable <Musteri> model) { var musteriler = new List <MusteriDTO>(); foreach (var ent in model.ToList()) { var musteri = new MusteriDTO(); musteri.musteriNo = ent.musteriNo; musteri.tckn = ent.tckn; musteri.sifre = ent.sifre; musteri.ad = ent.ad; musteri.soyad = ent.soyad; musteri.dogumTarihi = ent.dogumTarihi; musteri.kayıtTarihi = ent.kayıtTarihi; musteri.cepTelefonu = ent.cepTelefonu; musteri.mail = ent.mail; musteri.acikAdres = ent.acikAdres; musteri.acilisPlatformID = ent.acilisPlatformID; musteri.acilisPlatformAdi = ent.AcilisPlatformu.acilisPlatformAdi; musteriler.Add(musteri); } return(musteriler); }
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 MusteriDTO Customer(int musteriID) { try { MusteriDTO musteri = (from m in _musteriRepo.GetAll() join a in _aracRepo.GetAll() on m.AracID equals a.AracID join mk in _markaRepo.GetAll() on a.MarkaID equals mk.MarkaID join md in _modelRepo.GetAll() on a.ModelID equals md.ModelID where m.MusteriID == musteriID select new MusteriDTO { MusteriID = m.MusteriID, HizmetTuru = m.HizmetTuru, Aciklama = m.Aciklama, Plaka = a.Plaka, Marka = mk.Marka, MarkaID = mk.MarkaID, Model = md.Model, ModelID = md.ModelID, Tutar = m.Tutar, Durum = m.Durum, AracId = m.AracID }).FirstOrDefault(); return(musteri); } catch (Exception ex) { throw new Exception(ex.Message); } }
private void FrmMusteriListesi_Load(object sender, EventArgs e) { dto = bll.Select(); dataGridView1.DataSource = dto.Musteriler; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].HeaderText = "Müşteri Adı"; }
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 void Update(MusteriDTO model) { using (MusteriRepository musteriRepo = new MusteriRepository()) { try { var musteri = new Musteri(); musteri.sifre = model.sifre; musteri.tckn = model.tckn; musteri.ad = model.ad; musteri.soyad = model.soyad; musteri.dogumTarihi = model.dogumTarihi; musteri.kayıtTarihi = model.kayıtTarihi; musteri.cepTelefonu = model.cepTelefonu; musteri.mail = model.mail; musteri.acikAdres = model.acikAdres; musteri.acilisPlatformID = model.acilisPlatformID; musteriRepo.Update(musteri); } catch { throw; } } }
public IHttpActionResult Update(MusteriDTO model) { MusteriBLL musteriBusiness = new MusteriBLL(); musteriBusiness.Update(model); return(Ok()); }
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 ActionResult MusteriEkle(MusteriDTO m) { if (ModelState.IsValid) { Musteri musteri = new Musteri() { Adi = m.Adi, Soyadi = m.Soyadi, Email = m.Email, Telefon = m.Telefon }; DataService.Service.MusteriService.Insert(musteri); } return(RedirectToAction("Index")); }
public int CustomerInsert(MusteriDTO musteri, int aracID) { try { var musteriEntity = AutoMapper.Mapper.DynamicMap <Musteri>(musteri); musteriEntity.AracID = aracID; musteriEntity.Durum = true; _musteriRepo.Insert(musteriEntity); _uow.SaveChanges(); return(musteriEntity.MusteriID); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool CustomerUpdate(MusteriDTO musteri) { try { var musteriEntity = _musteriRepo.Find(musteri.MusteriID); AutoMapper.Mapper.DynamicMap(musteri, musteriEntity); _musteriRepo.Update(musteriEntity); _uow.SaveChanges(); return(true); } catch (Exception ex) { return(false); throw new Exception(ex.Message); } }
private void btnSil_Click(object sender, EventArgs e) { if (detay.ID == 0) { MessageBox.Show("Müşteri seçin"); } DialogResult result = MessageBox.Show("Silinsinmi", "Dikkat", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (bll.Delete(detay)) { MessageBox.Show("Silindi"); bll = new MusteriBLL(); dto = bll.Select(); dataGridView1.DataSource = dto.Musteriler; } } }
private void btnGuncelle_Click(object sender, EventArgs e) { if (detay.ID == 0) { MessageBox.Show("Müşteri seçiniz"); } else { FrmMusteri frm = new FrmMusteri(); frm.isUpdate = true; frm.detaydto = detay; this.Hide(); frm.ShowDialog(); this.Visible = true; bll = new MusteriBLL(); dto = bll.Select(); dataGridView1.DataSource = dto.Musteriler; } }
public MusteriDTO Map(Musteri ent) { var musteri = new MusteriDTO(); musteri.musteriNo = ent.musteriNo; musteri.tckn = ent.tckn; musteri.sifre = ent.sifre; musteri.ad = ent.ad; musteri.soyad = ent.soyad; musteri.dogumTarihi = ent.dogumTarihi; musteri.kayıtTarihi = ent.kayıtTarihi; musteri.cepTelefonu = ent.cepTelefonu; musteri.mail = ent.mail; musteri.acikAdres = ent.acikAdres; musteri.acilisPlatformID = ent.acilisPlatformID; musteri.acilisPlatformAdi = ent.AcilisPlatformu.acilisPlatformAdi; return(musteri); }
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)); }
public void Add(MusteriDTO entity) { var musteri = Mapper.Map <tblMusteri>(entity); musteriService.Add(musteri); }
public void Update(MusteriDTO entity) { var musteri = Mapper.Map <tblMusteri>(entity); musteriService.Update(musteri); }