protected void PseudonymizeChilds(PXGraph processingGraph, Type childTable, IEnumerable <PXPersonalDataFieldAttribute> fields, IEnumerable <object> childs)
        {
            foreach (object child in childs)
            {
                List <PXDataFieldParam> assigns = new List <PXDataFieldParam>();

                foreach (var field in fields)
                {
                    object obfuscatedValue = GetObfuscateValue(childTable, field);

                    assigns.Add(new PXDataFieldAssign(field.FieldName, obfuscatedValue));
                }

                assigns.Add(new PXDataFieldAssign(nameof(IPseudonymizable.PseudonymizationStatus), SetPseudonymizationStatus));

                List <PXDataFieldParam> restricts = new List <PXDataFieldParam>();

                foreach (string key in processingGraph.Caches[childTable].Keys)
                {
                    restricts.Add(new PXDataFieldRestrict(key, processingGraph.Caches[childTable].GetValue(child, key)));
                }

                PXDatabase.Update(
                    childTable,
                    InterruptPseudonimyzationHandler(processingGraph.Caches[childTable], restricts)
                    .Union(assigns)
                    .Distinct(_ => _.Column.Name.ToLower())
                    .Union(restricts)
                    .ToArray()
                    );

                DeleteSearchIndex(processingGraph.Caches[childTable].GetValue(child, nameof(INotable.NoteID)) as Guid?);
            }
        }
 public override void ProcessRequest(SubscribeRequest requestData)
 {
     if (requestData == null)
     {
         //Unsubscribe this user from *all* push notification
         PXDatabase.Delete <VXUserPushNotification>(
             new PXDataFieldRestrict <VXUserPushNotification.userID>(PXAccess.GetUserID())
             );
     }
     else
     {
         //Register endpoint. The page will always refresh its subscription on load.
         try
         {
             PXDatabase.Insert <VXUserPushNotification>(
                 new PXDataFieldAssign <VXUserPushNotification.userID>(PXAccess.GetUserID()),
                 new PXDataFieldAssign <VXUserPushNotification.endpoint>(requestData.Endpoint),
                 new PXDataFieldAssign <VXUserPushNotification.authKey>(requestData.Keys["auth"]),
                 new PXDataFieldAssign <VXUserPushNotification.receiverKey>(requestData.Keys["p256dh"]));
         }
         catch (PXDatabaseException e)
         {
             if (e.ErrorCode == PXDbExceptions.PrimaryKeyConstraintViolation)
             {
                 PXDatabase.Update <VXUserPushNotification>(
                     new PXDataFieldAssign <VXUserPushNotification.authKey>(requestData.Keys["auth"]),
                     new PXDataFieldAssign <VXUserPushNotification.receiverKey>(requestData.Keys["p256dh"]),
                     new PXDataFieldRestrict <VXUserPushNotification.userID>(PXAccess.GetUserID()),
                     new PXDataFieldRestrict <VXUserPushNotification.endpoint>(requestData.Endpoint));
             }
         }
     }
 }
        protected virtual void ARInvoiceAlias_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            ARInvoiceAlias row      = e.Row as ARInvoiceAlias;
            CRCampaign     campaign = Campaign.Current;

            if (row == null || campaign == null)
            {
                return;
            }

            if (e.Operation == PXDBOperation.Insert)
            {
                PXDatabase.Update <ARInvoice>(
                    new PXDataFieldAssign <ARInvoice.campaignID>(campaign.CampaignID),
                    new PXDataFieldRestrict <ARInvoice.docType>(row.DocType),
                    new PXDataFieldRestrict <ARInvoice.refNbr>(row.RefNbr)
                    );
            }
            else if (e.Operation == PXDBOperation.Delete)
            {
                PXDatabase.Update <ARInvoice>(
                    new PXDataFieldAssign <ARInvoice.campaignID>(null),
                    new PXDataFieldRestrict <ARInvoice.docType>(row.DocType),
                    new PXDataFieldRestrict <ARInvoice.refNbr>(row.RefNbr)
                    );
            }

            sender.Clear();

            e.Cancel = true;
        }
Ejemplo n.º 4
0
        protected static bool PersistStatement(StatementCreateBO statement, int?aCustomerID, DateTime aStmtDate, IEnumerable <ARStatement> aStatements, IEnumerable <ARStatementDetail> aDetails)
        {
            statement.Clear();

            PXDatabase.Update <Customer>(
                new PXDataFieldAssign <Customer.statementLastDate>(aStmtDate),
                new PXDataFieldRestrict <Customer.bAccountID>(aCustomerID));

            foreach (ARStatement it in aStatements)
            {
                statement.Statement.Insert(it);
            }

            foreach (ARStatementDetail it in aDetails)
            {
                statement.StatementDetail.Insert(it);

                PXDatabase.Update <ARRegister>(
                    new PXDataFieldAssign <ARRegister.statementDate>(aStmtDate),
                    new PXDataFieldRestrict <ARRegister.docType>(it.DocType),
                    new PXDataFieldRestrict <ARRegister.refNbr>(it.RefNbr),
                    new PXDataFieldRestrict <ARRegister.statementDate>(PXDbType.SmallDateTime, 4, null, PXComp.ISNULL));
            }
            statement.Actions.PressSave();

            return(true);
        }
Ejemplo n.º 5
0
        public static void CalculateAvalaraTax(OpportunityMaint rg, CROpportunity order)
        {
            TaxSvc service = new TaxSvc();

            AvalaraMaint.SetupService(rg, service);

            AddressSvc addressService = new AddressSvc();

            AvalaraMaint.SetupService(rg, addressService);

            GetTaxRequest getRequest       = null;
            bool          isValidByDefault = true;

            if (order.IsTaxValid != true)
            {
                getRequest = BuildGetTaxRequest(rg, order);

                if (getRequest.Lines.Count > 0)
                {
                    isValidByDefault = false;
                }
                else
                {
                    getRequest = null;
                }
            }

            if (isValidByDefault)
            {
                PXDatabase.Update <CROpportunity>(
                    new PXDataFieldAssign("IsTaxValid", true),
                    new PXDataFieldRestrict("OpportunityID", PXDbType.NVarChar, CROpportunity.OpportunityIDLength, order.OpportunityID, PXComp.EQ)
                    );
                return;
            }

            GetTaxResult result = service.GetTax(getRequest);

            if (result.ResultCode == SeverityLevel.Success)
            {
                try
                {
                    ApplyAvalaraTax(rg, order, result);
                    PXDatabase.Update <CROpportunity>(
                        new PXDataFieldAssign("IsTaxValid", true),
                        new PXDataFieldRestrict("OpportunityID", PXDbType.NVarChar, CROpportunity.OpportunityIDLength, order.OpportunityID, PXComp.EQ)
                        );
                }
                catch (Exception ex)
                {
                    throw new PXException(ex, TX.Messages.FailedToApplyTaxes);
                }
            }
            else
            {
                LogMessages(result);

                throw new PXException(TX.Messages.FailedToGetTaxes);
            }
        }
