private PXFieldState GetPXFieldState(Type cachetype, string fieldName)
        {
            PXCache cache = this.Caches[cachetype];

            PXDBAttributeAttribute.Activate(cache);
            return(cache.GetStateExt(null, fieldName) as PXFieldState);
        }
Exemplo n.º 2
0
        public LeadEnq()
        {
            PXDBAttributeAttribute.Activate(FilteredItems.Cache);
            PXDBAttributeAttribute.Activate(BaseAccounts.Cache);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(BAccountParent)]);

            FilteredItems.NewRecordTarget = typeof(LeadMaint);


            var bAccountCache = Caches[typeof(BAccount)];

            bAccountCache.DisplayName = Messages.Customer;
            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(bAccountCache, Messages.BAccountCD);
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(bAccountCache, Messages.BAccountName);

            var parentBAccountCache = Caches[typeof(BAccountParent)];

            parentBAccountCache.DisplayName = Messages.ParentAccount;
            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctCD>(parentBAccountCache, Messages.ParentAccountID);
            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctName>(parentBAccountCache, Messages.ParentAccountName);

            var stateCache = Caches[typeof(State)];

            PXUIFieldAttribute.SetDisplayName <State.name>(stateCache, Messages.State);
        }
Exemplo n.º 3
0
        protected virtual void EPRuleEmployeeCondition_FieldName_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            EPRuleEmployeeCondition row = e.Row as EPRuleEmployeeCondition;

            if (row == null)
            {
                return;
            }

            Type cachetype = GraphHelper.GetType(row.Entity);

            if (cachetype == null)
            {
                return;
            }

            PXCache cache = this.Caches[cachetype];

            PXDBAttributeAttribute.Activate(cache);
            PXFieldState state = cache.GetStateExt(null, e.NewValue.ToString()) as PXFieldState;

            if (state == null)
            {
                throw new PXException(Messages.FieldCannotBeFound);
            }
        }
 public FSAttributeList(PXGraph graph) : base(graph)
 {
     PXDBAttributeAttribute.Activate(_Graph.Caches[typeof(BEntity)]);
     _Graph.RowPersisting.AddHandler <BEntity>(ReferenceRowPersistingHandler);
     _Graph.RowUpdating.AddHandler <BEntity>(ReferenceRowUpdatingHandler);
     _Graph.RowDeleted.AddHandler <BEntity>(ReferenceRowDeletedHandler);
     _Graph.RowInserted.AddHandler <BEntity>(RowInsertedHandler);
 }
