Пример #1
0
        public IEnumerable users([PXString] string prefix)
        {
            if (ForceLongOperation.Equals(prefix))
            {
                PXLongOperation.StartOperation(this, () => SyncUsers());
            }

            return(new PXSelect <PX.SM.Users>(Base).Select());
        }
Пример #2
0
        public void syncUsers()
        {
            PXLongOperation.StartOperation(UID, SyncUsersLongOperation);

            if (AllUsers.Select().Count == 0)
            {
                throw new PXSetupNotEnteredException <Users>(null);
            }
        }
Пример #3
0
        public virtual IEnumerable ClearAllIndexes(PXAdapter adapter)
        {
            PXLongOperation.StartOperation(this, delegate()
            {
                PXDatabase.Delete(typeof(SearchIndex));
            });

            return(adapter.Get());
        }
        protected virtual IEnumerable claim(PXAdapter adapter)
        {
            PXLongOperation.StartOperation(this, delegate()
            {
                ExpenseClaimDetailMaint.ClaimSingleDetail(CurrentClaimDetails.Current, this.IsContractBasedAPI);
            });

            return(adapter.Get());
        }
Пример #5
0
        public static void DeleteBatch(GLVoucherBatch batch, object[] processingList)
        {
            GLVoucherBatchMaint pg = PXGraph.CreateInstance <GLVoucherBatchMaint>();
            Dictionary <string, Dictionary <Guid, CAMessage> > errorLog = new Dictionary <string, Dictionary <Guid, CAMessage> >();

            PXLongOperation.SetCustomInfo(errorLog, processingList);
            pg.Clear(PXClearOption.PreserveData);
            pg.DeleteBatchProc(batch, errorLog);
        }
        public override void Initialize()
        {
            int count = Base.Identities.Select().Count;

            if (count > 0)
            {
                PXLongOperation.StartOperation(this, () => Console.WriteLine("Long Operation has been started"));
            }
        }
Пример #7
0
        public virtual IEnumerable IndexCustomArticles(PXAdapter adapter)
        {
            PXLongOperation.StartOperation(this, delegate()
            {
                foreach (var result in WikiArticles.Select())
                {
                    string plaintext = null;

                    var _wp = (WikiPage)result[typeof(WikiPage)];
                    var _wr = (WikiRevision)result[typeof(WikiRevision)];
                    var _wl = (WikiPageLanguage)result[typeof(WikiPageLanguage)];

                    if (_wp.IsHtml != true)
                    {
                        WikiReader reader       = PXGraph.CreateInstance <WikiReader>();
                        PXWikiSettings settings = new PXWikiSettings(new PXPage(), reader);
                        PXTxtRenderer renderer  = new PXTxtRenderer(settings.Absolute);
                        var ctx      = new PXDBContext(settings.Absolute);
                        ctx.Renderer = renderer;
                        plaintext    = (_wl.Title ?? "") + Environment.NewLine + PXWikiParser.Parse(_wr.Content, ctx);
                    }
                    else
                    {
                        plaintext = (_wl.Title ?? "") + Environment.NewLine + SearchService.Html2PlainText(_wr.Content);
                    }


                    //Try updating the article in current Company
                    if (!PXDatabase.Update <WikiRevision>(
                            new PXDataFieldAssign("PlainText", PXDbType.NVarChar, plaintext),
                            new PXDataFieldRestrict("PageID", PXDbType.UniqueIdentifier, _wr.PageID),
                            new PXDataFieldRestrict("PageRevisionID", PXDbType.Int, _wr.PageRevisionID),
                            new PXDataFieldRestrict("Language", PXDbType.VarChar, _wr.Language)
                            ))
                    {
                        //Article may be shared. Try updating the article through graph (thus handling the shared record update stratagy)
                        //if article is not updatable an exception may be thrown - ignore.
                        try
                        {
                            ArticleUpdater updater = PXGraph.CreateInstance <ArticleUpdater>();
                            WikiRevision rev       = updater.Revision.Select(_wr.PageID, _wr.PageRevisionID, _wr.Language);
                            rev.PlainText          = plaintext;
                            updater.Revision.Update(rev);
                            updater.Persist();
                        }
                        catch (Exception ex)
                        {
                            PXTrace.WriteInformation("Plain text field could not be updated for article = {0}. Error Message: {1}", _wr.PageID, ex.Message);
                        }
                    }
                }
            });



            return(adapter.Get());
        }
 public virtual IEnumerable release(PXAdapter adapter)
 {
     if (Document.Current != null && Document.Current.Released == false && Document.Current.Voided == false)
     {
         Save.Press();
         PXLongOperation.StartOperation(this, delegate() { ReleaseProcess(Document.Current); });
     }
     return(adapter.Get());
 }