Ejemplo n.º 6
0
        private void ErasePseudonymizedData(PXGraph processingGraph, Type childTable, IEnumerable <object> childs)
        {
            foreach (object child in childs)
            {
                List <PXDataFieldParam> assignsDB = new List <PXDataFieldParam>();

                assignsDB.Add(new PXDataFieldAssign(nameof(IPseudonymizable.PseudonymizationStatus), SetPseudonymizationStatus));

                List <PXDataFieldParam> restricts = new List <PXDataFieldParam>();

                foreach (string key in processingGraph.Caches[childTable].Keys)
                {
                    restricts.Add(new PXDataFieldRestrict(key, processingGraph.Caches[childTable].GetValue(child, key)));
                }

                PXDatabase.Update(
                    childTable,
                    assignsDB
                    .Union(restricts)
                    .ToArray()
                    );

                var entityNoteID = processingGraph.Caches[childTable].GetValue(child, nameof(INotable.NoteID)) as Guid?;

                PXDatabase.Delete <SMPersonalData>(
                    new PXDataFieldRestrict <SMPersonalData.table>(childTable.FullName),
                    new PXDataFieldRestrict <SMPersonalData.entityID>(entityNoteID));
            }
        }
Ejemplo n.º 7
0
        protected virtual void Ledger_RowPersisted(PXCache sender, PXRowPersistedEventArgs e)
        {
            Ledger ledger = (Ledger)e.Row;

            if ((e.Operation == PXDBOperation.Insert || e.Operation == PXDBOperation.Update) && e.TranStatus == PXTranStatus.Open)
            {
                if (ledger.BalanceType == LedgerBalanceType.Actual && ledger.DefBranchID != null)
                {
                    PXDatabase.Update <Branch>(
                        new PXDataFieldAssign <Branch.ledgerID>(ledger.LedgerID),
                        new PXDataFieldRestrict <Branch.branchID>(ledger.DefBranchID),
                        new PXDataFieldRestrict <Branch.ledgerID>(PXDbType.Int, 4, null, PXComp.ISNULL));
                }

                //if only single branch exists
                if (ledger.BalanceType == LedgerBalanceType.Actual && (CS.BranchMaint.BranchBAccount)PXSelectJoin <CS.BranchMaint.BranchBAccount,
                                                                                                                   InnerJoin <GL.Branch, On <GL.Branch.bAccountID, NotEqual <CS.BranchMaint.BranchBAccount.bAccountID> > > > .Select(this) == null)
                {
                    PXUpdateJoin <
                        Set <Branch.ledgerID, Required <Branch.ledgerID> >,
                        Branch, LeftJoin <Ledger, On <Ledger.ledgerID, Equal <Branch.ledgerID> > >,
                        Where <Ledger.ledgerID, IsNull> > .Update(this, ledger.LedgerID);
                }
            }
        }
        protected virtual void Account_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            Account row = (Account)e.Row;

            if (!string.IsNullOrEmpty(row.CuryID))
            {
                CASetup casetup = PXSelect <CASetup> .Select(this);

                if (casetup != null && casetup.TransitAcctId != null && casetup.TransitAcctId == row.AccountID)
                {
                    PXException exception = new PXException(CA.Messages.CashInTransitAccountCanNotBeDenominated);
                    sender.RaiseExceptionHandling <Account.curyID>(row, row.CuryID, exception);
                    throw exception;
                }

                string newCuryid;
                if (e.Operation == PXDBOperation.Update)
                {
                    newCuryid = row.CuryID;
                    byte[] timestamp = PXDatabase.SelectTimeStamp();

                    PXDatabase.Update <GLHistory>(new PXDataFieldAssign("CuryID", newCuryid),
                                                  new PXDataFieldRestrict("AccountID", ((Account)e.Row).AccountID),
                                                  new PXDataFieldRestrict("CuryID", PXDbType.VarChar, 5, null, PXComp.ISNULL),
                                                  new PXDataFieldRestrict("tstamp", PXDbType.Timestamp, 8, timestamp, PXComp.LE));
                }
            }
        }
