public void SendAboutCreateNewContact(List <Guid> recipientID, int contactID, String contactTitle, NameValueCollection fields) { if ((recipientID.Count == 0) || String.IsNullOrEmpty(contactTitle)) { return; } client.SendNoticeToAsync( NotifyConstants.Event_CreateNewContact, null, recipientID.ConvertAll(item => ToRecipient(item)).ToArray(), true, new TagValue(NotifyConstants.Tag_AdditionalData, fields), new TagValue(NotifyConstants.Tag_EntityTitle, contactTitle), new TagValue(NotifyConstants.Tag_EntityID, contactID) ); }
public void OnMessage(NotifyItem item) { CoreContext.TenantManager.SetCurrentTenant(item.TenantId); CultureInfo culture = null; var tenant = CoreContext.TenantManager.GetCurrentTenant(false); if (tenant != null) { culture = tenant.GetCulture(); } if (Guid.TryParse(item.UserId, out var userId) && !userId.Equals(Constants.Guest.ID) && !userId.Equals(Guid.Empty)) { SecurityContext.AuthenticateMe(item.TenantId, userId); var user = CoreContext.UserManager.GetUsers(item.TenantId, userId); if (!string.IsNullOrEmpty(user.CultureName)) { culture = CultureInfo.GetCultureInfo(user.CultureName); } } if (culture != null && !Equals(Thread.CurrentThread.CurrentCulture, culture)) { Thread.CurrentThread.CurrentCulture = culture; } if (culture != null && !Equals(Thread.CurrentThread.CurrentUICulture, culture)) { Thread.CurrentThread.CurrentUICulture = culture; } client.SendNoticeToAsync( (NotifyAction)item.Action, item.ObjectID, item.Recipients?.Select(r => r.IsGroup ? new RecipientsGroup(r.ID, r.Name) : (IRecipient) new DirectRecipient(r.ID, r.Name, r.Addresses.ToArray(), r.CheckActivation)).ToArray(), item.SenderNames.Any() ? item.SenderNames.ToArray() : null, item.CheckSubsciption, item.Tags.Select(r => new TagValue(r.Tag_, r.Value)).ToArray()); }
public void SendRequestTariff(bool license, string fname, string lname, string title, string email, string phone, string ctitle, string csize, string site, string message) { fname = (fname ?? "").Trim(); if (string.IsNullOrEmpty(fname)) { throw new ArgumentNullException("fname"); } lname = (lname ?? "").Trim(); if (string.IsNullOrEmpty(lname)) { throw new ArgumentNullException("lname"); } title = (title ?? "").Trim(); email = (email ?? "").Trim(); if (string.IsNullOrEmpty(email)) { throw new ArgumentNullException("email"); } phone = (phone ?? "").Trim(); if (string.IsNullOrEmpty(phone)) { throw new ArgumentNullException("phone"); } ctitle = (ctitle ?? "").Trim(); if (string.IsNullOrEmpty(ctitle)) { throw new ArgumentNullException("ctitle"); } csize = (csize ?? "").Trim(); if (string.IsNullOrEmpty(csize)) { throw new ArgumentNullException("csize"); } site = (site ?? "").Trim(); if (string.IsNullOrEmpty(site) && !CoreContext.Configuration.CustomMode) { throw new ArgumentNullException("site"); } message = (message ?? "").Trim(); if (string.IsNullOrEmpty(message) && !CoreContext.Configuration.CustomMode) { throw new ArgumentNullException("message"); } var salesEmail = AdditionalWhiteLabelSettings.Instance.SalesEmail ?? SetupInfo.SalesEmail; var recipient = (IRecipient)(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), String.Empty, new[] { salesEmail }, false)); client.SendNoticeToAsync(license ? Actions.RequestLicense : Actions.RequestTariff, null, new[] { recipient }, new[] { "email.sender" }, null, new TagValue(Tags.UserName, fname), new TagValue(Tags.UserLastName, lname), new TagValue(Tags.UserPosition, title), new TagValue(Tags.UserEmail, email), new TagValue(Tags.Phone, phone), new TagValue(Tags.Website, site), new TagValue(Tags.CompanyTitle, ctitle), new TagValue(Tags.CompanySize, csize), new TagValue(Tags.Body, message)); }
/// <summary> /// notify user about his password changed /// </summary> public void UserPasswordChanged(Guid userID, string password) { UserInfo Author = null; UserInfo newUserInfo = CoreContext.UserManager.GetUsers(userID); if (CoreContext.UserManager.UserExists(SecurityContext.CurrentAccount.ID)) { Author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID); } ISendInterceptor initInterceptor = null; if (Author != null) { initInterceptor = new InitiatorInterceptor(new[] { UserInfoAsRecipient(Author) }); client.AddInterceptor(initInterceptor); } client.SendNoticeToAsync( Constants.ActionPasswordChanged, null, new[] { UserInfoAsRecipient(newUserInfo) }, new[] { EMailSenderName }, null, new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()), new TagValue(Constants.TagUserEmail, newUserInfo.Email), new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()), new TagValue(Constants.TagPassword, password) ); if (initInterceptor != null) { client.RemoveInterceptor(initInterceptor.Name); } }
public void SendInvaiteToProjectTeam(Guid userId, Project project) { var recipient = ToRecipient(userId); if (recipient != null) { client.SendNoticeToAsync( NotifyConstants.Event_InviteToProject, project.UniqID, new[] { recipient }, GetDefaultSenders(recipient), null, new TagValue(NotifyConstants.Tag_ProjectID, project.ID), new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title), ReplyToTagProvider.Message(project.ID)); } }
public void SendInvaiteToProjectTeam(Guid userId, Project project) { var recipient = ToRecipient(userId); if (recipient != null) { client.SendNoticeToAsync( NotifyConstants.Event_InviteToProject, project.UniqID, new[] { recipient }, true, new TagValue(NotifyConstants.Tag_ProjectID, project.ID), new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title), ReplyToTagProvider.Message(project.ID), new AdditionalSenderTag("push.sender"), new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Project, project.ID.ToString(), project.Title)), new TagValue(PushConstants.PushModuleTagName, PushModule.Projects), new TagValue(PushConstants.PushActionTagName, PushAction.InvitedTo)); } }