private void Apply(ReviewCreatedEvent @event)
 {
     Id      = @event.ReviewId;
     MovieId = @event.MovieId;
     UserId  = @event.UserId;
     Text    = @event.Text;
     Rating  = (RatingEnum)@event.Rating;
 }
Exemple #2
0
		public static Bitmap GetRatingImage(RatingEnum rating)
		{
			string resource = rating.ToString().ToLower() + ".bmp";
			Stream stream = GetResource(resource);
			if (stream == null)
			{
				return null;
			}
			Bitmap bmp = new Bitmap(stream);
			return bmp;		// NB: not transparent
		}
Exemple #3
0
    public static VideosResource.RateRequest.RatingEnum GetYTRating(this RatingEnum ratingEnum)
    {
        if (ratingEnum == RatingEnum.Like)
        {
            return(VideosResource.RateRequest.RatingEnum.Like);
        }
        if (ratingEnum == RatingEnum.Dislike)
        {
            return(VideosResource.RateRequest.RatingEnum.Dislike);
        }

        return(VideosResource.RateRequest.RatingEnum.None);
    }
        private ReviewAggregate(Guid userId, Guid movieId, string text, RatingEnum rating)
        {
            var @event = new ReviewCreatedEvent
            {
                ReviewId = Guid.NewGuid(),
                MovieId  = movieId,
                UserId   = userId,
                Text     = text,
                Rating   = (int)rating
            };

            Enqueue(@event);
            Apply(@event);
        }
Exemple #5
0
        public async Task SetRating(string videoId, RatingEnum rating)
        {
            if (string.IsNullOrEmpty(videoId))
            {
                return;
            }

            var request = _youTubeService.Videos.Rate(videoId, rating.GetYTRating());

            request.Key = _youTubeServiceControl.ApiKey;
            //request.OauthToken = _youTubeServiceControl.OAuthToken;

            var res = await request.ExecuteAsync();
        }
 public static ReviewAggregate CreateReview(Guid userId, Guid movieId, string text, RatingEnum rating)
 {
     return(new ReviewAggregate(userId, movieId, text, rating));
 }
Exemple #7
0
 public Task SetRating(string videoId, RatingEnum rating)
 {
     return(Task.Run(() => { }));
 }
Exemple #8
0
 public Restaurant(string name, string owner, int numberOfTables, RatingEnum rating)
     : base(name, owner)
 {
     NumberOfTables = numberOfTables;
     Rating         = rating;
 }
