Ejemplo n.º 1
0
        /// <summary> RowInserting CROpportunity </summary>
        public void _(Events.RowInserting <CROpportunity> e, PXRowInserting baseMethod)
        {
            baseMethod?.Invoke(e.Cache, e.Args);
            var row = e.Row;

            if (row != null && row.LeadID.HasValue)
            {
                var leads = SelectFrom <CRLead>
                            .Where <CRLead.noteID.IsEqual <P.AsGuid> >
                            .View.Select(Base, row.LeadID).RowCast <CRLead>().FirstOrDefault();

                // UsrEndCust
                row.GetExtension <CROpportunityExt>().UsrEndCust =
                    string.IsNullOrEmpty(row.GetExtension <CROpportunityExt>().UsrEndCust)
                        ? leads.GetExtension <CRLeadExt>().UsrEndCust
                        : row.GetExtension <CROpportunityExt>().UsrEndCust;
                // UsrSource
                row.GetExtension <CROpportunityExt>().UsrSource =
                    string.IsNullOrEmpty(row.GetExtension <CROpportunityExt>().UsrSource)
                        ? leads.GetExtension <CRLeadExt>().UsrSource
                        : row.GetExtension <CROpportunityExt>().UsrSource;
                // UsrSalesPerson
                row.GetExtension <CROpportunityExt>().UsrSalesPerson =
                    row.GetExtension <CROpportunityExt>().UsrSalesPerson == null
                        ? leads.GetExtension <CRLeadExt>().UsrSalesPerson
                        : row.GetExtension <CROpportunityExt>().UsrSalesPerson;
            }
        }
Ejemplo n.º 2
0
        protected virtual void _(Events.RowInserting <SOInvoice> e)
        {
            SOInvoice row = null;

            row = e.Row;
            e.Cache.SetValue <SOInvoice.refNbr>(row, "<NEW>");               // OK
            e.Cache.SetValue <SOInvoice.refNbr>(Documents.Current, "<NEW>"); // not OK
        }
Ejemplo n.º 3
0
        protected virtual void _(Events.RowInserting <ComplianceAttribute> args)
        {
            var attribute = args.Row;

            if (attribute != null && Filter.Current != null)
            {
                attribute.Type = Filter.Current.Type;
            }
        }
Ejemplo n.º 4
0
        protected virtual void _(Events.RowInserting <SOInvoice> e)
        {
            if (!(e.Row is SOInvoice invoice))
            {
                return;
            }

            invoice.RefNbr = "<NEW>";             // should be OK
        }
Ejemplo n.º 5
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var project            = Base.Project.Current;
            var complianceDocument = args.Row;

            if (project != null && complianceDocument != null)
            {
                FillProjectInfo(complianceDocument, project);
            }
        }
Ejemplo n.º 6
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var changeOrder        = Base.Document.Current;
            var complianceDocument = args.Row;

            if (changeOrder != null && complianceDocument != null)
            {
                FillChangeOrderInfo(complianceDocument, changeOrder);
            }
        }
        protected virtual void _(Events.RowInserting <PMTask> args)
        {
            var task = args.Row;

            if (task == null)
            {
                return;
            }
            task.Type = ProjectTaskType.CostRevenue;
        }
Ejemplo n.º 8
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var poOrder            = Base.Document.Current;
            var complianceDocument = args.Row;

            if (poOrder != null && complianceDocument != null)
            {
                var poLine = Base.Transactions.SelectSingle();
                FillPurchaseOrderInfo(complianceDocument, poOrder, poLine);
            }
        }
Ejemplo n.º 9
0
        protected virtual void _(Events.RowInserting <FSVehicle> e)
        {
            if (e.Row == null || EPEquipmentRecords.Current == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            fsVehicleRow.RefNbr = EPEquipmentRecords.Current.EquipmentCD;
        }
Ejemplo n.º 10
0
        protected virtual void _(Events.RowInserting <MatrixInventoryItem> eventArgs)
        {
            if (eventArgs.Row == null)
            {
                return;
            }

            eventArgs.Row.AttributeIDs         = (string[])AdditionalAttributes.Current.AttributeIdentifiers.Clone();
            eventArgs.Row.AttributeValueDescrs = new string[eventArgs.Row.AttributeIDs.Length];
            eventArgs.Row.AttributeValues      = new string[eventArgs.Row.AttributeIDs.Length];
        }
Ejemplo n.º 11
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var currentBill = Base.Document.Current;
            var compliance  = args.Row;

            if (currentBill != null && compliance != null)
            {
                var transaction = Base.Transactions.Select().FirstTableItems.OrderBy(x => x.LineNbr).FirstOrDefault();
                FillInvoiceInfo(compliance, currentBill, transaction);
            }
        }
