exclude inactive customers from email address list for selected product codes report

This commit is contained in:
2022-06-07 23:10:52 +00:00
parent d39909bb9d
commit f9784d0b0d
4 changed files with 79 additions and 61 deletions

View File

@@ -71,7 +71,7 @@ namespace rockfishCore.Controllers
[HttpPost("emailsforproductcodes")]
public JsonResult GetUniqueEmailsByProductCodes([FromBody] requestEmailsForProductCodes req)
{
var customerList = _context.Customer.Select(p => new { p.Id, p.DoNotContact });
var customerList = _context.Customer.Select(p => new { p.Id, p.DoNotContact, p.Active });
List<long> rawCustomerIds = new List<long>();
@@ -88,10 +88,26 @@ namespace rockfishCore.Controllers
//container for the raw email lists built serially
List<string> rawEmails = new List<string>();
/*
Test for QBI and renewal with version 6.13 before new code to remove non active's:
mikem@alpine-optics.com,yamilef@alpine-optics.com,davidb@alpine-optics.com,eli@data-serv.com,jasonc@energycontrol.com,renah@energycontrol.com,nmizrahi@energycontrol.com,sherri@entryguardsystems.com,
error@error-cr.com,bfairman@fairmanassociates.com,info@fouralarm.ca,scott@fouralarm.ca,angela@fouralarm.ca,matt.levis0@gmail.com,hartcomputersme@gmail.com,steve@grafixsolutions.net,
spasandleisure@hotmail.com,service@intermedex.com,bos@iss-central.com,ronkingmail2@netscape.net,fernando@pegasusind.com,admin@pegasusind.com,jdragan@pro-ees.com,imcleod@redskye.co.uk,
amcleod@redskye.co.uk,rena@sensorfact.com,sales@solveit.ie,austin@solveit.ie,ericg@straighttalktech.com,shootnsharp@thesoileaus.com,skyliner575600@yahoo.com,chad@zapmgames.com
After these changes:
mikem@alpine-optics.com,yamilef@alpine-optics.com,davidb@alpine-optics.com,eli@data-serv.com,sherri@entryguardsystems.com,bfairman@fairmanassociates.com,info@fouralarm.ca,scott@fouralarm.ca,
angela@fouralarm.ca,matt.levis0@gmail.com,hartcomputersme@gmail.com,steve@grafixsolutions.net,spasandleisure@hotmail.com,service@intermedex.com,bos@iss-central.com,ronkingmail2@netscape.net,
fernando@pegasusind.com,admin@pegasusind.com,jdragan@pro-ees.com,imcleod@redskye.co.uk,amcleod@redskye.co.uk,shootnsharp@thesoileaus.com,skyliner575600@yahoo.com,chad@zapmgames.com
*/
foreach (long cid in uniqueCustomerIds)
{
//skip if do not contact and not explicitly including do not contact
if (customerList.First(p => p.Id == cid).DoNotContact && req.ckNoContact != true)
//get customer record
var customerRecord=customerList.First(p => p.Id == cid);
//skip if not present, not active or do not contact and not explicitly including do not contact
if (customerRecord==null || customerRecord.Active==false ||( customerRecord.DoNotContact && req.ckNoContact != true))
continue;
//get all raw email values for this client from db