Пример #1
0
        private void ValidateShow(Show newShow)
        {
            if (newShow == null)
                throw new NullReferenceException(StringsResource.NullShow);

            if (string.IsNullOrEmpty(newShow.Title))
                throw new ArgumentException(StringsResource.ShowMustHaveAName);
        }
Пример #2
0
        public int CreateShow(Show newShow)
        {
            ValidateShow(newShow);

            int res = showsManager.CreateShow(newShow);

            #region ClientNotifications
            //ClientNotifications
            string userName = string.Empty;
            if ((OperationContext.Current != null) && (OperationContext.Current.ServiceSecurityContext != null) && (OperationContext.Current.ServiceSecurityContext.PrimaryIdentity != null))
                userName = OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name;

            var clientRegistrations = MemoryRepository.Current.GetRegistrations(NotificationTypes.ShowNotification, userName);
            if (clientRegistrations.Length > 0)
                ClientNotificationsManager.SendNotifications(new ShowMessage()
                {
                    Content = "Show Created",
                    ShowID = newShow.ShowID
                }, clientRegistrations);

            #endregion

            return res;
        }