private static bool SendEmail(CoreDBDataContext dc, PUEvent eventInfo, PUConsumerData consumerInfo, bool MMS = false, bool useConsumerDataID = false) { if (!string.IsNullOrWhiteSpace(consumerInfo.Email) || MMS) { var email = new Email(); var imageDetails = new ImageDetails(); var tourInfo = dc.PUTours.FirstOrDefault(t => t.TourID == eventInfo.TourID); var programInfo = dc.PUPrograms.FirstOrDefault(p => p.ProgramID == tourInfo.ProgramID); var brandInfo = dc.PUBrands.FirstOrDefault(b => b.BrandID == programInfo.BrandID); var brandName = brandInfo.Name; if (!string.IsNullOrWhiteSpace(brandName)) { email.Alias = brandName; } else { email.Alias = "PictureU.com"; } email.SendLink = (bool)eventInfo.SendLink; email.AttachImage = (bool)eventInfo.AttachImages; email.MMS = MMS; email.FirstName = consumerInfo.FirstName; email.LastName = consumerInfo.LastName; imageDetails.CompressedName = consumerInfo.CompressedImageName; imageDetails.Height = 250; email.To = consumerInfo.Email; email.From = eventInfo.EmailFrom; if (email.MMS) //Text Messaging { email.TemplateContent = eventInfo.TextBody; email.Subject = eventInfo.TextSubject; } else //Emailing { email.TemplateContent = eventInfo.EmailBody; email.Subject = eventInfo.EmailSubject; } var sent = SendNonTemplatedEmail(email, imageDetails, consumerInfo.SecureCode, consumerInfo.ConsumerDataID.ToString(), consumerInfo.EventID.ToString()); if (sent) { if (email.MMS) { consumerInfo.MMSSent = true; } else { consumerInfo.ImageSent = true; } dc.SubmitChanges(); return true; } else { return false; } } else { return false; } }
partial void DeletePUConsumerData(PUConsumerData instance);
partial void InsertPUConsumerData(PUConsumerData instance);
partial void UpdatePUConsumerData(PUConsumerData instance);
private void detach_PUConsumerDatas(PUConsumerData entity) { this.SendPropertyChanging(); entity.PUEvent = null; }