Ejemplo n.º 12
0
        protected virtual void _(Events.RowInserting <FSCustomerBillingSetup> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSCustomerBillingSetup fsCustomerBillingSetupRow = (FSCustomerBillingSetup)e.Row;

            CheckDuplicatedEntry(e.Cache, fsCustomerBillingSetupRow);
        }
Ejemplo n.º 13
0
 protected virtual void _(Events.RowInserting <Document> e)
 {
     if (e.Row.CuryInfoID == null)
     {
         CurrencyInfo info = new CurrencyInfo();
         info = currencyinfo.Insert(info);
         currencyinfo.Cache.IsDirty = false;
         if (info != null)
         {
             e.Cache.SetValue <Document.curyInfoID>(e.Row, info.CuryInfoID);
             e.Cache.SetValue <Document.curyID>(e.Row, info.CuryID);
         }
     }
 }
Ejemplo n.º 14
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var currentProjectTransaction = Base.Document.Current;

            if (currentProjectTransaction != null)
            {
                var complianceDocument = args.Row;
                if (complianceDocument != null)
                {
                    complianceDocument.ProjectTransactionID =
                        CreateComplianceDocumentReference(currentProjectTransaction).ComplianceDocumentReferenceId;
                }
            }
        }
Ejemplo n.º 15
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var task = Base.Task.Current;

            if (task == null)
            {
                return;
            }
            var complianceDocument = args.Row;

            if (complianceDocument == null)
            {
                return;
            }
            FillProjectTaskInfo(complianceDocument, task);
        }
Ejemplo n.º 16
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var currentInvoice = Base.Document.Current;

            if (currentInvoice != null)
            {
                var compliance = args.Row;
                if (compliance != null)
                {
                    compliance.CustomerID    = currentInvoice.CustomerID;
                    compliance.CustomerName  = GetCustomerName(compliance.CustomerID);
                    compliance.InvoiceID     = CreateComplianceDocumentReference(currentInvoice).ComplianceDocumentReferenceId;
                    compliance.InvoiceAmount = currentInvoice.OrigDocAmt;
                    compliance.AccountID     = GetAccountId();
                }
            }
        }
Ejemplo n.º 17
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var vendor = Base.BAccount.Current;

            if (vendor == null)
            {
                return;
            }
            var complianceDocument = args.Row;

            if (complianceDocument == null)
            {
                return;
            }
            complianceDocument.VendorID   = vendor.BAccountID;
            complianceDocument.VendorName = vendor.AcctName;
        }
Ejemplo n.º 18
0
        protected virtual void _(Events.RowInserting <JointPayee> args)
        {
            var jointPayee = args.Row;

            if (jointPayee == null)
            {
                return;
            }
            if (Base.IsCopyPasteContext && !JointPayees.AllowInsert)
            {
                args.Cancel = true;
                return;
            }
            InitializeValidationService(Base.Document.Current?.PaymentsByLinesAllowed == true);
            jointPayee.BillId          = Base.Document.Current?.NoteID;
            jointPayee.JointAmountPaid = 0m;
            jointAmountOwedValidationService.RecalculateTotalJointAmount();
        }
Ejemplo n.º 19
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var customer = Base.BAccount.Current;

            if (customer == null)
            {
                return;
            }
            var complianceDocument = args.Row;

            if (complianceDocument == null)
            {
                return;
            }
            complianceDocument.CustomerID   = customer.BAccountID;
            complianceDocument.CustomerName = customer.AcctName;
            complianceDocument.AccountID    = Base.CustomerClass.Current?.ARAcctID;
        }
Ejemplo n.º 20
0
        protected virtual void _(Events.RowInserting <ComplianceDocument> args)
        {
            var currentApPayment = Base.Document.Current;

            if (currentApPayment != null)
            {
                var complianceDocument = args.Row;
                if (complianceDocument != null)
                {
                    complianceDocument.VendorID   = currentApPayment.VendorID;
                    complianceDocument.VendorName = GetVendorName(complianceDocument.VendorID);
                    ComplianceDocumentRefNoteAttribute.SetComplianceDocumentReference <ComplianceDocument.apCheckId>(
                        args.Cache, args.Row, currentApPayment.DocType, currentApPayment.RefNbr, currentApPayment.NoteID);
                    complianceDocument.CheckNumber       = currentApPayment.ExtRefNbr;
                    complianceDocument.ApPaymentMethodID = currentApPayment.PaymentMethodID;
                }
            }
        }