Exemplo n.º 5
0
        public CampaignMaint()
        {
            PXUIFieldAttribute.SetEnabled <CRCampaign.leadsGenerated>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.leadsConverted>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.contacts>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.responses>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.opportunities>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.closedOpportunities>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.opportunitiesValue>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.closedOpportunitiesValue>(CampaignCurrent.Cache, null, false);

            PXUIFieldAttribute.SetRequired <CRCampaign.startDate>(CampaignCurrent.Cache, true);
            PXUIFieldAttribute.SetRequired <CRCampaign.status>(CampaignCurrent.Cache, true);

            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.bAccountID>(CampaignMembers.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.salutation>(CampaignMembers.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.eMail>(CampaignMembers.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.phone1>(CampaignMembers.Cache, null, false);

            //PXUIFieldAttribute.SetVisible<SelCampaignMembers.title>(CampaignMembers.Cache, null, false);

            var cache = Caches[typeof(Contact)];

            PXDBAttributeAttribute.Activate(cache);
            PXUIFieldAttribute.SetVisible <Contact.title>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.workgroupID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.ownerID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.firstName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.midName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.phone2>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.phone3>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.fax>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.webSite>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.isActive>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.dateOfBirth>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.createdByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.createdDateTime>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastModifiedByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastModifiedDateTime>(cache, null, false);

            PXUIFieldAttribute.SetVisible <Address.addressLine1>(Caches[typeof(Address)], null, false);
            PXUIFieldAttribute.SetVisible <Address.addressLine2>(Caches[typeof(Address)], null, false);

            PXUIFieldAttribute.SetVisible <Contact.classID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.source>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.fullName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.status>(cache, null, false);

            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(Caches[typeof(BAccount)], "Customer Name");
            PXUIFieldAttribute.SetDisplayName <Contact.bAccountID>(cache, PXLocalizer.Localize(Messages.ContactBAccountID, typeof(Messages).ToString()));
            PXUIFieldAttribute.SetDisplayName <Contact.status>(cache, PXLocalizer.Localize(Messages.ContactStatus, typeof(Messages).ToString()));
        }
Exemplo n.º 6
0
        public virtual void _(Events.FieldSelecting <PopupAttributes, PopupAttributes.value> e)
        {
            var row = e.Row as PopupAttributes;

            if (row == null || !typeof(TTarget).FullName.Equals(row.CacheName))
            {
                return;
            }

            PXDBAttributeAttribute.Activate(Base.Caches[typeof(TTarget)]);

            e.ReturnState = PXMassProcessHelper.InitValueFieldState(Base.Caches[typeof(TTarget)], e.Row as FieldValue);
            e.Cancel      = true;
        }
Exemplo n.º 7
0
        public CRMassMailMaint()
        {
            if (string.IsNullOrEmpty(Setup.Current.MassMailNumberingID))
            {
                throw new PXSetPropertyException(Messages.NumberingIDIsNull, Messages.CRSetup);
            }


            PXUIFieldAttribute.SetEnabled(Campaigns.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.selected>(Campaigns.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <CRCampaign.sendFilter>(Campaigns.Cache, null, true);
            PXUIFieldAttribute.SetDisplayName <Contact.fullName>(Leads.Cache, Messages.CompanyName);
            PXUIFieldAttribute.SetDisplayName <BAccount.classID>(Caches[typeof(BAccount)], Messages.CompanyClass);
            PXDBAttributeAttribute.Activate(BaseContacts.Cache);
        }
        public CampaignMemberMassProcess()
        {
            Items.SetParametersDelegate(delegate(List <Contact> list)
            {
                bool result = AskProcess(list);
                Unload();
                CampaignMemberMassProcess process;
                using (new PXPreserveScope())
                    process = PXGraph.CreateInstance <CampaignMemberMassProcess>();

                Items.SetProcessDelegate(process.Process);
                return(result);
            });


            PXDBAttributeAttribute.Activate(Items.Cache);
            PXUIFieldAttribute.SetVisible(Items.Cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.fullName>(Items.Cache, null);
            PXUIFieldAttribute.SetVisible <Contact.salutation>(Items.Cache, null);
            PXUIFieldAttribute.SetVisible <Contact.displayName>(Items.Cache, null);
            PXUIFieldAttribute.SetVisible <Contact.bAccountID>(Items.Cache, null);
            PXUIFieldAttribute.SetVisible <Contact.eMail>(Items.Cache, null);
            PXUIFieldAttribute.SetVisible <Contact.phone1>(Items.Cache, null);
            PXUIFieldAttribute.SetVisible <Contact.status>(Items.Cache, null);
            PXUIFieldAttribute.SetRequired <Contact.displayName>(Items.Cache, false);

            var bAccountCache = Caches[typeof(BAccount)];

            bAccountCache.DisplayName = Messages.Customer;
            PXDBAttributeAttribute.Activate(bAccountCache);
            PXUIFieldAttribute.SetVisible(bAccountCache, null, false);
            PXUIFieldAttribute.SetVisible <BAccount.acctCD>(bAccountCache, null, false);
            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(bAccountCache, Messages.BAccountCD);
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(bAccountCache, Messages.BAccountName);

            var parentBAccountCache = Caches[typeof(BAccountParent)];

            parentBAccountCache.DisplayName = Messages.ParentAccount;
            PXUIFieldAttribute.SetVisible(parentBAccountCache, null, false);
            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctCD>(parentBAccountCache, Messages.ParentAccountID);
            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctName>(parentBAccountCache, Messages.ParentAccountName);

            PXUIFieldAttribute.SetVisible(Caches[typeof(Address)], null, false);

            PXUIFieldAttribute.SetDisplayName <CRCampaignMembers.status>(Caches[typeof(CRCampaignMembers)], Messages.CampaignStatus);

            Actions["Schedule"].SetVisible(false);
        }
        public CRMarketingListMaint()
        {
            var contactCache = Caches[typeof(Contact)];

            PXUIFieldAttribute.SetDisplayName <Contact.fullName>(contactCache, PXLocalizer.Localize(Messages.ContactFullName, typeof(Messages).ToString()));
            PXDBAttributeAttribute.Activate(FilteredItems.Cache);

            var parentBAccountCache = Caches[typeof(BAccount)];

            parentBAccountCache.DisplayName = Messages.ParentAccount;
            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(parentBAccountCache, PXLocalizer.Localize(Messages.BAccountAcctCD, typeof(Messages).ToString()));
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(parentBAccountCache, Messages.ParentAccountNameShort);
            PXDBAttributeAttribute.Activate(parentBAccountCache);

            PXUIFieldAttribute.SetVisible <CRMarketingListMember.marketingListID>(MailRecipients.Cache, null, false);
        }
Exemplo n.º 10
0
 public PXGraph this[Type graphType]
 {
     get
     {
         PXGraph graph = null;
         if (graphType != null && !Graphs.TryGetValue(graphType, out graph))
         {
             graph = PXGraph.CreateInstance(graphType);
             PXDBAttributeAttribute.Activate(graph.Views[graph.PrimaryView].Cache);
             Graphs[graphType] = graph;
         }
         if (graph != null)
         {
             graph.Clear();
         }
         return(graph);
     }
 }
Exemplo n.º 11
0
        public OpportunityEnq()
        {
            FilteredItems.NewRecordTarget = typeof(OpportunityMaint);

            PXDBAttributeAttribute.Activate(FilteredItems.Cache);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(BAccount)]);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(BAccountParent)]);

            var bAccountCache = Caches[typeof(BAccount)];

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(bAccountCache, Messages.BAccountCD);
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(bAccountCache, Messages.BAccountName);

            var parentBAccountCache = Caches[typeof(BAccountParent)];

            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctCD>(parentBAccountCache, Messages.ParentAccount);
            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctName>(parentBAccountCache, Messages.ParentAccountName);
        }
        public CRMarketingListMaint()
        {
            var contactCache = Caches[typeof(Contact)];

            PXUIFieldAttribute.SetDisplayName <Contact.fullName>(contactCache, Messages.ContactFullName);
            PXDBAttributeAttribute.Activate(FilteredItems.Cache);

            var parentBAccountCache = Caches[typeof(BAccount)];

            parentBAccountCache.DisplayName = Messages.ParentAccount;
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(parentBAccountCache, Messages.ParentAccountNameShort);
            PXDBAttributeAttribute.Activate(parentBAccountCache);

            PXUIFieldAttribute.SetVisible <CRMarketingListMember.marketingListID>(MailRecipients.Cache, null, false);
            PXUIFieldAttribute.SetVisibility <Contact.fullName>(this.Caches[typeof(Contact)], null, PXUIVisibility.Visible);
            PXUIFieldAttribute.SetEnabled(this.Caches[typeof(Contact)], null, null, false);
            PXUIFieldAttribute.SetEnabled <Contact.selected>(this.Caches[typeof(Contact)], null, true);
        }
Exemplo n.º 13
0
        protected CRBaseMassProcess()
        {
            primaryGraph = new PXPrimaryGraphCollection(this);
            if (ProcessingDataMember == null)
            {
                throw new PXException(Messages.IsNotProcessing, typeof(TGraph).FullName);
            }

            foreach (Type table in ProcessingDataMember.View.BqlSelect.GetTables())
            {
                PXDBAttributeAttribute.Activate(Caches[table]);
            }

            ProcessingDataMember.SetParametersDelegate(delegate
            {
                bool result = AskParameters();
                Unload();
                TGraph process;
                using (new PXPreserveScope())
                {
                    process = CreateInstance <TGraph>();
                    foreach (var key in this.Caches.Keys)
                    {
                        var clonedCache = process.Caches[key];
                    }
                }

                ProcessingDataMember.SetProcessDelegate(item =>
                {
                    PXGraph graph = primaryGraph[item];
                    if (graph == null)
                    {
                        throw new PXException(ErrorMessages.CantDetermineGraphType);
                    }
                    process.ProccessItem(graph, item);
                    graph.Actions.PressSave();
                    PXCache cache = graph.Caches[typeof(TPrimary)];
                    cache.RestoreCopy(item, cache.Current);
                });
                return(result);
            });

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(Caches[typeof(BAccount)], Messages.BAccountCD);
        }
        private void Process(List <object> list, Action <List <object> > prevProcessDelegate)
        {
            if (CurrentAction == ActionName && list != null)
            {
                var selectedObjects = list.Where(l => ((IPXSelectable)l).Selected == true).ToList();
                using (IUnitOfWork unitOfWork = new PXCacheTransaction(CachesForBackup))
                {
                    PXDBAttributeAttribute.Activate(View.Cache);
                    Graph.SelectTimeStamp();
                    PXRedirectRequiredException redirect = null;
                    int processed;
                    try
                    {
                        processed = ProcessAction(selectedObjects);
                    }
                    catch (PXRedirectRequiredException ex)
                    {
                        redirect  = ex;
                        processed = 1;
                    }

                    if (processed > 0)
                    {
                        unitOfWork.Commit();
                    }

                    if (redirect != null)
                    {
                        throw redirect;
                    }

                    View.Cache.Clear();
                    if (processed != selectedObjects.Count)
                    {
                        throw new PXOperationCompletedException(ErrorMessages.SeveralItemsFailed);
                    }
                }
            }
            else if (prevProcessDelegate != null)
            {
                prevProcessDelegate.Invoke(list);
            }
        }
        private static Type CreateResultView(PXGraph graph, List <EPRuleBaseCondition> conditions)
        {
            List <Type> entities   = new List <Type>();
            List <Type> composable = new List <Type>();

            foreach (var condition in conditions)
            {
                Type conditionEntityType = GraphHelper.GetType(condition.Entity);

                if (!entities.Contains(conditionEntityType))
                {
                    entities.Add(conditionEntityType);
                }
            }

            for (int i = 0; i < entities.Count; i++)
            {
                var entity = entities[i];
                PXDBAttributeAttribute.Activate(graph.Caches[entity]);
                if (i == 0)
                {
                    composable.Add(entity);
                }
                else if (i != entities.Count - 1)
                {
                    composable.Add(typeof(LeftJoin <, ,>));
                    composable.Add(entity);
                    composable.Add(typeof(On <True, Equal <True> >));
                }
                else
                {
                    composable.Add(typeof(LeftJoin <,>));
                    composable.Add(entity);
                    composable.Add(typeof(On <True, Equal <True> >));
                }
            }

            composable.Insert(0, composable.Count == 1 ? typeof(Select <>) : typeof(Select2 <,>));

            return(BqlCommand.Compose(composable.ToArray()));
        }
        public CaseEnq()
        {
            PXDBAttributeAttribute.Activate(FilteredItems.Cache);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(BAccount)]);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(BAccountParent)]);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(Contact)]);
            PXDBAttributeAttribute.Activate(this.Caches[typeof(Contract)]);

            FilteredItems.NewRecordTarget = typeof(CRCaseMaint);

            var baccountCache = Caches[typeof(BAccount)];

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(baccountCache, Messages.BAccountCD);
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(baccountCache, Messages.BAccountName);

            var parentBAccountCache = Caches[typeof(BAccountParent)];

            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctCD>(parentBAccountCache, Messages.ParentAccount);
            PXUIFieldAttribute.SetDisplayName <BAccountParent.acctName>(parentBAccountCache, Messages.ParentAccountName);

            var contactCache = Caches[typeof(Contact)];

            PXUIFieldAttribute.SetDisplayName <Contact.displayName>(contactCache, Messages.Contact);

            var contractCache = Caches[typeof(Contract)];

            PXUIFieldAttribute.SetDisplayName <Contract.contractCD>(contractCache, Messages.Contract);
            PXUIFieldAttribute.SetDisplayName <Contract.description>(contractCache, Messages.ContractDescription);

            var caseCache = Caches[typeof(CRCase)];

            PXUIFieldAttribute.SetDisplayName <CRCase.locationID>(caseCache, Messages.LocationID);

            var contractBaccount = Caches[typeof(BAccountContract)];

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(contractBaccount, Messages.Customer);
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(contractBaccount, Messages.CustomerName);
        }
