private void Btn_Simpan_Click(object sender, RoutedEventArgs e) { try { _transportService = new TransportServices(); if (string.IsNullOrEmpty(NoPolisi.Text)) { MessageBox.Show("No Polisi tidak boleh kosong", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } var Dto = new MasterTransportDto(); Dto.NO_POLISI = NoPolisi.Text.ToUpper(); Dto.STATUS = Core.Status.Aktif; var GetDataExisting = _transportService.GetAll().Where(x => !string.IsNullOrEmpty(x.NO_POLISI) && x.NO_POLISI == Dto.NO_POLISI).FirstOrDefault(); if (GetDataExisting != null) { MessageBox.Show("No Polisi sudah ada", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } _transportService.Save(Dto); MessageBox.Show("Save Data Sukses", "Sukses", MessageBoxButton.OK, MessageBoxImage.Information); CloseWin(); } catch (Exception exp) { MessageBox.Show("Save Data Error", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private bool FilterCandidates(object obj) { MasterTransportDto c = (MasterTransportDto)obj; return(filters.Values .Aggregate(true, (prevValue, predicate) => prevValue && predicate(c))); }
public void Save(MasterTransportDto Dto) { var Db = AutoMapper.Mapper.Map <master_transport>(Dto); Uow = new UnitOfWorks(); _masterItemRepo = Uow.GetGenericRepository <master_transport>(); _masterItemRepo.InsertOrUpdate(Db); Uow.SaveChanges(); }