public Context() { SenderHolder = new SenderHolder(); NotifyService = new NotifyRegistryImpl(this); NotifyEngine = new NotifyEngine(this); DispatchEngine = new DispatchEngine(this); }
static void NotifyEngine_BeforeTransferRequest(ASC.Notify.Engine.NotifyEngine sender, ASC.Notify.Engine.NotifyRequest request) { request.Properties.Add("asc.web.product_id", CommonLinkUtility.GetProductID()); Guid aid = Guid.Empty; string aname = ""; if (SecurityContext.IsAuthenticated) { aid = SecurityContext.CurrentAccount.ID; if (CoreContext.UserManager.UserExists(aid)) { aname = CoreContext.UserManager.GetUsers(aid).DisplayUserName(); } } //__AuthorID request.Arguments.Add(new TagValue(CommonTags.AuthorID, aid)); //__AuthorName request.Arguments.Add(new TagValue(CommonTags.AuthorName, aname)); //__AuthorUrl request.Arguments.Add(new TagValue(CommonTags.AuthorUrl, CommonLinkUtility.GetUserProfile(aid, CommonLinkUtility.GetProductID()))); if (!request.Arguments.Any(x => CommonTags.SendFrom.Equals(x.Tag.Name)))//If none add current { request.Arguments.Add(new TagValue(CommonTags.SendFrom, CoreContext.TenantManager.GetCurrentTenant(false).Name)); } }
static void NotifyEngine_AfterTransferRequest(ASC.Notify.Engine.NotifyEngine sender, ASC.Notify.Engine.NotifyRequest request) { var productID = (Guid)request.Properties["asc.web.product_id"]; if (productID != Guid.Empty) { CallContext.SetData("asc.web.product_id", productID); } }
public Context() { NotifyEngine = new NotifyEngine(this); DispatchEngine = new DispatchEngine(this); }
private static void BeforeTransferRequest(NotifyEngine sender, NotifyRequest request) { var aid = Guid.Empty; var aname = string.Empty; if (SecurityContext.IsAuthenticated) { aid = SecurityContext.CurrentAccount.ID; if (CoreContext.UserManager.UserExists(aid)) { aname = CoreContext.UserManager.GetUsers(aid).DisplayUserName(false) .Replace(">", ">") .Replace("<", "<"); } } IProduct product; IModule module; CommonLinkUtility.GetLocationByRequest(out product, out module); if (product == null && CallContext.GetData("asc.web.product_id") != null) { product = WebItemManager.Instance[(Guid)CallContext.GetData("asc.web.product_id")] as IProduct; } request.Arguments.Add(new TagValue(CommonTags.AuthorID, aid)); request.Arguments.Add(new TagValue(CommonTags.AuthorName, aname)); request.Arguments.Add(new TagValue(CommonTags.AuthorUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(aid)))); request.Arguments.Add(new TagValue(CommonTags.VirtualRootPath, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/'))); request.Arguments.Add(new TagValue(CommonTags.ProductID, product != null ? product.ID : Guid.Empty)); request.Arguments.Add(new TagValue(CommonTags.ModuleID, module != null ? module.ID : Guid.Empty)); request.Arguments.Add(new TagValue(CommonTags.ProductUrl, CommonLinkUtility.GetFullAbsolutePath(product != null ? product.StartURL : "~"))); request.Arguments.Add(new TagValue(CommonTags.DateTime, TenantUtil.DateTimeNow())); request.Arguments.Add(new TagValue(CommonTags.Helper, new PatternHelper())); request.Arguments.Add(new TagValue(CommonTags.RecipientID, Context.SYS_RECIPIENT_ID)); request.Arguments.Add(new TagValue(CommonTags.RecipientSubscriptionConfigURL, CommonLinkUtility.GetMyStaff())); if (!request.Arguments.Any(x => CommonTags.SendFrom.Equals(x.Tag))) { request.Arguments.Add(new TagValue(CommonTags.SendFrom, CoreContext.TenantManager.GetCurrentTenant().Name)); } }
private static void NotifyEngine_AfterTransferRequest(NotifyEngine sender, NotifyRequest request) { var tenant = (request.Properties.Contains("Tenant") ? request.Properties["Tenant"] : null) as Tenant; if (tenant != null) { CoreContext.TenantManager.SetCurrentTenant(tenant); } }
private static void NotifyEngine_BeforeTransferRequest(NotifyEngine sender, NotifyRequest request) { request.Properties.Add("Tenant", CoreContext.TenantManager.GetCurrentTenant(false)); }