コード例 #1
0
        protected static void UpdatePrices(ContractMaint graph, ContractDetail item)
        {
            Contract contract = PXSelect <Contract, Where <Contract.contractID, Equal <Required <Contract.contractID> > > > .Select(graph, item.ContractID);

            using (PXTransactionScope ts = new PXTransactionScope())
            {
                if (CTPRType.IsTemplate(contract.BaseType) != true)
                {
                    ContractMaintExt contractMaintExt = CreateInstance <ContractMaintExt>();
                    contractMaintExt.Contracts.Current = contract;
                    if (contract.IsActive == true &&
                        contract.IsPendingUpdate != true &&
                        contract.Status != Contract.status.PendingActivation)
                    {
                        CTBillEngine engine = CreateInstance <CTBillEngine>();
                        engine.Upgrade(contract.ContractID);
                        engine.Clear();
                        contractMaintExt.Contracts.Current = PXSelect <Contract, Where <Contract.contractID, Equal <Required <Contract.contractID> > > > .Select(engine, item.ContractID);

                        item = PXSelect <ContractDetail,
                                         Where <ContractDetail.contractID, Equal <Required <ContractDetail.contractID> >,
                                                And <ContractDetail.lineNbr, Equal <Required <ContractDetail.lineNbr> > > > > .Select(engine, item.ContractID, item.LineNbr);
                    }
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.basePriceOption>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.basePrice>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.renewalPriceOption>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.renewalPrice>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.fixedRecurringPriceOption>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.fixedRecurringPrice>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.usagePriceOption>(item);
                    contractMaintExt.ContractDetails.Cache.SetDefaultExt <ContractDetail.usagePrice>(item);
                    contractMaintExt.ContractDetails.Update(item);

                    contractMaintExt.Actions.PressSave();
                }
                else
                {
                    TemplateMaint templateMaint = CreateInstance <TemplateMaint>();
                    templateMaint.Templates.Current = PXSelect <ContractTemplate, Where <ContractTemplate.contractID, Equal <Required <ContractTemplate.contractID> > > > .Select(graph, item.ContractID);

                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.basePriceOption>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.basePrice>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.renewalPriceOption>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.renewalPrice>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.fixedRecurringPriceOption>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.fixedRecurringPrice>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.usagePriceOption>(item);
                    templateMaint.ContractDetails.Cache.SetDefaultExt <ContractDetail.usagePrice>(item);
                    templateMaint.ContractDetails.Update(item);
                    templateMaint.Actions.PressSave();
                }
                ts.Complete();
            }
        }
コード例 #2
0
        public virtual IEnumerable viewContract(PXAdapter adapter)
        {
            ContractDetail contractDetail = Items.Current;

            if (contractDetail != null)
            {
                PXGraph graph   = null;
                string  message = null;

                Contract contract = ContractMaint.FindContract(this, contractDetail.ContractID);

                if (CTPRType.IsTemplate(contract.BaseType) == true)
                {
                    TemplateMaint templateMaint = PXGraph.CreateInstance <TemplateMaint>();
                    templateMaint.Templates.Current = templateMaint.Templates.Search <ContractTemplate.contractID>(contractDetail.ContractID);

                    graph   = templateMaint;
                    message = CT.Messages.ViewContractTemplate;
                }
                else
                {
                    ContractMaint contractMaint = PXGraph.CreateInstance <ContractMaint>();
                    contractMaint.Contracts.Current = contract;

                    graph   = contractMaint;
                    message = CT.Messages.ViewContract;
                }

                throw new PXRedirectRequiredException(graph, true, message)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }

            return(Filter.Select());
        }