Пример #9
0
        public virtual IEnumerable ConvertToOpportunity(PXAdapter adapter)
        {
            bool           isOpportunityAutoNumberOn = this.IsNumberingAutonumbered(Setup.Current.OpportunityNumberingID);
            List <Contact> contacts = new List <Contact>(adapter.Get().Cast <Contact>());

            foreach (Contact lead in contacts)
            {
                OpportunityMaint opportunityMaint = PXGraph.CreateInstance <OpportunityMaint>();
                CROpportunity    opportunity      = (CROpportunity)opportunityMaint.Opportunity.Cache.CreateInstance();

                if (!isOpportunityAutoNumberOn)
                {
                    if (OpportunityInfo.AskExt() != WebDialogResult.OK || !OpportunityInfo.VerifyRequired())
                    {
                        return(contacts);
                    }
                    CROpportunity existing = PXSelect <CROpportunity, Where <CROpportunity.opportunityID, Equal <Required <CROpportunity.opportunityID> > > > .SelectSingleBound(this, null, OpportunityInfo.Current.OpportunityID);

                    if (existing != null)
                    {
                        OpportunityInfo.Cache.RaiseExceptionHandling <OpportunityFilter.opportunityID>(OpportunityInfo.Current, OpportunityInfo.Current.OpportunityID, new PXSetPropertyException(Messages.OpportunityAlreadyExists, OpportunityInfo.Current.OpportunityID));
                        return(contacts);
                    }

                    object cd = OpportunityInfo.Current.OpportunityID;
                    opportunityMaint.Opportunity.Cache.RaiseFieldUpdating <CROpportunity.opportunityID>(null, ref cd);
                    opportunity.OpportunityID = (string)cd;
                }
                PXLongOperation.StartOperation(this, delegate()
                {
                    CRContactClass cls = PXSelect <CRContactClass, Where <CRContactClass.classID, Equal <Current <Contact.classID> > > > .SelectSingleBound(this, new object[] { lead });
                    if (cls != null && cls.OwnerToOpportunity == true)
                    {
                        opportunity.WorkgroupID = lead.WorkgroupID;
                        opportunity.OwnerID     = lead.OwnerID;
                    }

                    if (lead.BAccountID != null)
                    {
                        opportunity.BAccountID = lead.BAccountID;
                    }
                    opportunity.ContactID = lead.ContactID;
                    opportunity           = (CROpportunity)opportunityMaint.Opportunity.Cache.Insert(opportunity);

                    ContactMaint contactGraph = PXGraph.CreateInstance <ContactMaint>();
                    lead.ContactType          = ContactTypesAttribute.Person;
                    contactGraph.Contact.Update(lead);
                    contactGraph.Save.Press();

                    opportunityMaint.Opportunity.Search <CROpportunity.opportunityID>(opportunity.OpportunityID);

                    throw new PXRedirectRequiredException(opportunityMaint, "Opportunity", true);
                });
            }
            return(contacts);
        }