Ejemplo n.º 9
0
        public virtual void UpdateStdCost(INUpdateStdCostRecord itemsite)
        {
            using (new PXConnectionScope())
            {
                using (PXTransactionScope ts = new PXTransactionScope())
                {
                    //will be true for non-stock items as well
                    if (itemsite.StdCostOverride == false && itemsite.PendingStdCostReset == false)
                    {
                        PXDatabase.Update <INItemSite>(
                            new PXDataFieldAssign("StdCost", PXDbType.DirectExpression, "PendingStdCost"),
                            new PXDataFieldAssign("StdCostDate", PXDbType.DateTime, itemsite.PendingStdCostDate),
                            new PXDataFieldAssign("PendingStdCost", PXDbType.Decimal, 0m),
                            new PXDataFieldAssign("PendingStdCostDate", PXDbType.DateTime, null),
                            new PXDataFieldAssign("LastStdCost", PXDbType.DirectExpression, "StdCost"),
                            new PXDataFieldRestrict("InventoryID", PXDbType.Int, itemsite.InventoryID),
                            new PXDataFieldRestrict("StdCostOverride", PXDbType.Bit, false),
                            new PXDataFieldRestrict("PendingStdCostDate", PXDbType.DateTime, 4, itemsite.PendingStdCostDate, PXComp.LE),
                            new PXDataFieldRestrict("PendingStdCostReset", PXDbType.Bit, false));

                        PXDatabase.Update <InventoryItem>(
                            new PXDataFieldAssign("StdCost", PXDbType.DirectExpression, "PendingStdCost"),
                            new PXDataFieldAssign("StdCostDate", PXDbType.DateTime, itemsite.PendingStdCostDate),
                            new PXDataFieldAssign("PendingStdCost", PXDbType.Decimal, 0m),
                            new PXDataFieldAssign("PendingStdCostDate", PXDbType.DateTime, null),
                            new PXDataFieldAssign("LastStdCost", PXDbType.DirectExpression, "StdCost"),
                            new PXDataFieldRestrict("InventoryID", PXDbType.Int, itemsite.InventoryID),
                            new PXDataFieldRestrict("PendingStdCostDate", PXDbType.DateTime, 4, itemsite.PendingStdCostDate, PXComp.LE));
                    }
                    else
                    {
                        var updateParams = new List <PXDataFieldParam>
                        {
                            new PXDataFieldAssign("StdCost", PXDbType.DirectExpression, "PendingStdCost"),
                            new PXDataFieldAssign("StdCostDate", PXDbType.DateTime, itemsite.PendingStdCostDate ?? Accessinfo.BusinessDate),
                            new PXDataFieldAssign("PendingStdCost", PXDbType.Decimal, 0m),
                            new PXDataFieldAssign("PendingStdCostDate", PXDbType.DateTime, null),
                            new PXDataFieldAssign("PendingStdCostReset", PXDbType.Bit, false),
                            new PXDataFieldAssign("LastStdCost", PXDbType.DirectExpression, "StdCost"),
                            new PXDataFieldRestrict("InventoryID", PXDbType.Int, itemsite.InventoryID),
                            new PXDataFieldRestrict("SiteID", PXDbType.Int, itemsite.SiteID)
                        };

                        // Restriction was added within AC-32883 and looks useless as in this 'else' branch double update is impossible.
                        if (itemsite.PendingStdCostReset == false)
                        {
                            updateParams.Add(new PXDataFieldRestrict("PendingStdCostDate", PXDbType.DateTime, 4, itemsite.PendingStdCostDate, PXComp.LE));
                        }

                        PXDatabase.Update <INItemSite>(updateParams.ToArray());
                    }

                    CreateAdjustments(itemsite,
                                      (layer) => PXDBCurrencyAttribute.BaseRound(this, (decimal)(layer.QtyOnHand * itemsite.PendingStdCost)) - layer.TotalCost);

                    ts.Complete();
                }
            }
        }
Ejemplo n.º 10
0
 protected virtual void UpdateBAccounts()
 {
     PXDatabase.Update(new PXGraph(),
                       new Update <Set <BAccount.acctName, Contact.displayName>,
                                   Select2 <BAccount,
                                            InnerJoin <Contact, On <Contact.contactID, Equal <BAccount.defContactID> > >,
                                            Where <BAccount.type, Equal <BAccountType.employeeType> > > >());
 }
