Пример #1
0
        public virtual IEnumerable prepareAdd(PXAdapter adapter)
        {
            if (Transfer.Current != null && Transfer.Current.Released != true)
            {
                Save.Press();
                //Current should be the only one inserted
                PXCache currencycache = Caches[typeof(CM.CurrencyInfo)];
                currencycache.SetStatus(currencycache.Current, PXEntryStatus.Inserted);
                Transfer.JustPersisted = true;

                //recreate currencyinfo on CurrencyInfoAttribute.RowUpdating
                AddFilter.Update(AddFilter.Current);

                WebDialogResult result = AddFilter.AskExt(true);
                if (result == WebDialogResult.OK)
                {
                    using (new PXTimeStampScope(this.TimeStamp))
                    {
                        CATran catran = AddTrxFilter.VerifyAndCreateTransaction(this, AddFilter, currencyinfo_addfilter);
                        catran = TransferTran.Update(catran);
                        Save.Press();
                    }
                }
                AddFilter.Cache.Clear();
            }
            else
            {
                throw new Exception(Messages.DocumentStatusInvalid);
            }
            return(adapter.Get());
        }
Пример #2
0
        public virtual IEnumerable addDet(PXAdapter adapter)
        {
            AddFilter.AskExt(true);
            if (AddFilter.View.Answer == WebDialogResult.OK)
            {
                using (new PXTimeStampScope(this.TimeStamp))
                {
                    CATran catran = AddTrxFilter.VerifyAndCreateTransaction(this, AddFilter, currencyinfo);
                    if (catran != null)
                    {
                        CATranExt copy = new CATranExt();
                        PXCache <CATran> .RestoreCopy(copy, catran);

                        CATranListRecords.Update(copy);
                        Save.Press();
                    }
                }
                CATranListRecords.Cache.Clear();
                Caches[typeof(CADailySummary)].Clear();
                Filter.Current.BegBal = null;
            }
            AddFilter.Cache.Clear();
            return(adapter.Get());
        }