Пример #10
0
        public static void CaptureCCPayment <TNode>(TNode doc, PXSelectBase <CCProcTran> ccProcTran,
                                                    CCPaymentEntry.ReleaseDelegate aReleaseDelegate,
                                                    UpdateDocStateDelegate aDocStateUpdater,
                                                    ICCTransactionsProcessor processor = null)
            where TNode : class, IBqlTable, ICCPayment, new()
        {
            if (processor == null)
            {
                processor = CCTransactionsProcessor.GetCCTransactionsProcessor();
            }
            if (doc != null && doc.PMInstanceID != null && doc.CuryDocBal != null)
            {
                if (CCProcTranHelper.HasOpenCCTran(ccProcTran))
                {
                    throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress);
                }

                CCPaymentState paymentState = CCProcTranHelper.ResolveCCPaymentState(ccProcTran.Select());
                if ((paymentState & (CCPaymentState.Captured)) > 0)
                {
                    throw new PXException(Messages.ERR_CCAuthorizedPaymentAlreadyCaptured);
                }
                if (doc.Released == false)
                {
                    ccProcTran.View.Graph.Actions.PressSave();
                }
                CCProcTran authTran = CCProcTranHelper.FindCCPreAthorizing(ccProcTran.Select());
                TNode      toProc   = PXCache <TNode> .CreateCopy(doc);

                CCProcTran authTranCopy = null;
                if (authTran != null && !CCProcTranHelper.IsExpired(authTran))
                {
                    authTranCopy = PXCache <CCProcTran> .CreateCopy(authTran);
                }
                CCTranType operation = (authTranCopy) != null ? CCTranType.PriorAuthorizedCapture : CCTranType.AuthorizeAndCapture;
                PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate()
                {
                    try
                    {
                        processor.ProcessCCTransaction(toProc, authTranCopy, operation);
                    }
                    finally
                    {
                        //Update doc state in any case
                        if (aDocStateUpdater != null)
                        {
                            aDocStateUpdater(doc, operation);
                        }
                    }
                    if (aReleaseDelegate != null)
                    {
                        aReleaseDelegate(toProc);                               //On Success Only
                    }
                });
            }
        }
Пример #11
0
        protected virtual void CAEnqFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            CAEnqFilter filter = (CAEnqFilter)e.Row;

            if (filter == null)
            {
                return;
            }

            bool ShowSummaryNotChecked = filter.ShowSummary != true;

            bool CashAccountNeedReconcilation = (cashaccount.Current != null) && (bool)cashaccount.Current.Reconcile;

            if (cashaccount.Current != null && AddFilter.Current != null && AddFilter.Current.CashAccountID != filter.AccountID)
            {
                AddFilter.Cache.SetValueExt <AddTrxFilter.cashAccountID>(AddFilter.Current, cashaccount.Current.CashAccountCD);
            }
            AddDet.SetEnabled(filter.AccountID != null);
            PXCache tranCache = CATranListRecords.Cache;

            tranCache.AllowInsert = false;
            tranCache.AllowUpdate = (ShowSummaryNotChecked);
            tranCache.AllowDelete = (ShowSummaryNotChecked);

            PXUIFieldAttribute.SetVisible <CATran.selected>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.hold>(tranCache, null, false);
            PXUIFieldAttribute.SetVisible <CATran.status>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.origModule>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.origRefNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.origTranType>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.extRefNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.batchNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.finPeriodID>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.tranDesc>(tranCache, null, ShowSummaryNotChecked);

            PXUIFieldAttribute.SetVisible <CATran.referenceName>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.reconciled>(tranCache, null, ShowSummaryNotChecked && CashAccountNeedReconcilation);
            PXUIFieldAttribute.SetVisible <CATran.clearDate>(tranCache, null, ShowSummaryNotChecked && CashAccountNeedReconcilation);
            PXUIFieldAttribute.SetVisible <CATran.cleared>(tranCache, null, ShowSummaryNotChecked && CashAccountNeedReconcilation);
            PXUIFieldAttribute.SetVisible <CATran.dayDesc>(tranCache, null, !ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATranExt.dayDesc>(tranCache, null, !ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATranExt.depositNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.referenceID>(tranCache, null, ShowSummaryNotChecked);
            PXCache bAcctCache = this.Caches[typeof(BAccountR)];

            PXUIFieldAttribute.SetVisible <BAccountR.acctName>(bAcctCache, null, ShowSummaryNotChecked);

            Clearence.SetEnabled(CashAccountNeedReconcilation);
            AddFilter.Cache.RaiseRowSelected(AddFilter.Current);

            bool operationExists = PXLongOperation.Exists(UID);

            Save.SetEnabled(!operationExists);
            Release.SetEnabled(!operationExists);
            Clearence.SetEnabled(!operationExists);
        }
Пример #12
0
        public void CaptureCCpayment(ICCPayment doc, IExternalTransactionAdapter paymentTransaction)
        {
            if (doc == null || doc.CuryDocBal == null)
            {
                return;
            }

            ExternalTransactionState state = ExternalTranHelper.GetActiveTransactionState(graph, paymentTransaction.Select());

            if (ExternalTranHelper.HasOpenCCProcTran(graph, state.ExternalTransaction))
            {
                throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress);
            }
            if (state.IsCaptured)
            {
                throw new PXException(Messages.ERR_CCAuthorizedPaymentAlreadyCaptured);
            }
            if (doc.Released == false)
            {
                graph.Actions.PressSave();
            }

            ICCPayment           toProc   = graph.Caches[doc.GetType()].CreateCopy(doc) as ICCPayment;
            IExternalTransaction tranCopy = null;

            if (state.IsPreAuthorized && !ExternalTranHelper.IsExpired(state.ExternalTransaction))
            {
                tranCopy = graph.Caches[state.ExternalTransaction.GetType()].CreateCopy(state.ExternalTransaction) as IExternalTransaction;
            }
            CCTranType operation = tranCopy != null ? CCTranType.PriorAuthorizedCapture : CCTranType.AuthorizeAndCapture;

            PXLongOperation.StartOperation(graph, delegate()
            {
                bool success = true;
                try
                {
                    if (operation == CCTranType.PriorAuthorizedCapture)
                    {
                        TransactionProcessor.ProcessPriorAuthorizedCapture(toProc, tranCopy);
                    }
                    else
                    {
                        TransactionProcessor.ProcessAuthorizeCapture(toProc, tranCopy);
                    }
                }
                catch
                {
                    success = false;
                    throw;
                }
                finally
                {
                    RunCallbacks((IBqlTable)doc, operation, success);
                }
            });
        }