Ejemplo n.º 11
0
 public static bool Update(SearchIndex record)
 {
     return(PXDatabase.Update(typeof(SearchIndex),
                              new PXDataFieldRestrict(typeof(SearchIndex.noteID).Name, PXDbType.UniqueIdentifier, record.NoteID),
                              new PXDataFieldAssign(typeof(SearchIndex.category).Name, PXDbType.Int, record.Category),
                              new PXDataFieldAssign(typeof(SearchIndex.entityType).Name, PXDbType.NVarChar, record.EntityType),
                              new PXDataFieldAssign(typeof(SearchIndex.content).Name, PXDbType.NText, record.Content)));
 }
        /// <summary>
        /// Links the Smartsheet user information to the Acumatica's Employee
        /// </summary>
        /// <param name="projectEntryGraph">Project graph</param>
        /// <param name="smartsheetClient">Smartsheet SDK Client</param>
        public void CreateEmployeesAcuUserSS(ProjectEntry projectEntryGraph, SmartsheetClient smartsheetClient)
        {
            User              userRow          = new User();
            AccessUsers       accessUsersGraph = PXGraph.CreateInstance <AccessUsers>();
            AccessUsersSSIExt graphExtended    = accessUsersGraph.GetExtension <AccessUsersSSIExt>();

            try
            {
                EmployeeMaint employeeMaintGraph = PXGraph.CreateInstance <EmployeeMaint>();
                foreach (EPEmployeeContract filter in projectEntryGraph.EmployeeContract.Select())
                {
                    EPEmployee ePEmployeeRecord = employeeMaintGraph.Employee.Current = employeeMaintGraph.Employee.Search <EPEmployee.bAccountID>(filter.EmployeeID);
                    if (ePEmployeeRecord == null)
                    {
                        return;
                    }
                    EPEmployeeSSExt ePEmployeeExtRecord = PXCache <EPEmployee> .GetExtension <EPEmployeeSSExt>(ePEmployeeRecord);

                    if (String.IsNullOrEmpty(Convert.ToString(ePEmployeeExtRecord.UsrSSUserid)))
                    {
                        userRow = graphExtended.CreateSmartsheetUser(filter.EmployeeID, smartsheetClient);
                        if (userRow != null)
                        {
                            PXCache <EPUsersListSS> usersListCache = employeeMaintGraph.Caches <EPUsersListSS>();

                            EPUsersListSS epUsersListSSRow = UserSSList.Select().Where(x => ((EPUsersListSS)x).Ssuserid == userRow.Id).FirstOrDefault();
                            if (epUsersListSSRow == null)
                            {
                                EPUsersListSS usersListSSRow = (EPUsersListSS)usersListCache.Insert(new EPUsersListSS
                                {
                                    Ssuserid   = userRow.Id,
                                    FirstName  = userRow.FirstName,
                                    LastName   = userRow.LastName,
                                    Email      = userRow.Email,
                                    BAccountID = filter.EmployeeID
                                });
                            }
                            else
                            {
                                epUsersListSSRow.BAccountID = filter.EmployeeID;
                                epUsersListSSRow.FirstName  = userRow.FirstName;
                                epUsersListSSRow.LastName   = userRow.LastName;
                                epUsersListSSRow.Email      = userRow.Email;
                                usersListCache.Update(epUsersListSSRow);
                            }
                            employeeMaintGraph.Persist();

                            PXDatabase.Update <EPEmployee>(new PXDataFieldRestrict <EPEmployee.bAccountID>(filter.EmployeeID),
                                                           new PXDataFieldAssign <EPEmployeeSSExt.usrSSUserID>(userRow.Id));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new PXException(ex.Message);
            }
        }
Ejemplo n.º 13
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());
        }
Ejemplo n.º 14
0
        private void RestoreObfuscatedEntries(PXGraph processingGraph, Type childTable, IEnumerable <PXPersonalDataFieldAttribute> fields, IEnumerable <object> childs)
        {
            foreach (object child in childs)
            {
                var entityNoteID = processingGraph.Caches[childTable].GetValue(child, nameof(INotable.NoteID)) as Guid?;

                List <PXDataFieldParam> assignsDB = new List <PXDataFieldParam>();

                foreach (PXDataRecord record in PXDatabase.SelectMulti <SMPersonalData>(
                             new PXDataField <SMPersonalData.field>(),
                             new PXDataField <SMPersonalData.value>(),
                             new PXDataFieldValue <SMPersonalData.table>(childTable.FullName),
                             new PXDataFieldValue <SMPersonalData.entityID>(entityNoteID)))
                {
                    assignsDB.Add(new PXDataFieldAssign(record.GetString(0), record.GetString(1)));
                }

                List <PXDataFieldParam> assignsEntity = new List <PXDataFieldParam>();

                foreach (var field in fields)
                {
                    var defaultAttr = processingGraph.Caches[childTable]
                                      .GetAttributesOfType <PXDefaultAttribute>(null, field.FieldName)
                                      ?.FirstOrDefault();

                    var defaultValue = field.DefaultValue ?? defaultAttr?.Constant;

                    assignsEntity.Add(new PXDataFieldAssign(field.FieldName, defaultValue));
                }

                assignsDB.Add(new PXDataFieldAssign(nameof(IPseudonymizable.PseudonymizationStatus), SetPseudonymizationStatus));

                List <PXDataFieldParam> restricts = new List <PXDataFieldParam>();

                foreach (string key in processingGraph.Caches[childTable].Keys)
                {
                    restricts.Add(new PXDataFieldRestrict(key, processingGraph.Caches[childTable].GetValue(child, key)));
                }

                var isSuccess = PXDatabase.Update(
                    childTable,
                    InterruptRestorationHandler(processingGraph.Caches[childTable], restricts)
                    .Union(assignsDB)
                    .Union(assignsEntity)
                    .Distinct(_ => _.Column.Name.ToLower())
                    .Union(restricts)
                    .ToArray()
                    );

                if (isSuccess)
                {
                    PXDatabase.Delete <SMPersonalData>(
                        new PXDataFieldRestrict <SMPersonalData.table>(childTable.FullName),
                        new PXDataFieldRestrict <SMPersonalData.entityID>(entityNoteID));
                }
            }
        }
Ejemplo n.º 15
0
        protected static void Reset(string classID)
        {
            INItemClassMaint graph     = PXGraph.CreateInstance <INItemClassMaint>();
            INItemClass      itemclass = graph.itemclass.Current = graph.itemclass.Search <INItemClass.itemClassID>(classID);

            if (itemclass != null)
            {
                PXDatabase.Update <InventoryItem>(new PXDataFieldRestrict <InventoryItem.itemClassID>(itemclass.ItemClassID),
                                                  new PXDataFieldAssign <InventoryItem.groupMask>(itemclass.GroupMask));
            }
        }
 // Fix for https://jira.itransition.com/browse/LEGODEV-2320
 // This implementation doesn`t raise any additional events for AccountAttribute.
 // Update APRegister table is required for update 'tstamp' column by SQL Server.
 // Can be removed in case Acumatica provide another fix.
 private void UpdateIsPaymentCycleWorkflow(APInvoice invoice, bool isPaymentCycleWorkflow)
 {
     PXDatabase.Update(typeof(APInvoice),
                       new PXDataFieldAssign(nameof(APInvoiceJCExt.IsPaymentCycleWorkflow), PXDbType.Bit,
                                             isPaymentCycleWorkflow),
                       new PXDataFieldRestrict(nameof(APInvoice.DocType), PXDbType.Char, invoice.DocType),
                       new PXDataFieldRestrict(nameof(APInvoice.RefNbr), PXDbType.NVarChar, invoice.RefNbr));
     PXDatabase.Update(typeof(APRegister),
                       new PXDataFieldAssign(nameof(APRegister.DocType), PXDbType.Char, invoice.DocType),
                       new PXDataFieldRestrict(nameof(APRegister.DocType), PXDbType.Char, invoice.DocType),
                       new PXDataFieldRestrict(nameof(APRegister.RefNbr), PXDbType.NVarChar, invoice.RefNbr));
 }
Ejemplo n.º 17
0
        public virtual void UpdateBasePrice(PX.Objects.IN.INUpdateBasePrice.UpdateBasePriceRecord item)
        {
            using (PXConnectionScope cs = new PXConnectionScope())
            {
                using (PXTransactionScope ts = new PXTransactionScope())
                {
                    DateTime updateTime     = DateTime.Now;
                    string   uom            = item.BaseUnit;
                    decimal? salesPrice     = item.PendingBasePrice;
                    decimal? lastSalesPrice = item.BasePrice;

                    //So that UI reflects the change:
                    item.BasePrice            = item.PendingBasePrice;
                    item.BasePriceDate        = item.PendingBasePriceDate;
                    item.PendingBasePrice     = 0;
                    item.PendingBasePriceDate = null;

                    PXDatabase.Update <InventoryItem>(
                        new PXDataFieldAssign("BasePrice", PXDbType.DirectExpression, "PendingBasePrice"),
                        new PXDataFieldAssign("BasePriceDate", PXDbType.DirectExpression, "PendingBasePriceDate"),
                        new PXDataFieldAssign("PendingBasePrice", PXDbType.Decimal, 0m),
                        new PXDataFieldAssign("PendingBasePriceDate", PXDbType.DateTime, null),
                        new PXDataFieldAssign("LastBasePrice", PXDbType.DirectExpression, "BasePrice"),
                        new PXDataFieldAssign("LastModifiedDateTime", PXDbType.DateTime, updateTime),
                        new PXDataFieldRestrict("InventoryID", PXDbType.Int, item.InventoryID)
                        );

                    if (SalesPriceUpdateUnit == SalesPriceUpdateUnitType.SalesUnit)
                    {
                        uom            = item.SalesUnit;
                        salesPrice     = INUnitAttribute.ConvertFromBase(this.Caches[typeof(PX.Objects.IN.INUpdateBasePrice.UpdateBasePriceRecord)], item.InventoryID, item.SalesUnit, item.PendingBasePrice.Value, INPrecision.UNITCOST);
                        lastSalesPrice = INUnitAttribute.ConvertFromBase(this.Caches[typeof(PX.Objects.IN.INUpdateBasePrice.UpdateBasePriceRecord)], item.InventoryID, item.SalesUnit, item.BasePrice.Value, INPrecision.UNITCOST);
                    }

                    PXDatabase.Update <ARSalesPrice>(
                        new PXDataFieldAssign("SalesPrice", PXDbType.Decimal, salesPrice),
                        new PXDataFieldAssign("LastDate", PXDbType.DirectExpression, "EffectiveDate"),
                        new PXDataFieldAssign("PendingPrice", PXDbType.Decimal, 0m),
                        new PXDataFieldAssign("EffectiveDate", PXDbType.DateTime, null),
                        new PXDataFieldAssign("LastPrice", PXDbType.Decimal, lastSalesPrice),
                        new PXDataFieldAssign("LastModifiedDateTime", PXDbType.DateTime, updateTime),
                        new PXDataFieldRestrict("InventoryID", PXDbType.Int, item.InventoryID),
                        new PXDataFieldRestrict("CustPriceClassID", PXDbType.VarChar, AR.ARPriceClass.EmptyPriceClass),
                        new PXDataFieldRestrict("CuryID", PXDbType.VarChar, Company.Current.BaseCuryID),
                        new PXDataFieldRestrict("UOM", PXDbType.VarChar, uom)
                        );


                    ts.Complete();
                }
            }
        }
Ejemplo n.º 18
0
 protected void _(Events.RowPersisted <SOLine> e)
 {
     using (PXTransactionScope transactionScope = new PXTransactionScope())
     {
         if ((e.Operation & PXDBOperation.Delete) == PXDBOperation.Update || (e.Operation & PXDBOperation.Delete) == PXDBOperation.Insert)
         {
             SOLine row = e.Row;
             PXDatabase.Update <SOLine>((PXDataFieldParam) new PXDataFieldAssign <SOLineExt.usrCombineNbr>((object)string.Format("{0}-{1}", (object)row.OrderNbr, (object)row.LineNbr)), (PXDataFieldParam) new PXDataFieldRestrict <SOLine.orderNbr>(PXDbType.NVarChar, (object)row.OrderNbr), (PXDataFieldParam) new PXDataFieldRestrict <SOLine.lineNbr>(PXDbType.Int, (object)row.LineNbr));
             this.Base.SelectTimeStamp();
         }
         transactionScope.Complete();
     }
 }
Ejemplo n.º 19
0
        public override void Persist()
        {
            bool requestRelogin = Accessinfo.BranchID == null;

            using (PXTransactionScope ts = new PXTransactionScope())
            {
                foreach (BranchBAccount item in BAccount.Cache.Deleted)
                {
                    Branch branch = PXSelect <Branch, Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .Select(this, item.BranchBranchCD);

                    if (branch != null)
                    {
                        if (Accessinfo.BranchID == branch.BranchID)
                        {
                            requestRelogin = true;
                        }
                        PXDatabase.Update <Ledger>(
                            new PXDataFieldAssign <Ledger.defBranchID>(null),
                            new PXDataFieldRestrict <Ledger.defBranchID>(branch.BranchID));
                    }
                }
                base.Persist();
                ts.Complete();
            }
            using (PXTransactionScope tran = new PXTransactionScope())
            {
                PXResultset <Branch> activeBranches = PXSelect <Branch> .Select(this);

                bool clearRoleNames = true;
                foreach (Branch branch in PXSelect <Branch> .Select(this))
                {
                    if (branch.RoleName != null)
                    {
                        clearRoleNames = false;
                    }
                }
                using (PXReadDeletedScope rds = new PXReadDeletedScope())
                {
                    if (clearRoleNames)
                    {
                        PXDatabase.Update <Branch>(new PXDataFieldAssign <Branch.roleName>(null));
                    }
                }
                tran.Complete();
            }
            if (requestRelogin)
            {
                PXAccess.ResetBranchSlot();
                PXLogin.SetBranchID(CreateInstance <PX.SM.SMAccessPersonalMaint>().GetDefaultBranchId());
            }
        }
Ejemplo n.º 20
0
            public bool PersistGrams(Contact contact, bool requireRecreate = false)
            {
                try
                {
                    if (track == null)
                    {
                        track = DateTime.Now;
                    }
                    if (graph.Caches[contact.GetType()].GetStatus(contact) == PXEntryStatus.Deleted)
                    {
                        PXDatabase.Delete <CRGrams>(new PXDataFieldRestrict("EntityID", PXDbType.Int, 4, contact.ContactID, PXComp.EQ));
                        return(false);
                    }

                    if (!requireRecreate && GrammSourceUpdated(contact))
                    {
                        return(false);
                    }

                    PXDatabase.Delete <CRGrams>(new PXDataFieldRestrict("EntityID", PXDbType.Int, 4, contact.ContactID, PXComp.EQ));
                    foreach (CRGrams gram in DoCreateGramms(contact))
                    {
                        PXDatabase.Insert <CRGrams>(
                            new PXDataFieldAssign(typeof(CRGrams.entityID).Name, PXDbType.Int, 4, contact.ContactID),
                            new PXDataFieldAssign(typeof(CRGrams.fieldName).Name, PXDbType.NVarChar, 60, gram.FieldName),
                            new PXDataFieldAssign(typeof(CRGrams.fieldValue).Name, PXDbType.NVarChar, 60, gram.FieldValue),
                            new PXDataFieldAssign(typeof(CRGrams.score).Name, PXDbType.Decimal, 8, gram.Score),
                            new PXDataFieldAssign(typeof(CRGrams.validationType).Name, PXDbType.NVarChar, 2, gram.ValidationType)
                            );
                        //CRGrams row = (CRGrams)graph.Caches[typeof(CRGrams)].Insert(gram);
                        //graph.Caches[typeof(CRGrams)].PersistInserted(row);
                    }
                    contact.GrammValidationDateTime = PXTimeZoneInfo.Now;
                    PXDatabase.Update <Contact>
                    (
                        new PXDataFieldAssign(typeof(Contact.grammValidationDateTime).Name, PXTimeZoneInfo.ConvertTimeToUtc(contact.GrammValidationDateTime.Value, LocaleInfo.GetTimeZone())),
                        new PXDataFieldRestrict(typeof(Contact.contactID).Name, contact.ContactID)
                    );
                    processedItems += 1;
                    return(true);
                }
                finally
                {
                    if (processedItems % 100 == 0)
                    {
                        TimeSpan taken = DateTime.Now - (DateTime)track;
                        System.Diagnostics.Debug.WriteLine("Items count:{0}, increment taken {1}", processedItems, taken);
                        track = DateTime.Now;
                    }
                }
            }
Ejemplo n.º 21
0
        protected virtual void Account_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            string newCuryid;

            if (e.Operation == PXDBOperation.Update && !string.IsNullOrEmpty(newCuryid = ((Account)e.Row).CuryID))
            {
                byte[] timestamp = PXDatabase.SelectTimeStamp();

                PXDatabase.Update <GLHistory>(new PXDataFieldAssign("CuryID", newCuryid),
                                              new PXDataFieldRestrict("AccountID", ((Account)e.Row).AccountID),
                                              new PXDataFieldRestrict("CuryID", PXDbType.VarChar, 5, null, PXComp.ISNULL),
                                              new PXDataFieldRestrict("tstamp", PXDbType.Timestamp, 8, timestamp, PXComp.LE));
            }
        }
        protected virtual void INSite_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            INAcctSubDefault.Required(sender, e);
            if (e.Operation.Command().IsIn(PXDBOperation.Insert, PXDBOperation.Update))
            {
                var site = (INSite)e.Row;
                if (site.OverrideInvtAccSub != true)
                {
                    PXDefaultAttribute.SetPersistingCheck <INSite.invtAcctID>(sender, e.Row, PXPersistingCheck.Nothing);
                    PXDefaultAttribute.SetPersistingCheck <INSite.invtSubID>(sender, e.Row, PXPersistingCheck.Nothing);
                }
                if (site.ReceiptLocationIDOverride == true || site.ShipLocationIDOverride == true)
                {
                    List <PXDataFieldParam> prm = new List <PXDataFieldParam>();
                    if (site.ReceiptLocationIDOverride == true)
                    {
                        prm.Add(new PXDataFieldAssign(typeof(INItemSite.dfltReceiptLocationID).Name, PXDbType.Int, site.ReceiptLocationID));
                    }
                    if (site.ShipLocationIDOverride == true)
                    {
                        prm.Add(new PXDataFieldAssign(typeof(INItemSite.dfltShipLocationID).Name, PXDbType.Int, site.ShipLocationID));
                    }
                    prm.Add(new PXDataFieldRestrict(typeof(INItemSite.siteID).Name, PXDbType.Int, site.SiteID));
                    PXDatabase.Update <INItemSite>(prm.ToArray());
                }

                if (site.Active != true)
                {
                    bool cantDeactivateSite = (INRegister)
                                              PXSelect <INRegister,
                                                        Where <INRegister.released, NotEqual <True>,
                                                               And <Where <INRegister.siteID, Equal <Current <INSite.siteID> >,
                                                                           Or <INRegister.toSiteID, Equal <Current <INSite.siteID> > > > > > >
                                              .SelectSingleBound(this, new [] { e.Row }) != null;

                    cantDeactivateSite = cantDeactivateSite || (INTran)
                                         PXSelect <INTran,
                                                   Where <INTran.released, NotEqual <True>,
                                                          And <Where <INTran.siteID, Equal <Current <INSite.siteID> >,
                                                                      Or <INTran.toSiteID, Equal <Current <INSite.siteID> > > > > > >
                                         .SelectSingleBound(this, new [] { e.Row }) != null;

                    if (cantDeactivateSite)
                    {
                        sender.RaiseExceptionHandling <INSite.active>(e.Row, null, new PXSetPropertyException(Messages.CantDeactivateSite));
                    }
                }
            }
        }
