コード例 #1
0
ファイル: TrackingEmailer.cs プロジェクト: Pointy-hair/Group
        private string TrackHtmlContent(CommunicationBlast blast, string html, Guid communicationPieceUid, MultipleValueDictionary <string, CommunicationBlastTracker> trackersByUrl, string hostname)
        {
            var pieceSegment = Base32.Encode(communicationPieceUid.ToByteArray());

            return(TrackHtmlContent(
                       html,
                       (pos, linkType, linkUrl) =>
            {
                var tracker = trackersByUrl[linkUrl.ToString()]
                              .FirstOrDefault(z =>
                                              z.CommunicationType == Communications.CommunicationTypes.Email &&
                                              z.Position == pos &&
                                              z.LinkType == linkType);
                if (tracker == null)
                {
                    tracker = new CommunicationBlastTracker
                    {
                        CommunicationType = Communications.CommunicationTypes.Email,
                        Position = pos,
                        LinkType = linkType,
                        RedirectUrl = linkUrl.ToString(),
                        TrackerUid = Guid.NewGuid(),
                        CommunicationBlast = blast
                    };
                    Rdb.CommunicationBlastTrackers.Add(tracker);
                    trackersByUrl.Add(tracker.RedirectUrl, tracker);
                }
                return new Uri($"https://{hostname}/e/{TenantId}/{pieceSegment}/{Base32.Encode(tracker.TrackerUid.ToByteArray())}");
            }));
        }
コード例 #2
0
        private void PopulateViewBagWithCreativeSelectListItemsByCommunicationModel(int tenantId)
        {
            var m = new MultipleValueDictionary <CommunicationModelTypes, SelectListItem>();

            Stuff.GetEnumValues <CommunicationModelTypes>().ForEach(cm => m.Add(cm, new SelectListItem {
                Text = AspHelpers.NoneDropdownItemText, Value = AspHelpers.NoneDropdownItemValue
            }));

            var creatives = from cr in Rdb.Creatives.Include(z => z.CreativeCommunicationBlasts)
                            where cr.TenantId == TenantId && cr.CreativeTitle != null && cr.CreativeCommunicationBlasts.Count == 0
                            select cr;

            foreach (var creative in creatives)
            {
                m.Add(creative.ModelType, new SelectListItem {
                    Text = $"{creative.CreativeTitle} ({creative.CreativeId})", Value = creative.CreativeId.ToString()
                });
            }
            var d = m.ToDictionaryOfCollection();

            ViewBag.CreativeSelectListItemsByCommunicationModel = d;
        }
コード例 #3
0
        public async Task <ActionResult> Unassigned(string sortCol, string sortDir, int?page, int?pageSize)
        {
            SetNoDataMessage(NoDataMessages.NoUnassigned);
            ViewBag.AllAreUnassigned = true;

            var predicate = PredicateBuilder.Create <Workflow>(wf => false);

            var m = new MultipleValueDictionary <string, Tuple <List <int?>, string> >();

            foreach (var g in GetUserGroups(CurrentUserId))
            {
                if (g.UserId == PortalHelpers.ReassignGroupUserId)
                {
                    continue;
                }
                var regionIds = User.GetUserGroupRegions(g.UserName).OrderBy(z => z.GetValueOrDefault()).ToList();
                predicate = predicate.Or(wf => wf.OwnerUserId == g.UserId && regionIds.Contains(wf.UnliquidatedObligation.RegionId));
                m.Add(Cache.CreateKey(regionIds), Tuple.Create(regionIds, g.UserName));
            }

            if (m.Count > 0)
            {
                foreach (var k in m.Keys)
                {
                    var tuples     = m[k];
                    var groupNames = tuples.Select(z => z.Item2).OrderBy();
                    ShowGroupRegionMembershipAlert(groupNames, tuples.First().Item1);
                }
            }
            else
            {
                AddPageAlert($"You're not a member of any related groups and will not have any unassigned items.", false, PageAlert.AlertTypes.Warning);
            }

            var prohibitedWorkflowIds = await DB.WorkflowProhibitedOwners.Where(z => z.ProhibitedOwnerUserId == CurrentUserId).Select(z => z.WorkflowId).ToListAsync();

            var workflows = from wf in DB.Workflows.Where(predicate)
                            where !prohibitedWorkflowIds.Contains(wf.WorkflowId)
                            select wf;

            workflows = ApplyBrowse(
                workflows.WhereReviewExists().ApplyStandardIncludes(),
                sortCol ?? nameof(Workflow.DueAtUtc), sortDir, page, pageSize);

            PopulateRequestForReassignmentsControllerDetailsBulkTokenIntoViewBag(workflows);
            PopulateViewInfoIntoViewBag(workflows);

            return(View(workflows));
        }
コード例 #4
0
 private MultipleValueDictionary <string, string> GetOrderedActivityNameByWorkflowName()
 => Cacher.FindOrCreateValWithSimpleKey(
     nameof(GetOrderedActivityNameByWorkflowName),
     () =>
 {
     var m = new MultipleValueDictionary <string, string>(null, () => new List <string>());
     foreach (var wd in DB.WorkflowDefinitions.Where(wfd => wfd.IsActive == true))
     {
         foreach (var activityName in wd.Description.WebActionWorkflowActivities.OrderBy(a => a.SequenceNumber).Select(a => a.ActivityName))
         {
             m.Add(wd.WorkflowDefinitionName, activityName);
         }
     }
     return(m);
 },
     UloHelpers.MediumCacheTimeout
     );
コード例 #5
0
ファイル: UloController.cs プロジェクト: iamravikumar/FM-ULO
        public ActionResult RequestForReassignments(string sortCol, string sortDir, int?page, int?pageSize)
        {
            SetNoDataMessage(ConfigOptions.Value.NoReassignments);
            ViewBag.ShowReassignButton = true;
            var regionIds           = new List <int?>();
            var reassignGroupUserId = UserHelpers.ReassignGroupUserId;

            var predicate = PredicateBuilder.Create <Workflow>(wf => false);

            var m = new MultipleValueDictionary <string, Tuple <List <int?>, string> >();

            foreach (var g in GetUserGroups(CurrentUserId))
            {
                if (g.UserId == UserHelpers.ReassignGroupUserId)
                {
                    continue;
                }
                regionIds = UserHelpers.GetUserGroupRegions(g).OrderBy(z => z.GetValueOrDefault()).ToList();
                predicate = predicate.Or(wf => wf.OwnerUserId == g.UserId && regionIds.Contains(wf.TargetUlo.RegionId));
                m.Add(Cache.CreateKey(regionIds), Tuple.Create(regionIds, g.UserName));
            }

            if (m.Count > 0)
            {
                foreach (var k in m.Keys)
                {
                    var tuples     = m[k];
                    var groupNames = tuples.Select(z => z.Item2).OrderBy();
                    ShowGroupRegionMembershipAlert(groupNames, tuples.First().Item1);
                    goto Browse;
                }
            }


            AddPageAlert($"You're not a member of the reassignments group and will not see any items.", false, PageAlert.AlertTypes.Warning);

Browse:
            var workflows = ApplyBrowse(
                Workflows.Where(wf => wf.OwnerUserId == reassignGroupUserId && regionIds.Contains(wf.TargetUlo.RegionId)),
                sortCol ?? nameof(Workflow.DueAtUtc), sortDir, page, pageSize);

            PopulateRequestForReassignmentsControllerDetailsBulkTokenIntoViewBag(workflows);
            PopulateViewInfoIntoViewBag(workflows);

            return(View(workflows));
        }