Exemple #9
0
 public RatingRef(RatingEnum rating)
 {
     Id   = rating;
     Name = rating.GetDescription();
 }
 public async Task SetRating(string videoId, RatingEnum rating)
 {
     await _remoteDataSource.SetRating(videoId, rating);
 }
		private void IterateContentItems(UIAction action, UIContentItem parent)
		{

			switch (Dialogs.Utilities.MapActionToActionType(action))
			{
			case "CLEAN":
				RemoveCommentsEnabled = true;
				RemoveTrackChangesEnabled = true;
				SkipOfficeCleaningEnabled = true;
				break;
			case "PDFCLEAN":
				SkipPdfCleaningEnabled = true;
				break;
			case "PDF":
				PDFOptionsEnabled = true;
				break;
			}

			foreach (UIPolicy policy in parent.Policies.Values)
			{
				if (!policy.Triggered)
				{
					continue;
				}
				if (!policy.Actions.Exists(item => item.Name == action.Name))
				{
					continue;
				}
				SortedList<string, List<UICondition>> conditions;
				m_triggeredPolicies.TryGetValue(parent.Id, out conditions);
				if (conditions == null)
				{
					conditions = new SortedList<string, List<UICondition>>();
					m_triggeredPolicies[parent.Id] = conditions;
				}
				if (conditions.ContainsKey(policy.Name))
				{
					continue;
				}

				List<UICondition> expressions = new List<UICondition>();
				foreach (UICondition condition in policy.Conditions.Values)
				{
					UIExpression expression = condition as UIExpression;
					if (expression != null)
					{
						expressions.Add(expression);
					}
				}
				conditions[policy.Name] = expressions;

				if (m_totalRiskRating < policy.HighestRating)
				{
					m_totalRiskRating = policy.HighestRating;
				}
			}

			foreach (UIContentItem contentItem in parent.ChildContentItems.Values)
			{
				IterateContentItems(action, contentItem);
			}
		}
		protected virtual void OnResponseChanged(EventArgs args)
		{
			if (m_response == null)
			{
				return;		// Scanning must be still in progress
			}

			RemoveCommentsEnabled = false;
			RemoveTrackChangesEnabled = false;
			SkipOfficeCleaningEnabled = false;
			SkipPdfCleaningEnabled = false;
			PDFOptionsEnabled = false;
			m_totalRiskRating = RatingEnum.Low;
			m_triggeredPolicies.Clear();

			IEnumerable<UIAction> actions = null;
			if (m_response.ContainsBlockingActions())
			{
				actions = m_response.BlockingActions;
				headerIconPictureBox.Image = Utilities.GetBitmap("block-icon.png");
			}
			else
			{
				actions = m_response.Actions.Values;
				headerIconPictureBox.Image = Utilities.GetBitmap("info-icon.png");
			}
			if (actions != null)
			{
				foreach (UIAction action in actions)
				{
					foreach (UIContentItem contentItem in action.ContentItems.Values)
					{
						IterateContentItems(action, contentItem);
					}
				}
			}

			CreateTriggeredPolicyControls();
		}
		/// <summary>
		/// Updates the risk rating (if the new rating is higher than the current rating)
		/// </summary>
		/// <param name="risk">The new risk rating</param>
		public void AddRisk(RatingEnum risk)
		{
			if (!HasRisk || Rating < risk)
			{
				Rating = risk;
			}
		}
Exemple #14
0
		public override void Initialize()
		{
			if (m_contentItem == null)
			{
				throw new InvalidOperationException("Cannot initialize, no ContentItem supplied");
			}

			if (m_action == null)
			{
				throw new InvalidOperationException("Cannot initialize, no Action supplied");
			}

			// Extract the general properties from the custom properties so that we can 
			// make them concrete.
			foreach (CustomProperty property in m_contentItem.Properties)
			{
				m_internalProperties[property.Name] = CloneCustomProperty(property);
			}

			m_actionPropertySet = new ActionPropertySet();

			foreach (Workshare.PolicyContent.ActionProperty actionProperty in m_protectAction.ActionProperties)
			{
				m_actionPropertySet[actionProperty.Name] = new ActionPropertyFacade(CloneActionProperty(actionProperty));
			}

			foreach (Workshare.PolicyContent.ActionProperty systemProperty in m_protectAction.SystemProperties)
			{
				m_actionPropertySet.SystemProperties[systemProperty.Name] = new ActionPropertyFacade(CloneActionProperty(systemProperty));
			}

			if (m_childContentItems != null)
			{
				foreach (UIContentItem child in m_childContentItems.Values)
				{
					child.Action = m_action;
					child.Initialize();
				}
			}

			m_rating = RatingEnum.Low;
			if (m_policies != null)
			{
				foreach (UIPolicy policy in m_policies.Values)
				{
					policy.Initialize();
					RatingEnum policyRisk = policy.HighestRating;
					if (m_rating < policyRisk)
					{
						m_rating = policyRisk;
					}
				}
			}
		}
Exemple #15
0
		public UIContentItem(ContentItem contentItem, Workshare.PolicyContent.Action action, bool container)
		{
			if (contentItem == null)
			{
				throw new ArgumentNullException("contentItem");
			}
			m_protectAction = action;
			m_container = container;
			m_contentItem = contentItem;
			m_rating = RatingEnum.Low;
			m_childContentItems = new Dictionary<string, UIContentItem>();
			m_policies = new Dictionary<string, UIPolicy>();
			m_selected = true;
		}