Пример #13
0
        public virtual IEnumerable recreateLast(PXAdapter adapter)
        {
            ARStatementCycle row = ARStatementCycleRecord.Current;

            if (row.LastStmtDate != null)
            {
                PXLongOperation.StartOperation(this, delegate() { StatementCycleProcessBO.RegenerateLastStatement(new StatementCycleProcessBO(), row); });
            }
            return(adapter.Get());
        }
Пример #14
0
        protected virtual IEnumerable release(PXAdapter adapter)
        {
            SalesOrder order = Orders.Current;

            PXLongOperation.StartOperation(this, delegate()
            {
                ReleaseOrder(order);
            });
            return(adapter.Get());
        }
Пример #15
0
        protected virtual void Filter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            PXLongRunStatus status = GetLongOperationStatus();

            if (status != PXLongRunStatus.InProcess)
            {
                PXLongOperation.ClearStatus(this.UID);
                VoucherBatches.Cache.Clear();
            }
        }
Пример #16
0
 protected virtual void FARegister_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
 {
     if (e.Row != null && PXLongOperation.GetCurrentItem() == null)             //Calculate totals only not in long operation
     {
         using (new PXConnectionScope())
         {
             PXFormulaAttribute.CalcAggregate <FATran.tranAmt>(Trans.Cache, e.Row, true);
         }
     }
 }
Пример #17
0
 private void AuthenticateDocuSignAccount(ESignAccount account)
 {
     PXLongOperation.StartOperation(this, () =>
     {
         DocuSignService.Authenticate(account);
         account.Status = Messages.ESignIntegrationStatus.Connected;
         Accounts.Update(account);
         Actions.PressSave();
     });
 }
Пример #18
0
        public virtual IEnumerable release(PXAdapter adapter)
        {
            CheckPrevOperation();
            Save.Press();
            CABatch document = this.Document.Current;

            PXLongOperation.StartOperation(this, delegate() { CABatchEntry.ReleaseDoc(document); });

            return(adapter.Get());
        }
