private List <ITagValue> CreateArgs(string region, string url)
        {
            var args = new List <ITagValue>()
            {
                new TagValue(Tags.RegionName, TransferResourceHelper.GetRegionDescription(region)),
                new TagValue(Tags.PortalUrl, url)
            };

            if (!string.IsNullOrEmpty(url))
            {
                args.Add(new TagValue(CommonTags.VirtualRootPath, url));
                args.Add(new TagValue(CommonTags.ProfileUrl, url + CommonLinkUtility.GetMyStaff()));
                args.Add(new TagValue(CommonTags.LetterLogo, TenantLogoManager.GetLogoDark(true)));
            }
            return(args);
        }
        private void MigrationNotify(INotifyAction action, string region, string url, bool notify)
        {
            var users = CoreContext.UserManager.GetUsers()
                        .Where(u => notify ? u.ActivationStatus == EmployeeActivationStatus.Activated : u.IsOwner())
                        .Select(u => ToRecipient(u.ID));

            if (users.Any())
            {
                client.SendNoticeToAsync(
                    action,
                    null,
                    users.ToArray(),
                    new[] { EMailSenderName },
                    null,
                    new TagValue(Constants.TagRegionName, TransferResourceHelper.GetRegionDescription(region)),
                    new TagValue("PortalUrl", url));
            }
        }
Ejemplo n.º 3
0
 private static List <TransferRegionWithName> GetRegions()
 {
     try
     {
         using (var backupClient = new BackupServiceClient())
         {
             return(backupClient.GetTransferRegions()
                    .Select(x => new TransferRegionWithName
             {
                 Name = x.Name,
                 IsCurrentRegion = x.IsCurrentRegion,
                 BaseDomain = x.BaseDomain,
                 FullName = TransferResourceHelper.GetRegionDescription(x.Name)
             })
                    .ToList());
         }
     }
     catch
     {
         return(new List <TransferRegionWithName>());
     }
 }
Ejemplo n.º 4
0
        private void MigrationNotify(Tenant tenant, INotifyAction action, string region, string url, bool notify)
        {
            using var scope = ServiceProvider.CreateScope();
            var scopeClass = scope.ServiceProvider.GetService <NotifyHelperScope>();

            var(userManager, studioNotifyHelper, studioNotifySource, _) = scopeClass;
            var client = WorkContext.NotifyContext.NotifyService.RegisterClient(studioNotifySource, scope);

            var users = userManager.GetUsers()
                        .Where(u => notify ? u.ActivationStatus.HasFlag(EmployeeActivationStatus.Activated) : u.IsOwner(tenant))
                        .Select(u => studioNotifyHelper.ToRecipient(u.ID))
                        .ToArray();

            if (users.Any())
            {
                client.SendNoticeToAsync(
                    action,
                    users,
                    new[] { StudioNotifyService.EMailSenderName },
                    new TagValue(Tags.RegionName, TransferResourceHelper.GetRegionDescription(region)),
                    new TagValue(Tags.PortalUrl, url));
            }
        }
Ejemplo n.º 5
0
        public static string GetFullName(this TransferRegion transferRegion)
        {
            var result = TransferResourceHelper.GetRegionDescription(transferRegion.Name);

            return(!string.IsNullOrEmpty(result) ? result : transferRegion.Name);
        }