Ejemplo n.º 23
0
        public virtual void CloseInvoiceAndClearBalances(ARRegister ardoc, int?adjNbr, Action <ARRegister, int?> baseMethod)
        {
            if (ardoc.IsUnderCorrection == true)
            {
                ardoc.Canceled = true;

                PXDatabase.Update <ARTran>(
                    new PXDataFieldAssign <ARTran.canceled>(PXDbType.Bit, true),
                    new PXDataFieldRestrict <ARTran.tranType>(PXDbType.Char, ardoc.DocType),
                    new PXDataFieldRestrict <ARTran.refNbr>(PXDbType.NVarChar, ardoc.RefNbr),
                    new PXDataFieldRestrict <ARTran.canceled>(PXDbType.Bit, false));
            }

            baseMethod(ardoc, adjNbr);
        }
        protected virtual void GLSetup_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            GLSetup OldRow = (GLSetup)PXSelectReadonly <GLSetup> .Select(this);

            GLSetup NewRow = (GLSetup)e.Row;

            if ((OldRow == null || OldRow.COAOrder != NewRow.COAOrder) && NewRow.COAOrder < 4)
            {
                for (short i = 0; i < 4; i++)
                {
                    PXDatabase.Update <Account>(new PXDataFieldAssign("COAOrder", Convert.ToInt32(AccountType.COAOrderOptions[(int)NewRow.COAOrder].Substring((int)i, 1))),
                                                new PXDataFieldRestrict("Type", AccountType.Literal(i)));
                    PXDatabase.Update <PM.PMAccountGroup>(new PXDataFieldAssign(typeof(PM.PMAccountGroup.sortOrder).Name, Convert.ToInt32(AccountType.COAOrderOptions[(int)NewRow.COAOrder].Substring((int)i, 1))),
                                                          new PXDataFieldRestrict(typeof(PM.PMAccountGroup.type).Name, AccountType.Literal(i)));
                }
            }
        }
