protected virtual void _(Events.RowPersisted <FSAppointment> e) { if (e.TranStatus == PXTranStatus.Aborted) { serviceOrderRowPersistedPassedWithStatusAbort = true; } }
protected virtual void _(Events.RowPersisted <EPEquipment> e) { if (e.Row == null) { return; } if (e.TranStatus == PXTranStatus.Open) { EPEquipment epEquipmentRow = (EPEquipment)e.Row; FSEquipment fsEquipmentRow = GetRelatedFSEquipmentRow(e.Cache.Graph); if (fsEquipmentRow != null) { PXCache <FSEquipment> cacheFSEquipment = new PXCache <FSEquipment>(Base); // This is to prevent an error on the FSEquipment cache trying to change a common field (status, description) // after extending an equipment to FSEquipment. cacheFSEquipment.Graph.SelectTimeStamp(); if (EquipmentHelper.UpdateFSEquipmentWithEPEquipment(cacheFSEquipment, fsEquipmentRow, e.Cache, epEquipmentRow)) { cacheFSEquipment.Update(fsEquipmentRow); cacheFSEquipment.Persist(PXDBOperation.Update); } } } }
protected virtual void _(Events.RowPersisted <SOInvoice> e) { switch (Mode) { case 0: throw new PXRowPersistedException(typeof(SOInvoice.refNbr).Name, e.Row.RefNbr, "Persist error"); //No diagnostic case 1: throw new PXLockViolationException(typeof(SOInvoice), PXDBOperation.Insert, new object[] { e.Row.RefNbr }); //No diagnostic case 2: throw new PXException("Something bad happened"); //Should report diagnostic case 3: throw new ArgumentOutOfRangeException(nameof(Mode)); //No diagnostic case 4: throw new ArgumentNullException(nameof(Mode)); //No diagnostic case 5: throw new ArgumentException("Something bad happened"); //No diagnostic case 6: throw new NotImplementedException(); //No diagnostic default: throw new NotSupportedException(); //No diagnostic } }
protected virtual void _(Events.RowPersisted <EPEquipment> e) { if (e.Row == null || VehicleSelected.Current == null) { return; } EPEquipment epEquipmentRow = (EPEquipment)e.Row; if (epEquipmentRow.EquipmentID != VehicleSelected.Current.SourceID) { return; } if (e.Operation == PXDBOperation.Delete && e.TranStatus == PXTranStatus.Open) { try { using (PXTransactionScope ts = new PXTransactionScope()) { VehicleSelected.Delete(VehicleSelected.Current); VehicleSelected.Cache.Persist(PXDBOperation.Delete); ts.Complete(); } VehicleSelected.Cache.Persisted(false); } catch { VehicleSelected.Cache.Persisted(true); throw; } } }
protected virtual void _(Events.RowPersisted <FSBillingCycle> e) { if (e.Row == null) { return; } FSBillingCycle fsBillingCycleRow = (FSBillingCycle)e.Row; if (e.Operation == PXDBOperation.Update && e.TranStatus == PXTranStatus.Open && fsBillingCycleRow.UpdateCutOffDate == true) { SharedFunctions.PreUpdateBillingInfoDocs(this, null, fsBillingCycleRow.BillingCycleID); } if (e.TranStatus == PXTranStatus.Completed) { if (fsBillingCycleRow.UpdateCutOffDate == true) { fsBillingCycleRow.UpdateCutOffDate = false; SharedFunctions.UpdateBillingInfoInDocsLO(this, null, fsBillingCycleRow.BillingCycleID); } } }
protected virtual void _(Events.RowPersisted <POOrder> e) { if (e.TranStatus == PXTranStatus.Open && e.Operation == PXDBOperation.Update) { POOrder poOrderRow = (POOrder)e.Row; string poOrderOldStatus = (string)e.Cache.GetValueOriginal <POOrder.status>(poOrderRow); bool updateLines = false; List <POLine> poLineUpdatedList = new List <POLine>(); foreach (object row in Base.poOrderLineUPD.Cache.Updated) { if ((bool?)Base.poOrderLineUPD.Cache.GetValue <POLineUOpen.completed>(row) != false) { updateLines = true; } poLineUpdatedList.Add(SharedFunctions.ConvertToPOLine((POLineUOpen)row)); } if (poOrderOldStatus != poOrderRow.Status || updateLines == true) { SharedFunctions.UpdateFSSODetReferences(e.Cache.Graph, serviceOrderView.Cache, poOrderRow, poLineUpdatedList); } } }
protected virtual void _(Events.RowPersisted <InventoryItem> e) { if (e.Row == null) { return; } SharedFunctions.PropagateBaseUnitToContracts(e.Cache, (InventoryItem)e.Row, e.TranStatus, e.Operation, baseUnitChanged); }
protected virtual void _(Events.RowPersisted <CRActivity> e) { if (e.TranStatus == PXTranStatus.Open && PXAccess.FeatureInstalled <FeaturesSet.timeReportingModule>()) { CRActivity crActivityRow = (CRActivity)e.Row; UpdateServiceOrderDetail(e.Cache, crActivityRow, e.Operation); } }
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(); } }
protected virtual void _(Events.RowPersisted <SOInvoice> e) { switch (Mode) { case 0: throw new PXRowPersistedException(typeof(SOInvoice.refNbr).Name, e.Row.RefNbr, "Persist error"); //No diagnostic case 1: throw new PXLockViolationException(typeof(SOInvoice), PXDBOperation.Insert, new object[] { e.Row.RefNbr }); //No diagnostic default: throw new PXException("Something bad happened"); //No diagnostic in processing graph } }
protected virtual void _(Events.RowPersisted <DuplicateDocument> e) { DuplicateDocument row = e.Row as DuplicateDocument; if (row == null || e.TranStatus != PXTranStatus.Open) { return; } if (PersistGrams(row)) { DuplicateDocuments.Cache.SetValue <DuplicateDocument.duplicateStatus>(row, row.DuplicateStatus); DuplicateDocuments.Cache.SetValue <DuplicateDocument.grammValidationDateTime>(row, row.GrammValidationDateTime); } }
protected virtual void _(Events.RowPersisted <FSWFStage> e) { if (e.Row == null) { return; } FSWFStage fsWFStageRow = (FSWFStage)e.Row; if (fsWFStageRow == fsWFStageRow_Current && e.TranStatus == PXTranStatus.Completed) { NodeFilter.Current.WFID = fsWFStageRow.WFID; NodeFilter.Current.WFStageID = fsWFStageRow.WFStageID; } }
protected virtual void _(Events.RowPersisted <APInvoice> e) { if (e.Row == null || SharedFunctions.isFSSetupSet(Base) == false) { return; } APInvoice apInvoiceRow = (APInvoice)e.Row; if (e.Operation == PXDBOperation.Delete && e.TranStatus == PXTranStatus.Open) { InvoicingFunctions.CleanPostingInfoLinkedToDoc(apInvoiceRow); } }
public virtual void _(Events.RowPersisted <APPayment> args) { if (args.TranStatus == PXTranStatus.Open && args.Row is APPayment payment && IsPaymentTypeCheckOrPrepayment(payment.DocType) && IsPaymentStatusPendingPrintingOrBalanced(payment.Status) && HasPaymentStatusChangedSinceLastSave(args.Cache, payment)) { context.LienWaiversForPayment = LienWaiverDataProvider.GetLienWaivers(payment.NoteID); if (!context.PaymentHasGeneratedLienWaivers && ShouldLienWaiverBeGeneratedOnPayingBill()) { GenerateLienWaiver(payment); } } }
protected virtual void _(Events.RowPersisted <APTran> e) { if (e.Row == null) { return; } APTran apTranRow = (APTran)e.Row; // We call here cache.GetStateExt for every field when the transaction is aborted // to set the errors in the fields and then the Generate Invoice screen can read them if (e.TranStatus == PXTranStatus.Aborted && IsInvoiceProcessRunning == true) { MessageHelper.GetRowMessage(e.Cache, apTranRow, false, false); } }
protected virtual void _(Events.RowPersisted <FSTimeSlot> e) { if (e.Row == null) { return; } FSTimeSlot fsTimeSlotRow = (FSTimeSlot)e.Row; // Checking if is necessary compress the rules for an Employee for a specific day if (fsTimeSlotRow.SlotLevel == ID.EmployeeTimeSlotLevel.BASE && e.TranStatus == PXTranStatus.Completed) { DeleteTimeSlotsByLevel(fsTimeSlotRow, ID.EmployeeTimeSlotLevel.COMPRESS); CreateAndCompressedTimeSlots(fsTimeSlotRow, this); } }
protected virtual void _(Events.RowPersisted <POOrder> e) { POOrder poOrderRow = (POOrder)e.Row; PXCache cache = e.Cache; if (poOrderRow.OrderType != POOrderType.RegularOrder) { return; } if (e.TranStatus == PXTranStatus.Open) { if (e.Operation == PXDBOperation.Delete) { ClearFSSODetReferences(cache.Graph, poOrderRow); } else if (e.Operation == PXDBOperation.Update) { string poOrderOldStatus = (string)cache.GetValueOriginal <POOrder.status>(poOrderRow); bool updateLines = false; List <POLine> poLineUpdatedList = new List <POLine>(); foreach (object row in Base.Transactions.Cache.Updated) { if ((bool?)Base.Transactions.Cache.GetValue <POLine.completed>(row) != (bool?)Base.Transactions.Cache.GetValueOriginal <POLine.completed>(row)) { updateLines = true; } poLineUpdatedList.Add((POLine)row); } if (poOrderOldStatus != poOrderRow.Status || updateLines == true) { if (poOrderRow.Status == POOrderStatus.Cancelled || poOrderRow.Status == POOrderStatus.Voided) { ClearFSSODetReferences(cache.Graph, poOrderRow); } else { SharedFunctions.UpdateFSSODetReferences(cache.Graph, serviceOrderView.Cache, poOrderRow, poLineUpdatedList); } } } } }
protected virtual void _(Events.RowPersisted <SOInvoice> e) { if (e.Row == null) { return; } SOInvoice soInvoiceRow = (SOInvoice)e.Row; if (e.TranStatus == PXTranStatus.Open) { if (e.Operation == PXDBOperation.Delete) { InvoicingFunctions.CleanPostingInfoLinkedToDoc(soInvoiceRow); } } }
protected virtual void _(Events.RowPersisted <EPPosition> e) { if (e.Row == null) { return; } if (e.TranStatus == PXTranStatus.Open) { EPPosition epPositionRow = (EPPosition)e.Row; FSxEPPosition fsxEPPositionRow = e.Cache.GetExtension <FSxEPPosition>(epPositionRow); if (fsxEPPositionRow.SDEnabledModified == true) { WebDialogResult confirmResult = Base.EPPosition.Ask(TX.WebDialogTitles.POSITION_PROPAGATE_CONFIRM, TX.Messages.POSITION_PROPAGATE_CONFIRM, MessageButtons.YesNo); if (confirmResult == WebDialogResult.Yes) { Employee.Cache.Clear(); var epEmployeeSet = PXSelectJoin <EPEmployee, InnerJoin <EPEmployeePosition, On < EPEmployeePosition.employeeID, Equal <EPEmployee.bAccountID> > >, Where < EPEmployeePosition.positionID, Equal <Required <EPEmployeePosition.positionID> >, And <EPEmployeePosition.isActive, Equal <True> > > > .Select(Base, epPositionRow.PositionID); foreach (EPEmployee epEmployeeRow in epEmployeeSet) { var fsxEPEmployeeRow = Employee.Cache.GetExtension <FSxEPEmployee>(epEmployeeRow); if (fsxEPEmployeeRow != null) { fsxEPEmployeeRow.SDEnabled = fsxEPPositionRow.SDEnabled; Employee.Cache.Update(epEmployeeRow); Employee.Cache.SetStatus(epEmployeeRow, PXEntryStatus.Updated); } } Employee.Cache.Persist(PXDBOperation.Insert | PXDBOperation.Update); } } } }
public void _(Events.RowPersisted <SOOrder> args) { if (args.Row == null) { return; } if (args.Row.Status == SOOrderStatus.Open && args.TranStatus == PXTranStatus.Completed) { var chatMaint = PXGraph.CreateInstance <ChatMaint>(); var prices = chatMaint.GetPrediction(args.Row); var message = prices.Aggregate(string.Empty, (current, price) => string.Concat(current, $"{price}, ")); var messageActual = Base.Transactions.SelectMain().Select(t => t.UnitPrice).Aggregate(string.Empty, (current, price) => string.Concat(current, $"{(int) price.GetValueOrDefault()}, ")); var hubContext = SignalRConnectionManager.GetHubContext <ChatHub>(); hubContext.Clients.All.broadcastMessage( $"Sales Order is taken off hold. Actual prices are ${messageActual} but predicted unit prices are: {message}"); } }
protected virtual void _(Events.RowPersisted <EPTimeCard> e) { if (e.Row == null || !TimeCardHelper.IsTheTimeCardIntegrationEnabled(Base)) { return; } EPTimeCard epTimeCardRow = (EPTimeCard)e.Row; PXCache cache = e.Cache; if (epTimeCardRow.IsApproved == true && (bool)cache.GetValueOriginal <EPTimeCard.isApproved>(epTimeCardRow) == false && e.TranStatus == PXTranStatus.Open) { UpdateAppointmentFromApprovedTimeCard(cache); } }
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 virtual void _(Events.RowPersisted <FSSetup> e) { if (e.Row == null) { return; } FSSetup fsSetupRow = (FSSetup)e.Row; if (e.Operation == PXDBOperation.Update && e.TranStatus == PXTranStatus.Open && fsSetupRow.BillingOptionsChanged == true) { SharedFunctions.PreUpdateBillingInfoDocs(this, null, null); } if (e.TranStatus == PXTranStatus.Completed && fsSetupRow.BillingOptionsChanged == true) { fsSetupRow.BillingOptionsChanged = false; SharedFunctions.UpdateBillingInfoInDocsLO(this, null, null); } }
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()); } }
protected virtual void _(Events.RowPersisted <Customer> e) { if (e.Row == null) { return; } Customer customerRow = (Customer)e.Row; FSxCustomer fsxCustomerRow = e.Cache.GetExtension <FSxCustomer>(customerRow); if (e.Operation == PXDBOperation.Update && e.TranStatus == PXTranStatus.Open && fsxCustomerRow.BillingOptionsChanged == true) { SharedFunctions.PreUpdateBillingInfoDocs(Base, customerRow.BAccountID, null); } if (e.TranStatus == PXTranStatus.Completed && fsxCustomerRow.BillingOptionsChanged == true) { fsxCustomerRow.BillingOptionsChanged = false; SharedFunctions.UpdateBillingInfoInDocsLO(Base, customerRow.BAccountID, null); } }
protected virtual void _(Events.RowPersisted <CASetup> e) { if (e.TranStatus == PXTranStatus.Open) { PXUpdate <Set <CashAccount.receiptTranDaysBefore, Required <CashAccount.receiptTranDaysBefore>, Set <CashAccount.receiptTranDaysAfter, Required <CashAccount.receiptTranDaysAfter>, Set <CashAccount.disbursementTranDaysBefore, Required <CashAccount.disbursementTranDaysBefore>, Set <CashAccount.disbursementTranDaysAfter, Required <CashAccount.disbursementTranDaysAfter>, Set <CashAccount.allowMatchingCreditMemo, Required <CashAccount.allowMatchingCreditMemo>, Set <CashAccount.refNbrCompareWeight, Required <CashAccount.refNbrCompareWeight>, Set <CashAccount.dateCompareWeight, Required <CashAccount.dateCompareWeight>, Set <CashAccount.payeeCompareWeight, Required <CashAccount.payeeCompareWeight>, Set <CashAccount.dateMeanOffset, Required <CashAccount.dateMeanOffset>, Set <CashAccount.dateSigma, Required <CashAccount.dateSigma>, Set <CashAccount.skipVoided, Required <CashAccount.skipVoided>, Set <CashAccount.curyDiffThreshold, Required <CashAccount.curyDiffThreshold>, Set <CashAccount.amountWeight, Required <CashAccount.amountWeight>, Set <CashAccount.emptyRefNbrMatching, Required <CashAccount.emptyRefNbrMatching> > > > > > > > > > > > > > >, CashAccount, Where <CashAccount.matchSettingsPerAccount, NotEqual <True> > > .Update(this, e.Row.ReceiptTranDaysBefore, e.Row.ReceiptTranDaysAfter, e.Row.DisbursementTranDaysBefore, e.Row.DisbursementTranDaysAfter, e.Row.AllowMatchingCreditMemo, e.Row.RefNbrCompareWeight, e.Row.DateCompareWeight, e.Row.PayeeCompareWeight, e.Row.DateMeanOffset, e.Row.DateSigma, e.Row.SkipVoided, e.Row.CuryDiffThreshold, e.Row.AmountWeight, e.Row.EmptyRefNbrMatching); } }
/// <summary> RowPersisted ENGineering </summary> public void _(Events.RowPersisted <ENGineering> e) { int count = 0; var row = e.Row as ENGineering; if (string.IsNullOrEmpty(row.Description) || string.IsNullOrEmpty(row.Prjtype) || string.IsNullOrEmpty(row.Priority) || string.IsNullOrEmpty(row.SalesRegion)) { return; } var _RevenueData = new PXGraph().Select <ENGRevenueLine>().Where(x => x.EngrRef == row.EngrRef); if (_RevenueData.Count() == 0) { var _graph = PXGraph.CreateInstance <ENGineeringMaint>(); var _oppProduct = Base.Products.Select().RowCast <CROpportunityProducts>(); foreach (var _prod in _oppProduct) { var _data = _graph.RevenueLine.Insert(_graph.RevenueLine.Cache.CreateInstance() as ENGRevenueLine); _data.EngrRef = row.EngrRef; _data.InventoryID = _prod.InventoryID; _data.Descr = _prod.Descr; _data.Quantity = _prod.Quantity; _data.Uom = _prod.UOM; _data.UnitPrice = _prod.UnitPrice; _data.ExtPrice = _prod.ExtPrice; _data.LineNbr = ++count; } _graph.Actions.PressSave(); // update reveCntr PXUpdate <Set <ENGineering.reveCntr, Required <ENGineering.reveCntr> >, ENGineering, Where <ENGineering.engrRef, Equal <Required <ENGineering.engrRef> > > > .Update(Base, count, row.EngrRef); } }
protected virtual void _(Events.RowPersisted <CROpportunityProducts> e) { }
protected virtual void _(Events.RowPersisted <FSServiceTemplate> e) { }
protected virtual void _(Events.RowPersisted <TimeCardMaint.EPTimecardDetail> e) { }