public int AddOrderJasabeli(OrderJasaBeli oData) { methodName = "AddOrderJasabeli"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; OrderJasaBeli oNewumum = new OrderJasaBeli(); oNewumum.MapFrom(oData); oNewumum = uow.OrderJasaBeli.Add(oNewumum); uow.Save(); if (oNewumum.IdOrderJasa > 0) { traceID = 3; oData.IdOrderJasa = oNewumum.IdOrderJasa; ListOrderBeli oNewListOrderBeli = new ListOrderBeli(); oNewListOrderBeli.MapFrom(oData); traceID = 4; oNewListOrderBeli.IdOrderBeli = oData.IdOrderJasa; oNewListOrderBeli.Diskon = oData.DiskonJasa; oNewListOrderBeli.IdAkunPajak = oData.IdAkunPajakJasa; oNewListOrderBeli.Jumlah = oData.TotalJasa; oNewListOrderBeli.TotalOrderJasa = oData.TotalOrderJasa; oNewListOrderBeli.TotalPajakJasa = oData.TotalPajakJasa; oNewListOrderBeli.NamaProduk = oData.NamaJasa; oNewListOrderBeli.TotalOrder = oData.TotalOrderJasa; oNewListOrderBeli.TotalPajak = oData.TotalPajakJasa; oNewListOrderBeli.HargaBeli = oData.HargaJasa; oNewListOrderBeli.IdAkunJasa = oData.IdAkunJasa; uow.ListOrderBeli.Add(oNewListOrderBeli); } traceID = 5; uow.Save(); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.IdOrderJasa); }
public int AddOrderCustombeli(OrderCustomBeli oData) { methodName = "AddOrderCustombeli"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; OrderCustomBeli oNewumum = new OrderCustomBeli(); oNewumum.MapFrom(oData); oNewumum = uow.OrderCustomBeli.Add(oNewumum); uow.Save(); if (oNewumum.IdOrderCustom > 0) { traceID = 3; oData.IdOrderCustom = oNewumum.IdOrderCustom; ListOrderBeli oNewListOrderBeli = new ListOrderBeli(); oNewListOrderBeli.MapFrom(oData); traceID = 4; oNewListOrderBeli.IdOrderBeli = oData.IdOrderCustom; oNewListOrderBeli.TotalOrder = oData.TotalCustom; oNewListOrderBeli.Jumlah = oData.JumlahCustom; oNewListOrderBeli.Sku = oData.NamaCustom; oNewListOrderBeli.HargaBeli = oData.HargaCustom; uow.ListOrderBeli.Add(oNewListOrderBeli); } traceID = 5; uow.Save(); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.IdOrderCustom); }