Exemplo n.º 17
0
        private PXFieldState CreateFieldStateForFieldValue(object returnState, string entityType, string cacheName, string fieldName)
        {
            Type type = GraphHelper.GetType(entityType);

            if (type != null)
            {
                Type cachetype = GraphHelper.GetType(cacheName);
                if (cachetype == null)
                {
                    return(null);
                }

                PXCache cache = this.Caches[cachetype];
                PXDBAttributeAttribute.Activate(cache);
                PXFieldState state = cache.GetStateExt(null, fieldName) as PXFieldState;
                if (state != null)
                {
                    if (returnState == null)
                    {
                        object item = cache.CreateInstance();
                        object newValue;
                        cache.RaiseFieldDefaulting(fieldName, item, out newValue);
                        if (newValue != null)
                        {
                            cache.RaiseFieldSelecting(fieldName, item, ref newValue, false);
                        }
                        state.Value = newValue;
                    }
                    else
                    {
                        state.Value = returnState;
                    }
                    state.Enabled = true;
                }
                return(state);
            }
            return(null);
        }
        protected virtual void EPRuleCondition_FieldName_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            EPRuleCondition condition = (EPRuleCondition)e.Row;

            Type type = GraphHelper.GetType(AssigmentMap.Current.EntityType);

            if (type != null)
            {
                Type cachetype = GraphHelper.GetType(condition.Entity);
                if (cachetype == null)
                {
                    return;
                }

                PXCache cache = this.Caches[cachetype];
                PXDBAttributeAttribute.Activate(cache);
                PXFieldState state = cache.GetStateExt(null, e.NewValue.ToString()) as PXFieldState;
                if (state == null)
                {
                    throw new PXException(Messages.FieldCannotBeFound);
                }
            }
        }
