public SubscriptionHandler(Guid userId)
        {
            UserId = userId;

            nh            = new NumedicsGlobalHelpers();
            institutionId = MemoryMappings.GetAllInstitutions().Where(w => w.LegacySiteId == 20001).Select(s => s.InstitutionId).FirstOrDefault();// nh.GetInstitutionId(20001); // TODO: place in config file, because will change based on environment
        }
예제 #2
0
        private bool CanAddToContext(Guid userid, int subscriptionType, DateTime expiration, Guid institutionId)
        {
            if (institutionId == Guid.Empty)
            {
                return(false);
            }

            using (var ctx = new NuMedicsGlobalEntities())
            {
                if (MemoryMappings.GetAllInstitutions().Any(a => a.InstitutionId == institutionId))
                {
                    return(!ctx.Subscriptions.Any(a => a.UserId == userid && a.SubscriptionType == subscriptionType && a.ExpirationDate == expiration));
                }
                else
                {
                    return(false);
                }
            }
        }