public virtual IEnumerable appointmentList() { PXView select = new PXView(this, true, AppointmentList.View.BqlSelect); int[] staffResult = StaffMemberFilter.Select() .RowCast <FSAppointmentStaffMember>() .Where(_ => _.Selected == true) .Select(_ => _.BAccountID) .Cast <int>() .ToArray(); Int32 totalrow = 0; Int32 startrow = PXView.StartRow; List <object> result = select.Select(PXView.Currents, new object[] { staffResult }, null, null, null, null, ref startrow, PXView.MaximumRows, ref totalrow); PXView.StartRow = 0; return(result); }
protected virtual IEnumerable scenarios() { foreach (PXResult <WZScenario, SiteMap> result in PXSelectJoinOrderBy <WZScenario, LeftJoin <SiteMap, On <WZScenario.nodeID, Equal <SiteMap.nodeID> > >, OrderBy <Asc <WZScenario.scenarioOrder> > > .Select(this)) { WZScenario scenario = result; SiteMap siteMap = result; if (scenario.NodeID != null && siteMap.NodeID == null) { siteMap.NodeID = scenario.NodeID; WZScenario parentScenario = PXSelect <WZScenario, Where <WZScenario.scenarioID, Equal <Required <WZScenario.scenarioID> > > > .Select(this, scenario.NodeID); if (parentScenario != null) { siteMap.Title = parentScenario.Name; } } yield return(new PXResult <WZScenario, SiteMap>(scenario, siteMap));; } }
private List <Recipient> GetMailsForSending(bool onlyFirst) { var mailKeys = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var mails = new List <Recipient>(); switch (MassMails.Current.Source) { case CRMassMailSourcesAttribute.MailList: foreach (CRMarketingList list in MailLists.Select()) { if (list.Selected == true) { IEnumerable rows; if (list.IsDynamic == true) { rows = DynamicSourceList.Select(list.MarketingListID); } else { rows = PXSelectJoin <Contact, InnerJoin <CRMarketingListMember, On <CRMarketingListMember.contactID, Equal <Contact.contactID> > >, Where2 < Where <Contact.noMassMail, IsNull, Or <Contact.noMassMail, NotEqual <True> > >, And2 < Where <Contact.noEMail, IsNull, Or <Contact.noEMail, NotEqual <True> > >, And <CRMarketingListMember.marketingListID, Equal <Required <CRMarketingListMember.marketingListID> >, And <CRMarketingListMember.activated, Equal <True> > > > > > .Select(this, list.MarketingListID); } foreach (PXResult row in rows) { var contact = row[0] as Contact; if (contact.NoMassMail == true && list.NoMassMail == true || contact.NoEMail == true && list.NoEMail == true || contact.NoMail == true && list.NoMail == true || contact.NoCall == true && list.NoCall == true || contact.NoFax == true && list.NoFax == true || contact.NoMarketing == true && list.NoMarketing == true) { continue; } var subscription = row[1] as CRMarketingListMember; var address = contact.EMail; if (address != null && (address = address.Trim()) != string.Empty && !mailKeys.Contains(address)) { mailKeys.Add(address); mails.Add(new Recipient(contact, subscription.Return(s => s.Format, NotificationFormat.Html))); if (onlyFirst) { break; } } } if (mails.Count > 0 && onlyFirst) { break; } } } break; case CRMassMailSourcesAttribute.Campaign: foreach (CRCampaign list in Campaigns.Select()) { if (list.Selected == true) { foreach (PXResult <Contact, CRCampaignMembers> item in PXSelectJoin <Contact, InnerJoin <CRCampaignMembers, On <CRCampaignMembers.contactID, Equal <Contact.contactID> > >, Where <Contact.noMassMail, NotEqual <True>, And <Contact.noEMail, NotEqual <True>, And <CRCampaignMembers.campaignID, Equal <Required <CRCampaignMembers.campaignID> >, And <CRCampaignMembers.status, Equal <Required <CRCampaignMembers.status> > > > > > > .Select(this, list.CampaignID, list.TargetStatus, true)) { var contact = (Contact)item; var member = (CRCampaignMembers)item; var address = contact.EMail; if (address != null && (address = address.Trim()) != string.Empty && !mailKeys.Contains(address)) { mailKeys.Add(address); mails.Add(new CampaignRecipient(contact, NotificationFormat.Html, member, list.DestinationStatus)); if (onlyFirst) { break; } } } if (mails.Count > 0 && onlyFirst) { break; } } } break; case CRMassMailSourcesAttribute.Lead: foreach (Contact contact in Leads.Select()) { if (contact.Selected == true) { var address = contact.EMail; if (address != null && (address = address.Trim()) != string.Empty && !mailKeys.Contains(address)) { mailKeys.Add(address); mails.Add(new Recipient(contact, NotificationFormat.Html)); if (onlyFirst) { break; } } } } break; } return(mails); }