public CustomerModel Save(CustomerModel customer) { if (customer == null) { throw new ArgumentNullException(nameof(customer)); } // validate nama if (customer.CustomerName.Trim() == "") { throw new ArgumentException("CustomerName kosong"); } using (var trans = TransHelper.NewScope()) { if (customer.CustomerID.Trim() == "") { customer.CustomerID = GenNewID(); } _customerDal.Delete(customer.CustomerID); _customerDal.Insert(customer); _pihakKeduaBL.Save(customer); trans.Complete(); } return(customer); }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var expected1 = ReturDepositDataFactory(); _returDepositDal.Insert(expected1); var expected2 = expected1.CloneObject(); expected2.ReturDepositID = "A2"; _returDepositDal.Insert(expected2); var expected = new List <ReturDepositModel> { expected1, expected2 }; // act var actual = _returDepositDal.ListData(expected1.Tgl, expected1.Tgl); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.PihakKeduaName) .Excluding(x => x.JenisKasName)); } }
public void ListData_ValidData_NoEx() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = BukuKasDataFactory(); _jenisTrsKasirDal.Insert(item1); var item2 = item1.CloneObject(); item2.BukuKasID = "A2"; _jenisTrsKasirDal.Insert(item2); var expected = new List <BukuKasModel> { item1, item2 }; // act var actual = _jenisTrsKasirDal.ListData(item1.TglBuku, item1.TglBuku); // assert // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.PihakKetigaName) .Excluding(x => x.JenisTrsKasirName)); } }
public void GenLunasPiutangCancel(LunasPiutangModel lunasPiutang) { using (var trans = TransHelper.NewScope()) { foreach (var item in lunasPiutang.ListPiutangBayar) { // ambil data bpPiutang var bpPiutang = this.GetData(item.PiutangID); if (bpPiutang.ListLunas == null) continue; // ubah ienumerable => list (biar bisa di-remove) var listLunas = new List<BPPiutangDetilModel>(); listLunas.AddRange(bpPiutang.ListLunas); // cari item pelunasannya var pelunasan = listLunas.Find(x => x.ReffID == lunasPiutang.LunasPiutangID); // escape point if (pelunasan == null) continue; // remove listLunas.Remove(pelunasan); bpPiutang.ListLunas = listLunas; // proses this.Save(bpPiutang); } trans.Complete(); } }
private void Save() { var kasBon = new KasBonModel { KasBonID = BiayaIDText.Text, Tgl = TglText.Value.ToString("dd-MM-yyyy"), Jam = JamText.Text, PihakKeduaID = PihakKeduaCombo.SelectedValue.ToString(), JenisKasID = JenisKasCombo.SelectedValue.ToString(), Keterangan = KeteranganText.Text, NilaiKasBon = NilIText.Value }; using (var trans = TransHelper.NewScope()) { var result = _kasBonBL.Save(kasBon); try { _bpKasBL.Generate(result); _bpPiutangBL.GenPiutang(result); } catch (ArgumentException ex) { MessageBox.Show(ex.Message); } trans.Complete(); } }
public void Save() { var repack = new RepackModel { RepackID = _view.RepackID, Tgl = _view.Tgl, Jam = _view.Jam, BPStokID = _view.BPStokID, BrgIDMaterial = _view.BrgIDMaterial, BrgNameMaterial = _view.BrgNameMaterial, QtyMaterial = _view.QtyMaterial, HppMaterial = _view.HppMaterial, BrgIDHasil = _view.BrgIDHasil, BrgNameHasil = _view.BrgIDHasil, QtyHasil = _view.QtyHasil, HppHasil = _view.HppHasil, SlotControl = _view.SlotControl }; using (var trans = TransHelper.NewScope()) { var result = _repackBL.Save(repack); var result2 = _bpStokBL.Generate(result); trans.Complete(); } }
public void Save() { var purchase = new PurchaseModel { PurchaseID = _view.PurchaseID, Tgl = _view.Tgl, Jam = _view.Jam, SupplierID = _view.SupplierID, SupplierName = _view.SupplierName, Keterangan = _view.Catatan, TotalHarga = _view.Total, Diskon = _view.DiskonLain, BiayaLain = _view.BiayaLain, GrandTotal = _view.GrandTotal, ListBrg = _view.ListBrg, IsClosed = _view.IsClosedPO }; purchase.ListBrg = purchase.ListBrg.Where(x => x.BrgID != "").ToList(); using (var trans = TransHelper.NewScope()) { var result = _purchaseBL.Save(purchase); var result2 = _bpPurchaseBL.Generate(result); trans.Complete(); } }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var expected1 = StokInOutDataFactory(); _stokInOutDal.Insert(expected1); var expected2 = StokInOutDataFactory2(); expected2.StokInID = expected1.StokInID; _stokInOutDal.Insert(expected2); var expected = new List <StokInOutModel> { expected1, expected2 }; // act var actual = _stokInOutDal.ListData(expected1.StokInID); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.BrgName) .Excluding(x => x.JenisMutasiName)); } }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var expected1 = StokAdjustmentDataFactory(); var expected2 = expected1.CloneObject(); expected2.StokAdjustmentID = "A2"; var expected = new List<StokAdjustmentModel> { expected1, expected2 }; _stokAdjustmentDal.Insert(expected1); _stokAdjustmentDal.Insert(expected2); // act var actual = _stokAdjustmentDal.ListData(expected1.TglTrs, expected2.TglTrs); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.ListBrg)); } }
private void Save() { var returDeposit = new ReturDepositModel { ReturDepositID = ReturDepositIDText.Text, Tgl = TglText.Value.ToString("dd-MM-yyyy"), Jam = JamText.Text, DepositID = DepositIDText.Text, JenisKasID = JenisKasCombo.SelectedValue.ToString(), Catatan = KeteranganReturDepositText.Text, NilaiSisaDeposit = SisaDepositText.Value, NilaiReturDeposit = NilaiReturText.Value }; var deposit = _depositBL.GetData(returDeposit.DepositID); using (var trans = TransHelper.NewScope()) { var result = _returDepositBL.Save(returDeposit); var bpKas = _bpKasBL.Generate(returDeposit); var bpHutang = _bpHutangBL.GenHutang(returDeposit, deposit); trans.Complete(); } }
public void ListData_ValidData_NoEx() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = DepositDataFactory(); _depositDal.Insert(item1); var item2 = item1.CloneObject(); item2.DepositID = "A2"; _depositDal.Insert(item2); var expected = new List <DepositModel> { item1, item2 }; // act var actual = _depositDal.ListData("17-02-2019", "17-02-2019"); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.PihakKeduaName) .Excluding(x => x.JenisBayarName)); } }
public void ListData_ValidData_NoEx() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = BrgDataFactory(); _brgDal.Insert(item1); var item2 = Brg2DataFactory(); _brgDal.Insert(item2); var expected = new List <BrgModel> { item1, item2 }; // act var actual = _brgDal.ListData(); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.SubJenisBrgName) .Excluding(x => x.ColorName) .Excluding(x => x.MerkName) .Excluding(x => x.CreateTimestamp) .Excluding(x => x.UpdateTimestamp) .Excluding(x => x.JenisBrgID) .Excluding(x => x.JenisBrgName)); } }
public void Save() { var orderJual = new OrderJualModel { OrderJualID = _view.OrderJualID, TglOrderJual = _view.TglOrderJual, JamOrderJual = _view.JamOrderJual, CustomerID = _view.CustomerID, BuyerName = _view.BuyerName, Alamat = _view.Alamat, NoTelp = _view.NoTelpon, Catatan = _view.Catatan, NilaiTotal = _view.NilaiTotal, NilaiDiskonLain = _view.NilaiDiskonLain, NilaiBiayaLain = _view.NilaiBiayaLain, NilaiGrandTotal = _view.NilaiGrandTotal, }; orderJual.ListBrg = orderJual.ListBrg.Where(x => x.BrgID != "").ToList(); using (var trans = TransHelper.NewScope()) { var result = _orderJualBL.Save(orderJual); trans.Complete(); } }
public ReturDepositModel Save(ReturDepositModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } // validate depositID var deposit = _depositBL.GetData(model.DepositID); if (deposit == null) { throw new ArgumentException("DepositID invalid"); } else { model.PihakKeduaName = deposit.PihakKeduaName; } // validate jenisKas var jenisKas = _jenisKasBL.GetData(model.JenisKasID); if (jenisKas == null) { throw new ArgumentException("JenisKasID invalid"); } else { model.JenisKasName = jenisKas.JenisKasName; } // cek nilai retur harus antara 0 dan sisa deposit if (model.NilaiReturDeposit > model.NilaiSisaDeposit) { throw new ArgumentException("NilaiReturDeposit Invalid"); } if (model.NilaiReturDeposit <= 0) { throw new ArgumentException("NilaiReturDeposit Invalid minus"); } // proses simpan using (var trans = TransHelper.NewScope()) { if (model.ReturDepositID.Trim() == "") { model.ReturDepositID = GenNewID(); } // hapus data lama _returDepositDal.Delete(model.ReturDepositID); // simpan data baru _returDepositDal.Insert(model); trans.Complete(); } return(model); }
public void Delete(string id) { using (var trans = TransHelper.NewScope()) { _dep.PriceQtyDal.Delete(id); _dep.PriceQtyDal.Delete(id); trans.Complete(); } }
public void Delete(string id) { using (var trans = TransHelper.NewScope()) { _customerDal.Delete(id); _pihakKeduaBL.Delete(id); trans.Complete(); } }
public void Void(string id) { using (var trans = TransHelper.NewScope()) { _penjualan2Dal.Delete(id); _penjualanDal.Delete(id); trans.Complete(); } }
public void Delete(string id) { using (var trans = TransHelper.NewScope()) { _lunasPiutangDetilDal.Delete(id); _lunasPiutangDal.Delete(id); trans.Complete(); } }
public SuratDinasModel Propose(SuratDinasAddDto suratDinas) { // CHECK ARGUMENT suratDinas.Empty().Throw("Data Surat Dinas kosong"); // CONVERT DTO >> MODEL var sd = new SuratDinasModel { TglJamCreate = DateTime.Now, PegID = suratDinas.PegID, NoSurat = suratDinas.NoSurat, NoKontrak = suratDinas.NoKontrak, TglMulai = suratDinas.TglMulai, TglSelesai = suratDinas.TglSelesai, Keperluan = suratDinas.Keperluan, TransportID = suratDinas.TransportID, KMAwal = suratDinas.KMAwal, RSID = suratDinas.RSID, JenisBiayaID = suratDinas.JenisBiayaID, KasBon = suratDinas.KasBon, ListApproval = from c in suratDinas.ListApproval select new SuratDinasApprovalModel { PegID = c.PegID, ApprovalTypeID = c.ApprovalTypeID, } }; // VALIDATE MODEL Validate(sd); // UPDATE REPO using (var trans = TransHelper.NewScope()) { // generate id sd.SuratDinasID = _paramNoBL.GenNewID("LG", ParamNoLengthEnum.Code_13); foreach (var item in sd.ListApproval) { item.SuratDinasID = sd.SuratDinasID; } // insert ke db _suratDinasDal.Insert(sd); _suratDinasApprovalDal.Delete(sd); foreach (var item in sd.ListApproval) { _suratDinasApprovalDal.Insert(item); } // commit changes trans.Complete(); } return(sd); }
public void Void(string id) { using (var trans = TransHelper.NewScope()) { _orderJual2Dal.Delete(id); _orderJualDal.Delete(id); trans.Complete(); } }
public void Void(string id) { using (var trans = TransHelper.NewScope()) { _stokAdjustment2Dal.Delete(id); _stokAdjustmentDal.Delete(id); trans.Complete(); } }
private BPHutangModel Save(BPHutangModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } // validate pihak kedua; var pihakKedua = _pihakKeduaBL.GetData(model.PihakKeduaID); if (pihakKedua == null) { throw new ArgumentException("PihakKeduaID invalid"); } else { model.PihakKeduaName = pihakKedua.PihakKeduaName; } // update nilai total di header model.NilaiHutang = model.ListLunas.Sum(x => x.NilaiHutang); model.NilaiLunas = model.ListLunas.Sum(x => x.NilaiLunas); // nilai pelunasan tidak boleh lebih dari hutang if (model.NilaiLunas > model.NilaiHutang) { throw new ArgumentException("Nilai Pelunasan melebihi hutang"); } // update BPHutangID dan BPHutangDetilID di detil lunas int noUrut = 0; foreach (var item in model.ListLunas.OrderBy(x => x.Tgl.ToTglYMD() + x.Jam)) { noUrut++; item.BPHutangID = model.BPHutangID; item.BPHutangDetilID = model.BPHutangID + '-' + noUrut.ToString().PadLeft(2, '0'); } // delete data lama using (var trans = TransHelper.NewScope()) { _bpHutangDetilDal.Delete(model.BPHutangID); _bpHutangDal.Delete(model.BPHutangID); _bpHutangDal.Insert(model); foreach (var item in model.ListLunas) { _bpHutangDetilDal.Insert(item); } trans.Complete(); } return(model); }
public void DeleteTest() { using (var trans = TransHelper.NewScope()) { // arrange // act _purchaseDal.Delete("A1"); } }
public void Delete(string id) { // hapus data lama using (var trans = TransHelper.NewScope()) { _lunasKasBonDal.Delete(id); _lunasKasBonDetilDal.Delete(id); trans.Complete(); } }
public void Delete_Test() { using (var trans = TransHelper.NewScope()) { // arrange var expected = SuratDinasApprovalTestData(); // act-assert _sut.Delete(expected); } }
public void Update_Test() { using (var trans = TransHelper.NewScope()) { // arrange var expected = JenisCutiSample(); // act _sut.Update(expected); } }
public void Delete(string produksiID) { using (var trans = TransHelper.NewScope()) { dep.ProduksiHasilDal.Delete(produksiID); dep.ProduksiMaterialDal.Delete(produksiID); dep.ProduksiDal.Delete(produksiID); trans.Complete(); } }
public void Delete_Test() { using (var trans = TransHelper.NewScope()) { // arrange var expected = LaporanDinasTestData(); // act _sut.Delete(expected); } }
public void Delete_Test() { using (var trans = TransHelper.NewScope()) { // arrange var expected = JenisKontrakTestData(); // act-assert _sut.Delete(expected); } }
public void Update_Test() { using (var trans = TransHelper.NewScope()) { // arrange var expected = ApprovalTypeTestData(); // act-assert _sut.Update(expected); } }