Пример #19
0
        public virtual IEnumerable importForecast(PXAdapter adapter)
        {
            PXLongOperation.StartOperation(this, delegate()
            {
                //Create needed graphs
                var graph = PXGraph.CreateInstance <AFResultMaint>();

                AFSetup setup = graph.Setup.Current ?? graph.Setup.Select();

                //-----------------------------------------------------------------------------
                //Change for Setup daya
                string bucketName      = setup.AFBucketName;
                string s3DirectoryName = setup.AFOutDirectoryName;
                string accessKey       = setup.AFAccessKey;
                string secretKey       = setup.AFSecretKey;
                //-----------------------------------------------------------------------------

                PXTrace.WriteInformation($"AFAccessKey: {accessKey} AFSecretKey: {secretKey} AFBucketName: {bucketName} AFDirectoryName: {s3DirectoryName}");

                //if (data?.Count == 0) return;


                try
                {
                    AFAmazonTools myUploader = new AFAmazonTools();
                    var result = myUploader.DownloadFromS3(accessKey, secretKey, bucketName, s3DirectoryName);

                    foreach (var line in result)
                    {
                        try
                        {
                            var item          = new AFResult();
                            item.ResultID     = line[0];
                            item.ResultTstamp = DateTime.Parse(line[1], null, System.Globalization.DateTimeStyles.RoundtripKind);
                            item.ResultP10    = Convert.ToDecimal(line[2]);
                            item.ResultE50    = Convert.ToDecimal(line[3]);
                            item.ResultP90    = Convert.ToDecimal(line[4]);

                            graph.AFResultView.Update(item);
                        }
                        catch (Exception e)
                        {
                            PXTrace.WriteError($"Error parsing data ({String.Join(",", line)}): {e.Message}");
                        }
                    }
                    graph.Save.Press();
                }
                catch (Exception e)
                {
                    throw new PXException(e.Message, e);
                }
            });

            return(adapter.Get());
        }