Ejemplo n.º 25
0
        public virtual void UpdatePrice(POVendorInventoryExt item)
        {
            using (PXConnectionScope cs = new PXConnectionScope())
            {
                using (PXTransactionScope ts = new PXTransactionScope())
                {
                    DateTime updateTime = DateTime.Now;
                    item.LastPrice    = item.EffPrice;
                    item.EffPrice     = item.PendingPrice;
                    item.EffDate      = item.PendingDate;
                    item.PendingPrice = 0m;
                    item.PendingDate  = null;

                    PXDatabase.Update <POVendorInventory>(
                        new PXDataFieldAssign(typeof(POVendorInventory.lastPrice).Name, PXDbType.Decimal, item.LastPrice),
                        new PXDataFieldAssign(typeof(POVendorInventory.effPrice).Name, PXDbType.Decimal, item.EffPrice),
                        new PXDataFieldAssign(typeof(POVendorInventory.effDate).Name, PXDbType.DateTime, item.EffDate),
                        new PXDataFieldAssign(typeof(POVendorInventory.pendingPrice).Name, PXDbType.Decimal, 0m),
                        new PXDataFieldAssign(typeof(POVendorInventory.pendingDate).Name, PXDbType.DateTime, null),
                        new PXDataFieldAssign(typeof(POVendorInventory.lastModifiedDateTime).Name, PXDbType.DateTime, updateTime),
                        new PXDataFieldRestrict(typeof(POVendorInventory.recordID).Name, PXDbType.Int, item.RecordID)
                        );

                    PXDatabase.Update <APSalesPrice>(
                        new PXDataFieldAssign(typeof(APSalesPrice.lastPrice).Name, PXDbType.Decimal, item.LastPrice),
                        new PXDataFieldAssign(typeof(APSalesPrice.salesPrice).Name, PXDbType.Decimal, item.EffPrice),
                        new PXDataFieldAssign(typeof(APSalesPrice.lastDate).Name, PXDbType.DateTime, item.EffDate),
                        new PXDataFieldAssign(typeof(APSalesPrice.pendingPrice).Name, PXDbType.Decimal, 0),
                        new PXDataFieldAssign(typeof(APSalesPrice.effectiveDate).Name, PXDbType.DateTime, null),
                        new PXDataFieldAssign(typeof(APSalesPrice.lastModifiedDateTime).Name, PXDbType.DateTime, updateTime),

                        new PXDataFieldRestrict(typeof(APSalesPrice.inventoryID).Name, PXDbType.Int, item.InventoryID),
                        new PXDataFieldRestrict(typeof(APSalesPrice.vendorID).Name, PXDbType.Int, item.VendorID),
                        new PXDataFieldRestrict(typeof(APSalesPrice.vendorLocationID).Name, PXDbType.Int, item.VendorLocationID),
                        new PXDataFieldRestrict(typeof(APSalesPrice.curyID).Name, PXDbType.NVarChar, item.CuryID),
                        new PXDataFieldRestrict(typeof(APSalesPrice.uOM).Name, PXDbType.NVarChar, item.PurchaseUnit),
                        new PXDataFieldRestrict(typeof(APSalesPrice.subItemID).Name, PXDbType.Int, item.SubItemID),
                        new PXDataFieldRestrict(typeof(APSalesPrice.breakQty).Name, PXDbType.Decimal, 0),
                        new PXDataFieldRestrict(typeof(APSalesPrice.pendingBreakQty).Name, PXDbType.Decimal, 0),
                        new PXDataFieldRestrict(typeof(APSalesPrice.isPromotionalPrice).Name, PXDbType.Bit, false)
                        );

                    ts.Complete();
                }
            }
        }
