Пример #1
0
        public int AddOrderProdutioncustom(OrderProductioncustom oData)
        {
            methodName = "AddOrderProductioncustom";
            traceID    = 1;

            using (var uow = new UnitOfWork(AppConfig.Current.ContextName))
            {
                using (var trans = uow.BeginTransaction())
                {
                    try
                    {
                        traceID = 2;
                        OrderProductioncustom oNewumum = new OrderProductioncustom();
                        oNewumum.MapFrom(oData);
                        oNewumum = uow.OrderProductioncustom.Add(oNewumum);
                        uow.Save();

                        if (oNewumum.IdOrderProductionCustom > 0)
                        {
                            traceID = 3;
                            oData.IdOrderProductionCustom = oNewumum.IdOrderProductionCustom;
                            ListOrderProduction oNewListOrderJual = new ListOrderProduction();
                            oNewListOrderJual.MapFrom(oData);

                            traceID = 4;
                            oNewListOrderJual.IdOrder = oData.IdOrderProductionCustom;
                            // oNewListOrderJual.Jumlah = oData.JumlahCustom;
                            oNewListOrderJual.Sku = oData.NamaCustom;
                            //    oNewListOrderJual.HargaPokok = oData.HargaCustom;
                            //  oNewListOrderJual.SatuanDasar = oData.SatuanCustom;
                            oNewListOrderJual.TotalOrder = oData.TotalCustom;
                            uow.ListOrderProduction.Add(oNewListOrderJual);
                        }

                        traceID = 5;
                        uow.Save();
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw new AppException(500, methodName, traceID, ex);
                    }
                }
            }

            return(oData.IdOrderProductionCustom);
        }
Пример #2
0
        public int AddOrderProdutioninput(OrderProductioninput oData)
        {
            methodName = "AddOrderProductioninput";
            traceID    = 1;

            using (var uow = new UnitOfWork(AppConfig.Current.ContextName))
            {
                using (var trans = uow.BeginTransaction())
                {
                    try
                    {
                        traceID = 2;
                        OrderProductioninput oNewumum = new OrderProductioninput();
                        oNewumum.MapFrom(oData);
                        oNewumum = uow.OrderProductioninput.Add(oNewumum);
                        uow.Save();

                        if (oNewumum.IdOrderProduction > 0)
                        {
                            traceID = 3;
                            oData.IdOrderProduction = oNewumum.IdOrderProduction;
                            ListOrderProduction oNewListOrderJual = new ListOrderProduction();
                            oNewListOrderJual.MapFrom(oData);

                            traceID = 4;
                            oNewListOrderJual.IdOrder    = oData.IdOrderProduction;
                            oNewListOrderJual.Jumlah     = oData.JumlahProduk;
                            oNewListOrderJual.TotalOrder = oData.TotalOrderProduk;
                            uow.ListOrderProduction.Add(oNewListOrderJual);
                        }

                        traceID = 5;
                        uow.Save();
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw new AppException(500, methodName, traceID, ex);
                    }
                }
            }

            return(oData.IdOrderProduction);
        }