Пример #20
0
        public virtual IEnumerable trainFaceRecongnition(PXAdapter adapter)
        {
            Save.Press();

            PXLongOperation.StartOperation(this, delegate()
            {
                IFaceClient client = Trainer.Authenticate(MasterView.Current.FaceApiEndpoint, MasterView.Current.FaceApiSubscriptionKey);
                var trainer        = new Trainer(client, MasterView.Current.FaceApiGroupID);
                bool uploaded      = false;
                foreach (EPEmployee emp in PXSelect <EPEmployee> .Select(this))
                {
                    bool deleted  = false;
                    Person person = null;
                    Guid[] files  = PXNoteAttribute.GetFileNotes(this.Caches[typeof(EPEmployee)], emp);

                    foreach (Guid fileID in files)
                    {
                        var fm            = new PX.SM.UploadFileMaintenance();
                        PX.SM.FileInfo fi = fm.GetFile(fileID);
                        string ext        = System.IO.Path.GetExtension(fi.Name).ToLower();
                        PXTrace.WriteWarning(emp.AcctCD.TrimEnd() + " " + ext);
                        if (ext.IsIn(".png", ".jpg", ".bmp"))
                        {
                            if (!deleted)
                            {
                                var utilities = new Utilities(client, MasterView.Current.FaceApiGroupID);
                                utilities.DeleteEmployee(emp.AcctCD.TrimEnd());
                                deleted = true;
                            }

                            if (person == null)
                            {
                                person = trainer.GetEmployee_CreateIfNonExistent(emp.AcctCD.TrimEnd());
                            }


                            using (var stream = new System.IO.MemoryStream(fi.BinData))
                            {
                                PXTrace.WriteWarning(emp.AcctCD.TrimEnd() + " " + fi.Name + " " + stream.Length);
                                trainer.UploadTrainingImageStream(person, stream);
                                Thread.Sleep(1000);
                                uploaded = true;
                            }
                        }
                    }
                }
                if (uploaded)
                {
                    trainer.InvokeTraining();
                }
            });


            return(adapter.Get());
        }
        public virtual IEnumerable generateYears(PXAdapter adapter)
        {
            IFinPeriodRepository finPeriodRepository = Base.GetService <IFinPeriodRepository>();
            IFinPeriodUtils      finPeriodUtils      = Base.GetService <IFinPeriodUtils>();
            PrimaryFinYear       primaryYear         = (PrimaryFinYear)Base.Caches <PrimaryFinYear>().Current;

            if (primaryYear == null)
            {
                throw new PXException(Messages.NeedToCreateFirstCalendarYear);
            }

            int?firstExistingYear = int.TryParse(finPeriodRepository.FindFirstYear(primaryYear.OrganizationID ?? 0, clearQueryCache: true)?.Year, out int parsedFirstExistingYear)
                                ? parsedFirstExistingYear
                                : (int?)null;
            int?lastExistingYear = int.TryParse(finPeriodRepository.FindLastYear(primaryYear.OrganizationID ?? 0, clearQueryCache: true)?.Year, out int parsedLastExistingYear)
                                ? parsedLastExistingYear
                                : (int?)null;

            bool generateCalendar = true;

            if (!Base.IsContractBasedAPI)
            {
                generateCalendar = GenerateParams.AskExtFullyValid((graph, viewName) =>
                {
                    FinPeriodGenerateParameters parameters = GenerateParams.Current;
                    parameters.OrganizationID = primaryYear.OrganizationID;
                    parameters.FromYear       =
                        parameters.ToYear     = lastExistingYear == null ? primaryYear.Year : (lastExistingYear + 1).ToString();
                    parameters.FirstFinYear   = firstExistingYear?.ToString();
                    parameters.LastFinYear    = lastExistingYear?.ToString();
                },
                                                                   DialogAnswerType.Positive);
            }

            if (generateCalendar)
            {
                int fromYear = int.Parse(GenerateParams.Current.FromYear);
                int toYear   = int.Parse(GenerateParams.Current.ToYear);

                IFinPeriodMaintenanceGraph processingGraph = Base.Clone();
                PXLongOperation.StartOperation(
                    Base,
                    delegate()
                {
                    finPeriodUtils.CheckParametersOfCalendarGeneration(primaryYear.OrganizationID, fromYear, toYear);
                    processingGraph.GenerateCalendar(primaryYear.OrganizationID, fromYear, toYear);
                });

                if (Base.IsContractBasedAPI)
                {
                    PXLongOperation.WaitCompletion(Base.UID);
                }
            }
            return(adapter.Get());
        }
Пример #22
0
        public static void RecordCCPayment <TNode>(TNode doc, string aExtPCTranNbr, string aPCAuthNbr, PXSelectBase <CCProcTran> ccProcTran, CCPaymentEntry.ReleaseDelegate aReleaseDelegate, UpdateDocStateDelegate aDocStateUpdater)
            where TNode : class, IBqlTable, ICCPayment, new()
        {
            if (doc != null && doc.PMInstanceID != null && doc.CuryDocBal != null)
            {
                if (CCProcTranHelper.HasOpenCCTran(ccProcTran))
                {
                    throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress);
                }

                if (string.IsNullOrEmpty(aExtPCTranNbr))
                {
                    throw new PXException(Messages.ERR_PCTransactionNumberOfTheOriginalPaymentIsRequired);
                }


                CCPaymentState paymentState = CCProcTranHelper.ResolveCCPaymentState(ccProcTran.Select());
                if ((paymentState & (CCPaymentState.Captured)) > 0)
                {
                    throw new PXException(Messages.ERR_CCAuthorizedPaymentAlreadyCaptured);
                }

                if (doc.Released == false)
                {
                    ccProcTran.View.Graph.Actions.PressSave();
                }

                TNode toProc = PXCache <TNode> .CreateCopy(doc);

                CCProcTran authTran  = CCProcTranHelper.FindCCPreAthorizing(ccProcTran.Select());
                CCTranType operation = CCTranType.AuthorizeAndCapture;
                PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate()
                {
                    try
                    {
                        var graph        = PXGraph.CreateInstance <CCPaymentProcessingGraph>();
                        int?tranID       = 0;
                        string extTranID = aExtPCTranNbr;
                        graph.RecordCapture(doc, extTranID, aPCAuthNbr, null, ref tranID);
                    }
                    finally
                    {
                        //Update doc state in any case
                        if (aDocStateUpdater != null)
                        {
                            aDocStateUpdater(doc, operation);
                        }
                    }
                    if (aReleaseDelegate != null)
                    {
                        aReleaseDelegate(toProc);                               //On Success Only
                    }
                });
            }
        }