Ejemplo n.º 26
0
            private void PostProcessMessage(SMEmail message)
            {
                PXDatabase.Update <CRActivity>(
                    new PXDataFieldAssign <CRActivity.startDate>(PXTimeZoneInfo.UtcNow),
                    new PXDataFieldAssign <CRActivity.uistatus>(message.Exception == null
                                                ? ActivityStatusAttribute.Completed
                                                : ActivityStatusAttribute.Open),
                    new PXDataFieldRestrict <CRActivity.noteID>(PXDbType.UniqueIdentifier, 16, message.RefNoteID, PXComp.EQ));

                if (message.Exception == null)
                {
                    PXUpdate <Set <PMTimeActivity.approvalStatus,
                                   Switch <Case <Where <PMTimeActivity.approverID, IsNull>,
                                                 ActivityStatusAttribute.completed>,
                                           ActivityStatusAttribute.pendingApproval> >,
                              PMTimeActivity,
                              Where <PMTimeActivity.refNoteID, Equal <Required <PMTimeActivity.refNoteID> >,
                                     And <PMTimeActivity.isCorrected, Equal <Zero> > > >
                    .Update(_graph, message.RefNoteID);
                }

                if (message.Exception == null)
                {
                    message.RetryCount = 0;
                    message.MPStatus   = MailStatusListAttribute.Processed;
                }
                else
                {
                    message.RetryCount += 1;
                    if (message.Exception.StartsWith("5") ||
                        message.RetryCount >= MailAccountManager.GetEmailPreferences().RepeatOnErrorSending)
                    {
                        message.RetryCount = 0;
                        message.MPStatus   = MailStatusListAttribute.Failed;
                    }
                    else
                    {
                        message.MPStatus = MailStatusListAttribute.PreProcess;
                    }
                }

                UpdateMessage(message);
            }