Ejemplo n.º 21
0
        protected void _(Events.RowInserting <ARInvoice> e)
        {
            if (activateGUI && e.Row.DocType.Equals(ARDocType.CreditMemo))
            {
                ARRegisterExt registerExt = PXCache <ARRegister> .GetExtension <ARRegisterExt>(e.Row);

                switch (registerExt.UsrVATOutCode)
                {
                case TWGUIFormatCode.vATOutCode31:
                case TWGUIFormatCode.vATOutCode35:
                    registerExt.UsrVATOutCode = TWGUIFormatCode.vATOutCode33;
                    break;

                case TWGUIFormatCode.vATOutCode32:
                    registerExt.UsrVATOutCode = TWGUIFormatCode.vATOutCode34;
                    break;
                }
            }
        }
        protected virtual void _(Events.RowInserting <FSCustomFieldAppointment> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSCustomFieldAppointment fsCustomFieldAppointmentRow = (FSCustomFieldAppointment)e.Row;

            int maxSequence = 0;

            PXResultset <FSCustomFieldAppointment> bqlResultSet = CustomFieldAppointmentRecords.Select();

            if (bqlResultSet != null && bqlResultSet.Count > 0)
            {
                maxSequence = (int)(((FSCustomFieldAppointment)bqlResultSet[bqlResultSet.Count - 1]).Position + 1);
            }

            fsCustomFieldAppointmentRow.Position = maxSequence;
        }
Ejemplo n.º 23
0
        protected void _(Events.RowInserting <APInvoice> e)
        {
            if (e.Row == null || Base.vendor.Current == null || activateGUI.Equals(false))
            {
                return;
            }

            APRegisterExt regisExt = PXCache <APRegister> .GetExtension <APRegisterExt>(e.Row);

            string vATIncode = regisExt.UsrVATInCode ?? string.Empty;

            if (string.IsNullOrEmpty(vATIncode))
            {
                CSAnswers cSAnswers = SelectCSAnswers(Base, Base.vendor.Current.NoteID);

                vATIncode = (e.Row.IsRetainageDocument == true || cSAnswers == null) ? null : cSAnswers.Value;
            }

            regisExt.UsrVATInCode = e.Row.DocType.Equals(APDocType.DebitAdj, System.StringComparison.CurrentCulture) &&
                                    !string.IsNullOrEmpty(vATIncode) ? TWGUIFormatCode.vATInCode23 /*(int.Parse(vATIncode) + 2).ToString()*/ : vATIncode;
        }
Ejemplo n.º 24
0
        protected virtual void _(Events.RowInserting <FSModelTemplateComponent> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSModelTemplateComponent fsModelTemplateComponentRow      = (FSModelTemplateComponent)e.Row;
            FSModelTemplateComponent fsModelTemplateComponentRow_InDB = PXSelect <FSModelTemplateComponent,
                                                                                  Where <
                                                                                      FSModelTemplateComponent.componentCD, Equal <Required <FSModelTemplateComponent.componentCD> >,
                                                                                      And <
                                                                                          FSModelTemplateComponent.modelTemplateID, Equal <Current <FSModelTemplateComponent.modelTemplateID> > > > >
                                                                        .SelectWindowed(Base, 0, 1, fsModelTemplateComponentRow.ComponentCD);

            if (fsModelTemplateComponentRow_InDB != null)
            {
                e.Cache.RaiseExceptionHandling <FSModelTemplateComponent.componentCD>
                    (e.Row, fsModelTemplateComponentRow.ComponentCD, new PXException(TX.Error.ID_ALREADY_USED));
            }
        }
        protected virtual void _(Events.RowInserting <FSModelComponent> e)
        {
            if (e.Row == null || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false)
            {
                return;
            }

            FSModelComponent fsModelComponentRow = (FSModelComponent)e.Row;

            FSModelComponent fsModelComponentRow_InDB = PXSelect <FSModelComponent,
                                                                  Where <
                                                                      FSModelComponent.componentID, Equal <Required <FSModelComponent.componentID> >,
                                                                      And <
                                                                          FSModelComponent.modelID, Equal <Current <InventoryItem.inventoryID> > > > >
                                                        .SelectWindowed(Base, 0, 1, fsModelComponentRow.ComponentID);

            if (fsModelComponentRow_InDB != null)
            {
                e.Cache.RaiseExceptionHandling <FSModelComponent.componentID>
                    (e.Row, fsModelComponentRow.ComponentID, new PXException(TX.Error.ID_ALREADY_USED));
            }
        }
