public override void Save(MailboxStoreTypeProvider session) { if (!(this.RequestGuid == Guid.Empty)) { SmtpAddress smtpAddress = this.SmtpAddress; if (!string.IsNullOrEmpty(this.SmtpAddress.ToString())) { AggregatedAccountListConfiguration aggregatedAccountListConfiguration = this.Read(session, null) as AggregatedAccountListConfiguration; if (aggregatedAccountListConfiguration != null) { this.AggregatedAccountList = aggregatedAccountListConfiguration.AggregatedAccountList; } if (this.AggregatedAccountList == null) { this.AggregatedAccountList = new List <AggregatedAccountInfo>(); } AggregatedAccountInfo aggregatedAccountInfo = this.AggregatedAccountList.Find((AggregatedAccountInfo account) => account.RequestGuid == this.RequestGuid); if (aggregatedAccountInfo == null) { this.AggregatedAccountList.Add(new AggregatedAccountInfo(this.AggregatedMailboxGuid, this.SmtpAddress, this.RequestGuid)); } else { aggregatedAccountInfo.SmtpAddress = aggregatedAccountInfo.SmtpAddress; } this.UpdateFAI(session); return; } } }
public override void Delete(MailboxStoreTypeProvider session) { AggregatedAccountListConfiguration aggregatedAccountListConfiguration = this.Read(session, null) as AggregatedAccountListConfiguration; if (aggregatedAccountListConfiguration != null) { this.AggregatedAccountList = aggregatedAccountListConfiguration.AggregatedAccountList; } if (this.AggregatedAccountList != null) { this.AggregatedAccountList = this.AggregatedAccountList.FindAll((AggregatedAccountInfo account) => account.RequestGuid != this.RequestGuid); } if (this.AggregatedAccountList == null || this.AggregatedAccountList.Count == 0) { UserConfigurationHelper.DeleteMailboxConfiguration(session.MailboxSession, "AggregatedAccountList"); return; } this.UpdateFAI(session); }