我有点卡在这里。我想编辑使用存储过程从数据库中获取的某些字段。我正在尝试发送已将所有内容存储在“电子邮件”表中的电子邮件信息。从“电子邮件”表中获取信息后,我想编辑从数据库中获取的正文信息,然后使用我创建的电子邮件服务将其发送给用户。以下是我到目前为止所做的。我创建了一个哈希表并在那里存储了值:
MembershipUser qiUser = ((GenericMembershipProvider)Membership.Provider).GetUser(objSubAccount.CreatedByUser, false);
Hashtable mailKeywords = new Hashtable();
mailKeywords.Add("[AccountNumber]", objSubAccount.AccountNumber);
mailKeywords.Add("[AccountSubmissionDate]", objSubAccount.SubmittedOn.ToString());
mailKeywords.Add("[FBONameTitle]", objSubAccount.FBO1FirstName.Trim().Length == 0 && objSubAccount.FBO1MiddleInitial.Trim().Length == 0 && objSubAccount.FBO1LastName.Trim().Length == 0
? objSubAccount.FBO1AccountTitling : objSubAccount.FBO1FirstName + " " + objSubAccount.FBO1MiddleInitial + " " + objSubAccount.FBO1LastName);
mailKeywords.Add("[QIName]", objSubAccount.CompanyName);
mailKeywords.Add("[QIUserName]", qiUser.UserName);
mailKeywords.Add("[QIUserEmailAddress]", qiUser.Email);
mailKeywords.Add("[WireEmailNotification1]", objSubAccount.WireEmailNotification1);
mailKeywords.Add("[WireEmailNotification2]", objSubAccount.WireEmailNotification2);
mailKeywords.Add("[WireEmailNotification3]", objSubAccount.WireEmailNotification3);
现在我已将这些值分配给类 EmailContent 的不同属性,如下所示:
EmailContent objEmailContent = new EmailContent();
objEmailContent = EmailContent.GetEmailContentType(EmailContentType.WireroomGroup);
objEmailContent.To = BancorpConfig.WireroomReceiverEmail;
objEmailContent.Sender = BancorpConfig.WireRoomSenderEmail;
objEmailContent.Subject = EmailContent.ReplacePlaceHolder(objEmailContent.Subject, mailKeywords);
objEmailContent.Body = EmailContent.ReplacePlaceHolder(objEmailContent.Body, mailKeywords);
objEmailContent.From = BancorpConfig.WireRoomSenderEmail;
objEmailContent.MailDate = System.DateTime.Now;
现在我想要做的是,当我在 objEmailContent.Body 中获得值时,我想编辑它,就好像它们在 WireEmailNotificaion1 列中没有值一样,然后应该删除括号“()”。如果它们是 WireEmailNotification1,则该值应显示为 (aa@gmail.com) 否则不应显示任何值,也应删除括号。
邮件正文如下:
New QI Sub Account Application Submitted<br />
Account Number: ([AccountNumber])<br />
FBO Name/Account Title: ([FBONameTitle]) <br />
Application Submitted Date: ([AccountSubmissionDate])<br />
QI Name: ([QIName])<br />QI User Name: ([QIUserName])<br />
QI User Email Address: ([QIUserEmailAddress])<br />
Wire Email Notification 1: ([WireEmailNotification1])<br/>
Wire Email Notification 2: ([WireEmailNotification2])<br/>
Wire Email Notification 3: ([WireEmailNotification3])<br/>
Please add account to the Caller ID’s on Schedule A of the Wire Agreement.
如果它们在 WireEmailNotification1、WireEmailNotification2、WireEmailNotification3 中没有值,我将如何从正文中删除括号?