Ejemplo n.º 26
0
        protected virtual void _(Events.RowInserting <FSGeoZoneEmp> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSGeoZoneEmp fsGeoZoneEmpRow = (FSGeoZoneEmp)e.Row;
            FSGeoZoneEmp field           = PXSelect <FSGeoZoneEmp,
                                                     Where <
                                                         FSGeoZoneEmp.geoZoneID, Equal <Required <FSGeoZoneEmp.geoZoneID> >,
                                                         And <
                                                             FSGeoZoneEmp.employeeID, Equal <Current <EPEmployee.bAccountID> > > > >
                                           .SelectWindowed(Base, 0, 1, fsGeoZoneEmpRow.GeoZoneID);

            if (field != null)
            {
                e.Cache.RaiseExceptionHandling <FSGeoZoneEmp.geoZoneID>
                    (e.Row, fsGeoZoneEmpRow.GeoZoneID, new PXException(TX.Error.ID_ALREADY_USED));
                e.Cancel = true;
            }
        }
Ejemplo n.º 27
0
        protected virtual void _(Events.RowInserting <FSSrvOrdTypeProblem> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSSrvOrdTypeProblem fsSrvOrdTypeProblemRow = (FSSrvOrdTypeProblem)e.Row;
            int?problemID = fsSrvOrdTypeProblemRow.ProblemID;

            FSSrvOrdTypeProblem fsSrvOrdTypeProblemRow_InDB = PXSelect <FSSrvOrdTypeProblem,
                                                                        Where <
                                                                            FSSrvOrdTypeProblem.problemID, Equal <Required <FSSrvOrdTypeProblem.problemID> >,
                                                                            And <
                                                                                FSSrvOrdTypeProblem.srvOrdType, Equal <Current <FSSrvOrdType.srvOrdType> > > > >
                                                              .SelectWindowed(this, 0, 1, problemID);

            if (fsSrvOrdTypeProblemRow_InDB != null)
            {
                e.Cache.RaiseExceptionHandling <FSSrvOrdTypeProblem.problemID>(fsSrvOrdTypeProblemRow, problemID, new PXSetPropertyException(TX.Error.ID_ALREADY_USED, PXErrorLevel.RowError));
                e.Cancel = true;
            }
        }
Ejemplo n.º 28
0
        protected virtual void _(Events.RowInserting <FSWFStage> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSWFStage fsWFStageRow = e.Row as FSWFStage;

            if (fsWFStageRow != null && Filter.Current != null)
            {
                IEnumerable list = items(NodeFilter.Current.ParentWFStageID);

                int maxSequence = 0;
                foreach (PXResult <FSWFStage> bqlResult in list)
                {
                    FSWFStage fsWFStageRow_Item = (FSWFStage)bqlResult;

                    if (fsWFStageRow_Item.SortOrder.Value > maxSequence)
                    {
                        maxSequence = fsWFStageRow_Item.SortOrder.Value;
                    }
                }

                fsWFStageRow.SortOrder       = maxSequence + 1;
                fsWFStageRow.ParentWFStageID = NodeFilter.Current.ParentWFStageID;
                fsWFStageRow.WFStageCD       = fsWFStageRow.WFStageCD.Trim();
                fsWFStageRow.WFID            = Filter.Current.WFID;

                string strErrMess = ValidateItemName(fsWFStageRow.WFStageCD, fsWFStageRow.ParentWFStageID);
                if (strErrMess != string.Empty)
                {
                    e.Cache.RaiseExceptionHandling <FSWFStage.wFStageCD>(e.Row, fsWFStageRow.WFStageCD, new PXSetPropertyException(strErrMess, PXErrorLevel.Error));
                    e.Cancel = true;
                }
            }
        }
Ejemplo n.º 29
0
 protected virtual void _(Events.RowInserting <FSServiceTemplate> e)
 {
 }
Ejemplo n.º 30
0
 protected virtual void _(Events.RowInserting <EPTimeCard> e)
 {
 }