public bool EditPeriodeAkuntansi(PeriodeAkuntansi oData) { methodName = "EditPeriodeAkuntansi"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.PeriodeAkuntansi.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.PeriodeAkuntansi.Update(oDBData); uow.Save(); traceID = 4; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
public bool RemovePeriodeAkuntansi(int id) { methodName = "RemovePeriodeAkuntansi"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; PeriodeAkuntansi oDBPeriodeAkuntansi = uow.PeriodeAkuntansi.SingleOrDefault(m => m.Id == id); if (oDBPeriodeAkuntansi != null) { traceID = 3; uow.PeriodeAkuntansi.Remove(id); uow.Save(); } traceID = 5; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(true); }
public int AddPeriodeAkuntansi(PeriodeAkuntansi oData) { methodName = "AddPeriodeAkuntansi"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; PeriodeAkuntansi oNewPeriodeAkuntansi = new PeriodeAkuntansi(); oNewPeriodeAkuntansi.MapFrom(oData); oNewPeriodeAkuntansi = uow.PeriodeAkuntansi.Add(oNewPeriodeAkuntansi); uow.Save(); traceID = 3; oData.Id = oNewPeriodeAkuntansi.Id; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.Id); }
private void DGAccountPeriod_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.periodeAkuntansiSelected = null; this.isEdit = false; if (DGAccountPeriod.SelectedItem != null) { this.periodeAkuntansiSelected = (PeriodeAkuntansi)DGAccountPeriod.SelectedItem; this.isEdit = true; } }
private PeriodeAkuntansi GetData() { PeriodeAkuntansi oData = new PeriodeAkuntansi(); oData.TahunBukuAwal = DateTime.Parse(DtTahunBukuAwal.Text); oData.TahunBukuAkhir = DateTime.Parse(DtTahunBukuAkhir.Text); oData.CheckboxAktif = !ChkAktif.IsChecked; if (this.accountingPeriodeForm.isEdit == true) { oData.Id = this.accountingPeriodeForm.periodeAkuntansiSelected.Id; } return(oData); }