public void DeleteMailAddress(MailAddressDTO dto) { if (dto == null) { throw new ArgumentException("参数为空!"); } MailAddress delMailAddress = _mailAddressRepository.Get(dto.Id); //获取需要删除的对象。 if (delMailAddress != null) { _mailAddressRepository.Remove(delMailAddress); //删除邮箱账号。 } }
public void InsertMailAddress(MailAddressDTO dto) { //创建邮箱账号 MailAddress newMailAddress = MailAddressFactory.CreateMailAddress(); newMailAddress.ChangeCurrentIdentity(dto.Id); newMailAddress.SetAddress(dto.Address); newMailAddress.SetDisplayName(dto.DisplayName); string password = dto.LoginPassword;//密码进行加密存储 newMailAddress.SetLoginPassword(password); newMailAddress.SetLoginUser(dto.LoginUser); newMailAddress.SetPop3Host(dto.Pop3Host); newMailAddress.SetReceivePort(dto.ReceivePort); newMailAddress.SetReceiveSSL(dto.ReceiveSSL); newMailAddress.SetSendPort(dto.SendPort); newMailAddress.SetSendSSL(dto.SendSSL); newMailAddress.SetServerType(dto.ServerType); newMailAddress.SetSmtpHost(dto.SmtpHost); newMailAddress.SetStartTLS(dto.StartTLS); _mailAddressRepository.Add(newMailAddress); }
public void ModifyMailAddress(MailAddressDTO dto) { //获取需要更新的对象 MailAddress updateMailAddress = _mailAddressRepository.Get(dto.Id); if (updateMailAddress != null) { //更新主表: updateMailAddress.SetAddress(dto.Address); updateMailAddress.SetDisplayName(dto.DisplayName); string password = dto.LoginPassword;//密码进行加密存储 updateMailAddress.SetLoginPassword(password); updateMailAddress.SetLoginUser(dto.LoginUser); updateMailAddress.SetPop3Host(dto.Pop3Host); updateMailAddress.SetReceivePort(dto.ReceivePort); updateMailAddress.SetReceiveSSL(dto.ReceiveSSL); updateMailAddress.SetSendPort(dto.SendPort); updateMailAddress.SetSendSSL(dto.SendSSL); updateMailAddress.SetServerType(dto.ServerType); updateMailAddress.SetSmtpHost(dto.SmtpHost); updateMailAddress.SetStartTLS(dto.StartTLS); } _mailAddressRepository.Modify(updateMailAddress); }