private bool IsSignatureExist(SignatureDto signature) { var signatureQuery = GetSelectSignaturesQuery(new List <int> { signature.MailboxId }, signature.Tenant); return(_manager.ExecuteList(signatureQuery).Any()); }
public AccountInfo(int id, string address, string name, bool enabled, bool quotaError, MailBox.AuthProblemType authError, SignatureDto signature, bool oauthConnection, string emailInFolder, bool isTeamlabMailbox, bool isSharedDomainMailbox) { Id = id; Email = address; Name = name; Enabled = enabled; QuotaError = quotaError; AuthError = authError == MailBox.AuthProblemType.TooManyErrors; Signature = signature; Aliases = new List<MailAddressInfo>(); Groups = new List<MailAddressInfo>(); OAuthConnection = oauthConnection; EMailInFolder = emailInFolder; IsTeamlabMailbox = isTeamlabMailbox; IsSharedDomainMailbox = isSharedDomainMailbox; }
public void UpdateOrCreateSignature(SignatureDto signature) { ISqlInstruction queryForExecution; if (IsSignatureExist(signature)) { queryForExecution = new SqlUpdate(SignatureTable.name) .Set(SignatureTable.Columns.html, signature.Html) .Set(SignatureTable.Columns.is_active, signature.IsActive) .Where(SignatureTable.Columns.id_tenant, signature.Tenant) .Where(SignatureTable.Columns.id_mailbox, signature.MailboxId); } else { queryForExecution = new SqlInsert(SignatureTable.name) .InColumnValue(SignatureTable.Columns.html, signature.Html) .InColumnValue(SignatureTable.Columns.is_active, signature.IsActive) .InColumnValue(SignatureTable.Columns.id_tenant, signature.Tenant) .InColumnValue(SignatureTable.Columns.id_mailbox, signature.MailboxId); } _manager.ExecuteNonQuery(queryForExecution); }
public MailAccount(string address, string name, bool enabled, bool quota_error, MailBox.AuthProblemType auth_error, int id, bool oauth_connection, SignatureDto signature, string email_in_folder) { Address = address; Name = name; Enabled = enabled; QuotaError = quota_error; AuthError = auth_error == MailBox.AuthProblemType.TooManyErrors; Id = id; OAuthConnection = oauth_connection; Signature = signature; EMailInFolder = email_in_folder; }
public SignatureDto UpdateOrCreateMailboxSignature(int mailboxId, string user, int tenant, string html, bool isActive) { using (var db = GetDb()) { CheckMailboxOwnage(mailboxId, user, tenant, db); var signature = new SignatureDto(mailboxId, tenant, html, isActive); var signatureDal = new SignatureDal(db); signatureDal.UpdateOrCreateSignature(signature); return signature; } }
private bool IsSignatureExist(SignatureDto signature) { var signatureQuery = GetSelectSignaturesQuery(new List<int> { signature.MailboxId }, signature.Tenant); return _manager.ExecuteList(signatureQuery).Any(); }
public void UpdateOrCreateSignature(SignatureDto signature) { ISqlInstruction queryForExecution; if (IsSignatureExist(signature)) { queryForExecution = new SqlUpdate(SignatureTable.name) .Set(SignatureTable.Columns.html, signature.Html) .Set(SignatureTable.Columns.is_active, signature.IsActive) .Where(SignatureTable.Columns.id_tenant, signature.Tenant) .Where(SignatureTable.Columns.id_mailbox, signature.MailboxId); } else { queryForExecution = new SqlInsert(SignatureTable.name) .InColumnValue(SignatureTable.Columns.html, signature.Html) .InColumnValue(SignatureTable.Columns.is_active, signature.IsActive) .InColumnValue(SignatureTable.Columns.id_tenant, signature.Tenant) .InColumnValue(SignatureTable.Columns.id_mailbox, signature.MailboxId); } _manager.ExecuteNonQuery(queryForExecution); }