Exemplo n.º 19
0
        protected CRBaseMassProcess()
        {
            primaryGraph = new PXPrimaryGraphCollection(this);
            if (ProcessingDataMember == null)
            {
                throw new PXException(string.Format("{0} is not processing graph", typeof(TGraph).FullName));
            }

            Actions["Schedule"].SetVisible(false);
            foreach (Type table in ProcessingDataMember.View.BqlSelect.GetTables())
            {
                PXDBAttributeAttribute.Activate(Caches[table]);
            }

            ProcessingDataMember.SetParametersDelegate(delegate
            {
                bool result = AskParameters();
                Unload();
                TGraph process;
                using (new PXPreserveScope())
                    process = CreateInstance <TGraph>();

                ProcessingDataMember.SetProcessDelegate(item =>
                {
                    PXGraph graph = primaryGraph[item];
                    if (graph == null)
                    {
                        throw new PXException(ErrorMessages.CantDetermineGraphType);
                    }
                    process.ProccessItem(graph, item);
                    graph.Actions.PressSave();
                });
                return(result);
            });

            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(Caches[typeof(BAccount)], Messages.BAccountCD);
        }
Exemplo n.º 20
0
        public override void Initialize()
        {
            base.Initialize();

            PXDBAttributeAttribute.Activate(Base.Caches[typeof(TMain)]);

            Base.EnsureCachePersistence(typeof(CRActivityStatistics));

            BqlCommand bqlCommand = BqlTemplate.OfCommand <
                SelectFrom <
                    CRGrams>
                .InnerJoin <CRDuplicateGrams>
                .On <CRDuplicateGrams.validationType.IsEqual <CRGrams.validationType>
                     .And <CRDuplicateGrams.fieldName.IsEqual <CRGrams.fieldName> >
                     .And <CRDuplicateGrams.fieldValue.IsEqual <CRGrams.fieldValue> >
                     .And <CRDuplicateGrams.entityID.IsNotEqual <CRGrams.entityID> > >
                .InnerJoin <Contact>
                .On <Contact.contactID.IsEqual <CRGrams.entityID> >
                .InnerJoin <DuplicateContact>
                .On <DuplicateContact.contactID.IsEqual <CRDuplicateGrams.entityID> >
                .LeftJoin <BAccountR>
                .On <BAccountR.bAccountID.IsEqual <DuplicateContact.bAccountID> >
                .LeftJoin <Standalone.CRLead>
                .On <Standalone.CRLead.contactID.IsEqual <CRDuplicateGrams.entityID> >
                //.PlaceholderJoin<BqlPlaceholder.J>
                .Where <
                    CRGrams.entityID.IsEqual <DuplicateDocument.contactID.FromCurrent>
                    .And <DuplicateDocument.duplicateFound.FromCurrent.IsEqual <True> >
                    .And <CRGrams.validationType.IsEqual <
                              ValidationTypesAttribute.account
                              .When <Contact.contactType.IsEqual <ContactTypesAttribute.bAccountProperty>
                                     .And <DuplicateContact.contactType.IsEqual <ContactTypesAttribute.bAccountProperty> > >
                              .Else <ValidationTypesAttribute.leadAccount>
                              .When <Contact.contactType.IsEqual <ContactTypesAttribute.bAccountProperty>
                                     .Or <DuplicateContact.contactType.IsEqual <ContactTypesAttribute.bAccountProperty> > >
                              .Else <ValidationTypesAttribute.leadContact> > >
                    .And <DuplicateContact.isActive.IsEqual <True> >
                    .And <
                        Brackets <DuplicateContact.contactType.IsNotEqual <ContactTypesAttribute.bAccountProperty>
                                  .Or <DuplicateContact.contactID.IsEqual <BAccountR.defContactID> > > >
                    .And <
                        Brackets <BqlPlaceholder.W> >
                    >
                .AggregateTo <
                    GroupBy <CRGrams.entityID>,
                    GroupBy <CRGrams.validationType>,
                    GroupBy <CRDuplicateGrams.entityID>,
                    GroupBy <DuplicateContact.contactType>,
                    Sum <CRGrams.score> >
                .Having <
                    CRGrams.score.Summarized.IsGreaterEqual <CRSetup.leadToAccountValidationThreshold.FromCurrent>
                    .And <Contact.contactType.Maximized.IsEqual <ContactTypesAttribute.bAccountProperty> >

                    .Or <CRGrams.score.Summarized.IsGreaterEqual <CRSetup.leadToAccountValidationThreshold.FromCurrent>
                         .And <DuplicateContact.contactType.Maximized.IsEqual <ContactTypesAttribute.bAccountProperty> > >

                    .Or <CRGrams.score.Summarized.IsGreaterEqual <CRSetup.leadValidationThreshold.FromCurrent> >
                    .And <Contact.contactType.Maximized.IsNotEqual <ContactTypesAttribute.bAccountProperty> >
                    .And <DuplicateContact.contactType.Maximized.IsNotEqual <ContactTypesAttribute.bAccountProperty> >

                    .Or <CRGrams.score.Summarized.IsGreaterEqual <CRSetup.accountValidationThreshold.FromCurrent> >
                    .And <Contact.contactType.Maximized.IsEqual <ContactTypesAttribute.bAccountProperty> >
                    .And <DuplicateContact.contactType.Maximized.IsEqual <ContactTypesAttribute.bAccountProperty> >
                    >
                >
                                    //.Replace<BqlPlaceholder.J>(this.AdditionalConditions)
                                    .Replace <BqlPlaceholder.W>(this.AdditionalConditions)
                                    .ToCommand();

            dbView = new PXView(Base, false, bqlCommand);
        }