Ejemplo n.º 27
0
        protected virtual void INPIDetail_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            INPIDetail d = e.NewRow as INPIDetail;
            INPIDetail o = e.Row as INPIDetail;

            if (d == null || o == null)
            {
                return;
            }
            using (PXTransactionScope sc = new PXTransactionScope())
            {
                if (!PXDatabase.Update <INPIDetail>(
                        new PXDataFieldAssign(typeof(INPIDetail.status).Name, PXDbType.VarChar, d.Status),
                        new PXDataFieldAssign(typeof(INPIDetail.physicalQty).Name, PXDbType.Decimal, d.PhysicalQty),
                        new PXDataFieldAssign(typeof(INPIDetail.varQty).Name, PXDbType.Decimal, d.VarQty),
                        new PXDataFieldAssign(typeof(INPIDetail.extVarCost).Name, PXDbType.Decimal, d.ExtVarCost),
                        new PXDataFieldRestrict(typeof(INPIDetail.pIID).Name, PXDbType.VarChar, d.PIID),
                        new PXDataFieldRestrict(typeof(INPIDetail.lineNbr).Name, PXDbType.Int, d.LineNbr),
                        new PXDataFieldRestrict(typeof(INPIDetail.Tstamp).Name, PXDbType.Timestamp, 8, this.TimeStamp, PXComp.LE)
                        ))
                {
                    throw new PXException(ErrorMessages.RecordUpdatedByAnotherProcess, typeof(INPIDetail).Name);
                }

                PXDatabase.Update <INPIHeader>(
                    new PXDataFieldAssign(typeof(INPIHeader.totalPhysicalQty).Name, PXDbType.Decimal, (d.PhysicalQty ?? 0) - (o.PhysicalQty ?? 0))
                {
                    Behavior = PXDataFieldAssign.AssignBehavior.Summarize
                },
                    new PXDataFieldAssign(typeof(INPIHeader.totalVarQty).Name, PXDbType.Decimal, (d.VarQty ?? 0) - (o.VarQty ?? 0))
                {
                    Behavior = PXDataFieldAssign.AssignBehavior.Summarize
                },
                    new PXDataFieldAssign(typeof(INPIHeader.totalVarCost).Name, PXDbType.Decimal, (d.ExtVarCost ?? 0) - (o.ExtVarCost ?? 0))
                {
                    Behavior = PXDataFieldAssign.AssignBehavior.Summarize
                },
                    new PXDataFieldRestrict(typeof(INPIHeader.pIID).Name, PXDbType.VarChar, d.PIID));

                sc.Complete();
            }
        }
Ejemplo n.º 28
0
        protected virtual void _(Events.RowPersisted <ARInvoice> e)
        {
            bool insert = e.Operation == PXDBOperation.Insert;
            bool delete = e.Operation == PXDBOperation.Delete;

            if ((insert || delete) && e.TranStatus == PXTranStatus.Open &&
                (e.Row.IsCorrection == true || e.Row.IsCancellation == true) && e.Row.OrigDocType != null && e.Row.OrigRefNbr != null &&
                !this.CancellationInvoiceCreationOnRelease)
            {
                bool updatedOriginal = PXDatabase.Update <ARRegister>(
                    new PXDataFieldAssign <ARRegister.isUnderCorrection>(PXDbType.Bit, insert),
                    new PXDataFieldRestrict <ARRegister.docType>(PXDbType.Char, e.Row.OrigDocType),
                    new PXDataFieldRestrict <ARRegister.refNbr>(PXDbType.NVarChar, e.Row.OrigRefNbr),
                    new PXDataFieldRestrict <ARRegister.isUnderCorrection>(PXDbType.Bit, !insert));
                if (!updatedOriginal)
                {
                    throw new PXLockViolationException(typeof(ARInvoice), PXDBOperation.Update, new[] { e.Row.OrigDocType, e.Row.OrigRefNbr });
                }
            }
        }
        protected IEnumerable resetWarning(PXAdapter adapter)
        {
            EMailAccountSyncFilter filter  = Filter.Current;
            EMailSyncAccount       account = SelectedItems.Current;

            if (filter == null || account == null)
            {
                return(adapter.Get());
            }


            PXDatabase.Update <EMailSyncAccount>(
                new PXDataFieldAssign <EMailSyncAccount.hasErrors>(false),
                new PXDataFieldRestrict <EMailSyncAccount.serverID>(account.ServerID),
                new PXDataFieldRestrict <EMailSyncAccount.employeeID>(account.EmployeeID));

            SelectedItems.View.RequestRefresh();
            SelectedItems.View.Clear();

            return(adapter.Get());
        }
Ejemplo n.º 30
0
        protected virtual void _(Events.RowPersisted <ARInvoice> e)
        {
            if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete)
            {
                List <PXDataFieldParam> commands = new List <PXDataFieldParam>();

                commands.Add(new PXDataFieldRestrict <PMTran.aRTranType>(PXDbType.Char, 3, e.Row.DocType, PXComp.EQ));
                commands.Add(new PXDataFieldRestrict <PMTran.aRRefNbr>(PXDbType.NChar, 15, e.Row.RefNbr, PXComp.EQ));
                commands.Add(new PXDataFieldAssign(typeof(PMTran.aRTranType).Name, PXDbType.Char, null));
                commands.Add(new PXDataFieldAssign(typeof(PMTran.aRRefNbr).Name, PXDbType.Char, null));
                commands.Add(new PXDataFieldAssign(typeof(PMTran.refLineNbr).Name, PXDbType.Int, null));
                if (e.Row.ProformaExists != true)
                {
                    commands.Add(new PXDataFieldAssign(typeof(PMTran.billed).Name, PXDbType.Bit, false));
                    commands.Add(new PXDataFieldAssign(typeof(PMTran.billedDate).Name, PXDbType.DateTime, null));
                    commands.Add(new PXDataFieldAssign(typeof(PMTran.invoicedQty).Name, PXDbType.Decimal, 0m));
                    commands.Add(new PXDataFieldAssign(typeof(PMTran.invoicedAmount).Name, PXDbType.Decimal, 0m));
                }
                // Acuminator disable once PX1043 SavingChangesInEventHandlers [Reseting the links on document delete - for a large document there can be thousands of records causing timeout on delete if done through PXCache.delete]
                PXDatabase.Update <PMTran>(commands.ToArray());
            }
        }