Пример #23
0
        protected virtual IEnumerable Cancel(PXAdapter adapter)
        {
            CATranListRecords.Cache.Clear();
            CATranListRecords.Cache.ClearQueryCacheObsolete();
            Filter.Cache.Clear();
            Caches[typeof(CADailySummary)].Clear();
            TimeStamp = null;

            PXLongOperation.ClearStatus(this.UID);
            return(adapter.Get());
        }
        public virtual IEnumerable Voided(PXAdapter adapter)
        {
            CARecon recon = CAReconRecords.Current;

            if (recon != null)
            {
                PXLongOperation.StartOperation(this, delegate() { CAReconEntry.ReconVoided(recon); });
                CAReconRecords.View.RequestRefresh();
            }
            return(adapter.Get());
        }
 protected override IEnumerable ProcessAll(PXAdapter adapter)
 {
     if (ConfirmationMessage != null && adapter.ExternalCall)
     {
         if (!PXLongOperation.Exists(_Graph.UID) && this.Ask(ConfirmationTitle, ConfirmationMessage, MessageButtons.YesNo) != WebDialogResult.Yes)
         {
             return(adapter.Get());
         }
     }
     return(base.ProcessAll(adapter));
 }
Пример #26
0
        protected virtual IEnumerable ClearData(PXAdapter adapter)
        {
            PXLongOperation.StartOperation(this, () =>
            {
                PXDatabase.Delete <LUMWarehouseImportProcess>(
                    new PXDataFieldRestrict <LUMWarehouseImportProcess.createdByID>(Accessinfo.UserID));
                this.ImportShipmentList.Cache.Clear();
            });

            return(adapter.Get());
        }
Пример #27
0
        protected virtual void SOCreateFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            SOCreateFilter filter = Filter.Current;

            FixedDemand.SetProcessDelegate(list => SOCreateProc(list, filter.PurchDate));

            TimeSpan        span;
            Exception       message;
            PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out span, out message);

            PXUIFieldAttribute.SetVisible <SOLine.orderNbr>(Caches[typeof(SOLine)], null, (status == PXLongRunStatus.Completed || status == PXLongRunStatus.Aborted));
        }
 public virtual void Persist()
 {
     if (Base.CAAdjRecords.Current != null && IsExternalTax(Base.CAAdjRecords.Current.TaxZoneID) && Base.CAAdjRecords.Current.IsTaxValid != true && !skipExternalTaxCalcOnSave)
     {
         PXLongOperation.StartOperation(Base, delegate()
         {
             CAAdj doc     = new CAAdj();
             doc.AdjRefNbr = Base.CAAdjRecords.Current.RefNbr;
             CAExternalTaxCalc.Process(doc);
         });
     }
 }
		protected virtual void GLConsolSetup_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
		{
			if (e.Row == null)
				return;

			if (!PXLongOperation.Exists(UID))
			{
				var glConsolSetup = (GLConsolSetup)e.Row;

				CheckUnpostedBatchesNotExist(glConsolSetup);
			}
		}
Пример #30
0
        private void AuthenticateAdobeSignAccount(ESignAccount account)
        {
            var companyId = PXAccess.GetCompanyName();
            var client    = AdobeSignClientBuilder.BuildUnauthorized(account, companyId);

            PXLongOperation.StartOperation(this, () =>
            {
                var loginUrl = client.Authentication.GetLoginPageUrl();
                throw new PXRedirectToUrlException(loginUrl, PXBaseRedirectException.WindowMode.InlineWindow,
                                                   string.Empty, false);
            });
        }