Exemplo n.º 1
0
        private SaveMap ProcessWorkGroup(List <EntityInfo> workGroupInfos)
        {
            var publishingWgs = workGroupInfos
                                .Where(info => info.OriginalValuesMap.ContainsKey("MpSpStatus"))
                                .Select(info => info.Entity)
                                .OfType <WorkGroup>()
                                .Where(wg => wg.MpSpStatus == MpSpStatus.Published).ToList();

            var wgSaveMap = new Dictionary <Type, List <EntityInfo> > {
                { tWg, workGroupInfos }
            };

            if (!publishingWgs.Any())
            {
                return(null);
            }


            var svrWgIds        = publishingWgs.Select(wg => wg.WorkGroupId);
            var grpsWithMemsIds = ctxManager.Context.WorkGroups.Where(grp => svrWgIds.Contains(grp.WorkGroupId) && grp.GroupMembers.Where(mem => !mem.IsDeleted).Count() > 0).Select(wg => wg.WorkGroupId);

            if (grpsWithMemsIds.Any())
            {
                var publishResultMap = WorkGroupPublish.Publish(wgSaveMap, grpsWithMemsIds, loggedInUser.PersonId, ctxManager);

                return(publishResultMap);
            }

            return(wgSaveMap);
        }
Exemplo n.º 2
0
        private SaveMap ProcessWorkGroup(List <EntityInfo> workGroupInfos)
        {
            var publishingWgs = workGroupInfos
                                .Where(info => info.OriginalValuesMap.ContainsKey("MpSpStatus"))
                                .Select(info => info.Entity)
                                .OfType <WorkGroup>()
                                .Where(wg => wg.MpSpStatus == MpSpStatus.Published).ToList();

            var wgSaveMap = new Dictionary <Type, List <EntityInfo> > {
                { tWg, workGroupInfos }
            };

            if (!publishingWgs.Any())
            {
                return(wgSaveMap);
            }


            var svrWgIds         = publishingWgs.Select(wg => wg.WorkGroupId);
            var publishResultMap = WorkGroupPublish.Publish(wgSaveMap, svrWgIds, loggedInUserId, ctxManager);

            wgSaveMap.MergeMap(publishResultMap);

            return(wgSaveMap);
        }