示例#1
0
        public void ReassignDealsResponsible(Guid fromUserId, Guid toUserId)
        {
            var deals = GetDeals(String.Empty,
                                 fromUserId,
                                 0,
                                 null,
                                 0,
                                 DealMilestoneStatus.Open,
                                 null,
                                 DateTime.MinValue,
                                 DateTime.MinValue,
                                 0,
                                 0,
                                 null);

            foreach (var deal in deals)
            {
                deal.ResponsibleID = toUserId;

                EditDeal(deal);

                var responsibles = _crmSecurity.GetAccessSubjectGuidsTo(deal);

                if (!responsibles.Any())
                {
                    continue;
                }

                responsibles.Remove(fromUserId);
                responsibles.Add(toUserId);

                _crmSecurity.SetAccessTo(deal, responsibles.Distinct().ToList());
            }
        }
示例#2
0
        public void ReassignCasesResponsible(Guid fromUserId, Guid toUserId)
        {
            var cases = GetAllCases();

            foreach (var item in cases)
            {
                var responsibles = _crmSecurity.GetAccessSubjectGuidsTo(item);

                if (!responsibles.Any())
                {
                    continue;
                }

                responsibles.Remove(fromUserId);
                responsibles.Add(toUserId);

                _crmSecurity.SetAccessTo(item, responsibles.Distinct().ToList());
            }
        }