Exemplo n.º 21
0
        public CampaignMaint()
        {
            PXDBAttributeAttribute.Activate(this.Caches[typeof(Contact)]);
            PXDBAttributeAttribute.Activate(Opportunities.Cache);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.leadsGenerated>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.leadsConverted>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.contacts>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.opportunities>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.closedOpportunities>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.opportunitiesValue>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <DAC.Standalone.CRCampaign.closedOpportunitiesValue>(CampaignCurrent.Cache, null, false);

            PXUIFieldAttribute.SetRequired <CRCampaign.startDate>(CampaignCurrent.Cache, true);
            PXUIFieldAttribute.SetRequired <CRCampaign.status>(CampaignCurrent.Cache, true);


            var cache = Caches[typeof(Contact)];

            PXDBAttributeAttribute.Activate(cache);
            PXUIFieldAttribute.SetVisible <Contact.title>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.workgroupID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.firstName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.midName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.phone2>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.phone3>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.fax>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.webSite>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.dateOfBirth>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.createdByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.createdDateTime>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastModifiedByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastModifiedDateTime>(cache, null, false);

            PXUIFieldAttribute.SetVisible <Address.addressLine1>(Caches[typeof(Address)], null, false);
            PXUIFieldAttribute.SetVisible <Address.addressLine2>(Caches[typeof(Address)], null, false);

            PXUIFieldAttribute.SetVisible <Contact.classID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.source>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.status>(cache, null, false);

            PXUIFieldAttribute.SetVisibility <Contact.contactPriority>(cache, null, PXUIVisibility.Invisible);

            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(Caches[typeof(BAccount)], Messages.CustomerName);
            cache = Caches[typeof(Lead)];
            PXUIFieldAttribute.SetVisible <Lead.title>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.firstName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.midName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.lastName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.phone1>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.phone2>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.phone3>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.fax>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.eMail>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.webSite>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.dateOfBirth>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.createdByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.createdDateTime>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.lastModifiedByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Lead.lastModifiedDateTime>(cache, null, false);
            PXUIFieldAttribute.SetEnabled(this.Caches[typeof(Contact)], null, null, false);
            PXUIFieldAttribute.SetEnabled <Contact.selected>(this.Caches[typeof(Contact)], null, true);
        }
