public static List<Recipient> ParseRecipientLeadsStrings(string strLeads, bool flag) { List<Recipient> recipients = new List<Recipient>(); List<string> leads = new List<string>(); leads = strLeads.Split(',').ToList<string>(); foreach (var item in leads) { Recipient recipient = new Recipient(); if (flag) { recipient.IsBcc = true; } else { recipient.IsBcc = false; } recipient.FullName = item; recipients.Add(recipient); } return recipients; }
public List<Recipient> GetLeadsRecipients(int id) { using (var dc = new EngageCCTDataClassesDataContext()) { List<Recipient> recipients = new List<Recipient>(); var leadActivity = dc.T_ActivityLeads.Where(la => la.ActivityID == id); if (leadActivity != null) { foreach (var item in leadActivity) { Recipient resipient = new Recipient(); resipient.FullName = DataManager.GetLeadById(item.LeadID).FullName; resipient.IsBcc = item.IsBcc; recipients.Add(resipient); } } return recipients; } }
private string GetUserLoginByFullName(Recipient recipient) { using (var dc = new EngageCCTDataClassesDataContext()) { string login; var users = dc.T_UserInformations.AsQueryable(); var user = users.SingleOrDefault(e => e.usrFirstName + " " + e.usrLastName == recipient.FullName); if (user != null) { login = user.Login; } else { throw new ApplicationException("User with this Full Name not found"); } return login; } }
public List<Recipient> GetUsersRecipients(int id) { using (var dc = new EngageCCTDataClassesDataContext()) { List<Recipient> recipients = new List<Recipient>(); var usersActivity = dc.T_ActivityUserInformations.Where(ua => ua.ActivityID == id); if (usersActivity != null) { foreach (var item in usersActivity) { Recipient resipient = new Recipient(); resipient.FullName = GetUserFullNameByLogin(item.Login); resipient.IsBcc = item.IsBcc; recipients.Add(resipient); } } return recipients; } }
public int GetLeadIDByFullName(Recipient name) { using (var dc = new EngageCCTDataClassesDataContext()) { int id; var leads = dc.T_Leads.AsQueryable(); var lead = leads.SingleOrDefault(e => e.ldFirstName + " " + e.ldLastName == name.FullName); if (lead != null) { id = lead.LeadID; } else { throw new ApplicationException("Not found lead"); } return id; } }