Exemple #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);
        }
Exemple #2
0
        public OrderProductioncustom GetData()
        {
            OrderProductioncustom oData = new OrderProductioncustom();

            oData.NamaCustom = txtnama.Text;
            // oData.SatuanCustom = txtunit.Text;
            //oData.HargaCustom = double.Parse(txtprice.Text);
            //         oData.JumlahCustom = double.Parse(txttotal.Text);
            oData.TotalCustom = double.Parse(txttotal1.Text);
            if (this.rekeningPerkiraanSelected != null)
            {
                oData.IdAkunCustom = this.rekeningPerkiraanSelected.Id;
                oData.AkunCustom   = this.rekeningPerkiraanSelected.NamaRekeningPerkiraan;
            }
            oData.CheckboxAktif = true;
            return(oData);
        }
Exemple #3
0
        public bool EditProductioninput(ListOrderProduction oData, production oDatas)
        {
            methodName = "EditProductioninput";
            traceID    = 1;

            using (var uow = new UnitOfWork(AppConfig.Current.ContextName))
            {
                traceID = 2;
                var oDBData = uow.ListOrderProduction.Get(oData.Id);
                if (oDBData != null)
                {
                    using (var trans = uow.BeginTransaction())
                    {
                        try
                        {
                            traceID = 3;
                            oDBData.MapFrom(oData);
                            uow.ListOrderProduction.Update(oDBData);

                            traceID = 4;
                            OrderProductioninput oDBListorderjual = uow.OrderProductioninput.SingleOrDefault(m => m.IdOrderProduction == oData.IdOrder);
                            if (oDBListorderjual != null)
                            {
                                traceID = 5;
                                oDBListorderjual.MapFrom(oData);

                                traceID = 6;
                                uow.OrderProductioninput.Update(oDBListorderjual);
                            }
                            else
                            {
                                traceID = 7;
                                OrderProductioninput oNewListorderjual = new OrderProductioninput();
                                oNewListorderjual.MapFrom(oData);

                                traceID = 8;
                                uow.OrderProductioninput.Add(oNewListorderjual);
                            }
                            traceID = 9;
                            OrderProductioncustom oDBListorderjual1 = uow.OrderProductioncustom.SingleOrDefault(m => m.IdOrderProductionCustom == oData.IdOrder);
                            if (oDBListorderjual1 != null)
                            {
                                traceID = 10;
                                oDBListorderjual1.MapFrom(oData);

                                traceID = 11;
                                uow.OrderProductioncustom.Update(oDBListorderjual1);
                            }
                            else
                            {
                                traceID = 12;

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

            return(true);
        }