Exemplo n.º 22
0
        private PXFieldState CreateFieldStateForFieldValue(object returnState, string entityType, string cacheName, string fieldName)
        {
            Type type = GraphHelper.GetType(entityType);

            if (type != null)
            {
                Type cachetype = GraphHelper.GetType(cacheName);
                if (cachetype == null)
                {
                    return(null);
                }

                PXCache cache = this.Caches[cachetype];
                PXDBAttributeAttribute.Activate(cache);
                PXFieldState state = cache.GetStateExt(null, fieldName) as PXFieldState;
                if (state != null)
                {
                    state.DescriptionName = null;
                }

                var attr = cache.GetAttributes(null, fieldName);

                if (attr != null)
                {
                    var timeListAttribute = attr.FirstOrDefault(a => a is PXTimeListAttribute) as PXTimeListAttribute;
                    var intAttribute      = attr.FirstOrDefault(a => a is PXIntAttribute) as PXIntAttribute;

                    if (timeListAttribute != null && intAttribute != null)
                    {
                        state = PXTimeState.CreateInstance((PXIntState)state, null, null);
                        state.SelectorMode = PXSelectorMode.Undefined;
                    }
                }

                if (state != null)
                {
                    if (returnState == null)
                    {
                        object item = cache.CreateInstance();
                        object newValue;
                        cache.RaiseFieldDefaulting(fieldName, item, out newValue);
                        if (newValue != null)
                        {
                            cache.RaiseFieldSelecting(fieldName, item, ref newValue, false);
                        }
                        state.Value = newValue;
                    }
                    else
                    {
                        state.Value = returnState;
                    }
                    state.Enabled = true;

                    PXView view;
                    if (state.ViewName != null &&
                        this.Views.TryGetValue(state.ViewName, out view) &&
                        view.BqlSelect.GetTables()[0] == typeof(EPEmployee))
                    {
                        state.ViewName = "Employee";
                    }
                }

                if (attr != null)
                {
                    var intListAttribute = attr.FirstOrDefault(a => a.GetType().IsSubclassOf(typeof(PXIntListAttribute))) as PXIntListAttribute;
                    if (intListAttribute != null)
                    {
                        return(state);
                    }
                }

                state = PXFieldState.CreateInstance((state as PXStringState)?.AllowedValues != null ? state : state.Value, state.DataType, state.PrimaryKey, state.Nullable, state.Required == true ? 1 : state.Required == null ? 0 : -1, state.Precision, state.Length, state.DefaultValue, fieldName,
                                                    state.DescriptionName, state.DisplayName, state.Error, state.ErrorLevel, true, true, false, PXUIVisibility.Visible, state.ViewName, state.FieldList, state.HeaderList);

                return(state);
            }
            return(null);
        }