public void AddGUID(ref PartnerServiceIntegration serviceIntegration) { if (serviceIntegration.AccountNumber == Guid.Empty) { var partnerService = new PartnerServiceIntegrations(); var Integration = partnerService.GetByClientID(serviceIntegration.ClientID, serviceIntegration.AdminClientID); if (Integration != null) { serviceIntegration.AccountNumber = Integration.AccountNumber; serviceIntegration.Id = Integration.Id; } } if (serviceIntegration.AccountNumber == Guid.Empty) { serviceIntegration.AccountNumber = Guid.NewGuid(); if (serviceIntegration.AdminClientID == 0) { serviceIntegration.AdminClientID = Users.CurrentUser.ClientID; } //Send an email notification to [email protected] containing the customer client's name EmailRoutingCollection emailsCollection = EmailRouting.GetEmailsByAdminClient(serviceIntegration.AdminClientID); EmailRouting emailRouting = new EmailRouting(); foreach (EmailRouting emails in emailsCollection) { if (emails.EmailType == "New Client Activated") { emailRouting = emails; break; } } Clients client = new Clients(serviceIntegration.ClientID); MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress(emailRouting.FromEmail); mailMessage.To.Add(new MailAddress("*****@*****.**")); mailMessage.IsBodyHtml = true; mailMessage.Priority = MailPriority.Normal; mailMessage.Body = client.Name + " was activated from " + Users.CurrentUser.Client.Name + ". Their account number is: " + serviceIntegration.AccountNumber.ToString(); try { Degatech.Utilities.Data.Utilities.SendEmail(mailMessage); } catch (Exception ex) { } } }
private EmailTemplate GetEmailTemplate() { EmailTemplate emailTemplate = new EmailTemplate(); EmailRoutingCollection emailsCollection = EmailRouting.GetEmailsByAdminClient(_FuelOrder.AdminClientID); EmailRouting emailRouting = new EmailRouting(); foreach (EmailRouting emails in emailsCollection) { if (emails.EmailType == "Fuel Order") { emailRouting = emails; break; } } emailTemplate.EmailTo = _Customer.Email; emailTemplate.ReplacementValues.Add("%FROMEMAIL%", emailRouting.FromEmail); emailTemplate.ReplacementValues.Add("%CUSTOMEREMAIL%", _Customer.Email); emailTemplate.ReplacementValues.Add("%COMPANY%", _Customer.Name); emailTemplate.ReplacementValues.Add("%TAILNUMBER%", _FuelOrder.Aircraft.TailNumber); emailTemplate.ReplacementValues.Add("%CURRENTDATE%", DateTime.Now.ToString("f")); emailTemplate.ReplacementValues.Add("%TRIPNUMBER%", _FuelOrder.TripID.ToString()); emailTemplate.ReplacementValues.Add("%ICAO%", _FuelOrder.ICAO); emailTemplate.ReplacementValues.Add("%LISTINGNAME%", _FuelOrder.FBO); emailTemplate.ReplacementValues.Add("%REQUESTEDUPLIFT%", (Convert.ToInt32(_FuelOrder.QuotedVolume) == 1 ? "1+" : Convert.ToInt32(_FuelOrder.QuotedVolume).ToString())); emailTemplate.ReplacementValues.Add("%QUOTEDPRICE%", _FuelOrder.QuotedPPG.ToString("C")); emailTemplate.ReplacementValues.Add("%RAMPFEE%", _FuelOrder.RampFee.ToString("C")); emailTemplate.ReplacementValues.Add("%RAMPFEEWAIVED%", _FuelOrder.RampFeeWaivedAt.ToString()); emailTemplate.ReplacementValues.Add("%NOTES%", _FuelOrder.AdminNotes); emailTemplate.ReplacementValues.Add("%ID%", _FuelOrder.Id.ToString()); emailTemplate.ReplacementValues.Add("%FUELINGDATE%", _FuelOrder.FuelingDateString + " at " + _FuelOrder.FuelingTimeString); emailTemplate.ReplacementValues.Add("%PRODUCT%", _FuelOrder.Product); emailTemplate.ReplacementValues.Add("%AIRCRAFTTYPE%", _FuelOrder.Aircraft.MakeAndModel.Make + " " + _FuelOrder.Aircraft.MakeAndModel.Model); return(emailTemplate); }
private EmailTemplate GetEmailTemplate() { EmailTemplate emailTemplate = new EmailTemplate(); EmailRoutingCollection emailsCollection = EmailRouting.GetEmailsByAdminClient(_FuelOrder.AdminClientID); EmailRouting emailRouting = new EmailRouting(); foreach (EmailRouting emails in emailsCollection) { if (emails.EmailType == "Fuel Order") { emailRouting = emails; break; } } emailTemplate.EmailTo = emailRouting.ToEmail; emailTemplate.ReplacementValues.Add("%FROMEMAIL%", emailRouting.FromEmail); emailTemplate.ReplacementValues.Add("%COMPANY%", _Customer.Name); emailTemplate.ReplacementValues.Add("%ICAO%", _FuelOrder.ICAO); emailTemplate.ReplacementValues.Add("%CUSTOMEREMAIL%", _Customer.Email); emailTemplate.ReplacementValues.Add("%CUSTOMERPHONE%", _Customer.Phone); emailTemplate.ReplacementValues.Add("%VENDOR%", _Client.Name.Replace("Largent Fuel", "LARGENT Fuels")); emailTemplate.ReplacementValues.Add("%VENDOREMAIL%", emailRouting.DispatchContactEmail); emailTemplate.ReplacementValues.Add("%REQUESTEDUPLIFT%", Convert.ToInt32(_FuelOrder.QuotedVolume).ToString()); emailTemplate.ReplacementValues.Add("%QUOTEDPRICE%", _FuelOrder.QuotedPPG.ToString("C")); emailTemplate.ReplacementValues.Add("%NOTES%", _FuelOrder.AdminNotes); emailTemplate.ReplacementValues.Add("%LISTINGNAME%", _FuelOrder.FBO); emailTemplate.ReplacementValues.Add("%FLIGHTTYPE%", _Customer.CertificateType); emailTemplate.ReplacementValues.Add("%FUELINGDATE%", _FuelOrder.FuelingDateString + " at " + _FuelOrder.FuelingTimeString); emailTemplate.ReplacementValues.Add("%TAILNUMBER%", _FuelOrder.Aircraft.TailNumber); emailTemplate.ReplacementValues.Add("%AIRCRAFTTYPE%", _FuelOrder.Aircraft.MakeAndModel.Make + " " + _FuelOrder.Aircraft.MakeAndModel.Model); emailTemplate.ReplacementValues.Add("%ID%", _FuelOrder.Id.ToString()); emailTemplate.ReplacementValues.Add("%VOLUMEDISCOUNTOPTIONS%", GetVolumeDiscounts()); return(emailTemplate); }