Example #1
0
        protected virtual IEnumerable filteredItems([PXString] string action)
        {
            // MailRecipients.View.RequestRefresh();

            if (!String.Equals(Operations.Current.Action, action, StringComparison.OrdinalIgnoreCase))
            {
                FilteredItems.Cache.Clear();
            }
            Operations.Current.Action = action;

            var mailListID = MailLists.Current.With(ml => ml.MarketingListID);

            //Dinamic)
            if (MailLists.Current.With(ml => ml.IsDynamic == true))
            {
                return(CRSubscriptionsSelect.Select(this, mailListID));
            }

            using (ReadOnlyScope s = new ReadOnlyScope(this.Caches <CRMarketingList>()))
            {
                CRSubscriptionsSelect.MergeFilters(this, mailListID);
            }

            //Remove
            if (string.Equals(Operations.Current.Action, REMOVE_ACTION, StringComparison.OrdinalIgnoreCase))
            {
                return(this.QuickSelect(RemoveItems.View.BqlSelect, PXView.Filters));
            }

            return(this.QuickSelect(FilteredItems.View.BqlSelect, PXView.Filters));
        }
        protected virtual IEnumerable filteredItems([PXString] string action)
        {
            // MailRecipients.View.RequestRefresh();

            if (!String.Equals(Operations.Current.Action, action, StringComparison.OrdinalIgnoreCase))
            {
                FilteredItems.Cache.Clear();
            }
            Operations.Current.Action = action;

            var mailListID = MailLists.Current.With(ml => ml.MarketingListID);

            //Dinamic)
            if (MailLists.Current.With(ml => ml.IsDynamic == true))
            {
                return(CRSubscriptionsSelect.Select(this, mailListID));
            }

            using (ReadOnlyScope s = new ReadOnlyScope(this.Caches <CRMarketingList>()))
            {
                CRSubscriptionsSelect.MergeFilters(this, mailListID);
            }

            //Remove
            if (string.Equals(Operations.Current.Action, REMOVE_ACTION, StringComparison.OrdinalIgnoreCase))
            {
                return(this.QuickSelect(RemoveItems.View.BqlSelect, PXView.Filters));
            }

            //Add
            var command = FilteredItems.View.BqlSelect;

            if (MailLists.Current.With(ml => ml.NoCall == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noCall, IsNull,
                                  Or <Contact.noCall, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoEMail == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noEMail, IsNull,
                                  Or <Contact.noEMail, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoFax == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noFax, IsNull,
                                  Or <Contact.noFax, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoMail == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noMail, IsNull,
                                  Or <Contact.noMail, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoMarketing == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noMarketing, IsNull,
                                  Or <Contact.noMarketing, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoMassMail == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noMassMail, IsNull,
                                  Or <Contact.noMassMail, NotEqual <True> > >));
            }

            return(this.QuickSelect(command, PXView.Filters));
        }
        protected virtual IEnumerable filteredItems([PXString] string action)
        {
            if (!String.Equals(Operations.Current.Action, action, StringComparison.OrdinalIgnoreCase))
            {
                FilteredItems.Cache.Clear();
            }
            Operations.Current.Action = action;

            var mailListID = MailLists.Current.With(ml => ml.MarketingListID);

            //Dinamic)
            if (MailLists.Current.With(ml => ml.IsDynamic == true))
            {
                return(CRSubscriptionsSelect.Select(this, mailListID));
            }

            CRSubscriptionsSelect.MergeFilters(this, mailListID);

            if (_ProcessPending)
            {
                _ProcessPending = false;
                Contact saved = FilteredItems.Current;
                var     list  = new List <Contact>();
                int     start = 0;
                int     total = 0;
                foreach (PXResult <Contact> item in FilteredItems.View.Select(null, new object[] { action }, null, null, null, PXView.Filters, ref start, 0, ref total))
                {
                    ((Contact)item).Selected = true;
                    FilteredItems.Update(item);
                    list.Add(((Contact)item));
                }
                FilteredItems.Current       = saved;
                FilteredItems.Cache.IsDirty = false;
                PerformAction(list);
                PXRedirectHelper.TryRedirect(this, PXRedirectHelper.WindowMode.Same);
            }

            //Remove
            if (string.Equals(Operations.Current.Action, REMOVE_ACTION, StringComparison.OrdinalIgnoreCase))
            {
                return(this.QuickSelect(RemoveItems.View.BqlSelect, PXView.Filters));
            }

            //Add
            var command = FilteredItems.View.BqlSelect;

            if (MailLists.Current.With(ml => ml.NoCall == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noCall, IsNull,
                                  Or <Contact.noCall, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoEMail == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noEMail, IsNull,
                                  Or <Contact.noEMail, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoFax == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noFax, IsNull,
                                  Or <Contact.noFax, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoMail == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noMail, IsNull,
                                  Or <Contact.noMail, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoMarketing == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noMarketing, IsNull,
                                  Or <Contact.noMarketing, NotEqual <True> > >));
            }
            if (MailLists.Current.With(ml => ml.NoMassMail == true))
            {
                command = command.WhereAnd(
                    typeof(Where <Contact.noMassMail, IsNull,
                                  Or <Contact.noMassMail, NotEqual <True> > >));
            }

            return(this.QuickSelect(command, PXView.Filters));
        }
Example #4
0
 protected virtual IEnumerable dynamicSourceList([PXInt] int mailListID)
 {
     return(CRSubscriptionsSelect.Select(this, mailListID));
 }