private void RemoveUpdateActions(int IdUser, List <dtoEvaluationLink> links)
        {
            List <long> IdItems = (from l in links select l.Id).ToList();
            List <ScormPackageToEvaluate> pendingLinks = (from l in CurrentManager.Linq <ScormPackageToEvaluate>()
                                                          where l.ToUpdate && IdItems.Contains(l.Id) && l.IdPerson == IdUser
                                                          select l).ToList();

            try {
                CurrentManager.BeginTransaction();

                if (pendingLinks.Count > 0)
                {
                    foreach (ScormPackageToEvaluate item in pendingLinks)
                    {
                        CurrentManager.Refresh(item);
                        if ((from l in links where l.Id == item.Id select l.ModifiedOn).FirstOrDefault() == item.ModifiedOn)
                        {
                            item.ToUpdate = false;
                        }
                    }
                }

                CurrentManager.Commit();
            }
            catch (Exception ex) {
                CurrentManager.RollBack();
            }
        }
Beispiel #2
0
        public List <dtoSubscriptionInfo> GetSubscriptionsInfo(String roles)
        {
            List <dtoSubscriptionInfo> subscriptions = new List <dtoSubscriptionInfo>();
            List <Int32> idRoles = GetIdRoles(roles);

            try
            {
                CurrentManager.BeginTransaction();
                foreach (Int32 idRole in idRoles)
                {
                    dtoSubscriptionInfo sub = new dtoSubscriptionInfo();
                    sub.IdRole = idRole;
                    sub.Count  = (from LazySubscription s in CurrentManager.GetIQ <LazySubscription>() where s.IdRole == idRole && s.Accepted && s.IdCommunity == UserContext.CurrentCommunityID select s.Id).Count();
                    subscriptions.Add(sub);
                }
                CurrentManager.Commit();
            }
            catch (Exception ex)
            {
                CurrentManager.RollBack();
            }
            return(subscriptions);
        }