public static decimal DeleteMediaIndicator(Guid objectId, string objectType, string indicatorType, int userId, string aggregator) { try { decimal indicator = 0; SocialMediaIndicatorComponent socialMediaIndicatorComponent = new SocialMediaIndicatorComponent(objectId, objectType, indicatorType, userId); if (socialMediaIndicatorComponent.SocialMediaIndicator.SocialMediaIndicatorId != Guid.Empty) { socialMediaIndicatorComponent.Delete(); } indicator = Convert.ToInt32(SocialMediaIndicatorComponent.GetAggregatorSocialMediaIndicatorPerObjectRelated(objectId, objectType, indicatorType, aggregator)); return(indicator); } catch { return(-1); } }
public static int SetMediaIndicator(Guid objectId, int?userId, string indicatorType, string objectType, decimal value, string agregator) { try { int values = 0; SocialMediaIndicatorComponent socialMediaIndicatorComponent = new SocialMediaIndicatorComponent(objectId, objectType, indicatorType, userId); if (socialMediaIndicatorComponent.SocialMediaIndicator.SocialMediaIndicatorId == Guid.Empty) { socialMediaIndicatorComponent.SocialMediaIndicator.Value = value; socialMediaIndicatorComponent.SocialMediaIndicator.Created = DateTime.Now; socialMediaIndicatorComponent.SocialMediaIndicator.ObjectType = objectType; socialMediaIndicatorComponent.SocialMediaIndicator.IndicatorType = indicatorType; socialMediaIndicatorComponent.SocialMediaIndicator.Aggregator = agregator; return(socialMediaIndicatorComponent.Save()); } else { if (socialMediaIndicatorComponent.SocialMediaIndicator.ObjectType == objectType && socialMediaIndicatorComponent.SocialMediaIndicator.IndicatorType == indicatorType && socialMediaIndicatorComponent.SocialMediaIndicator.UserId == userId) { if (socialMediaIndicatorComponent.SocialMediaIndicator.Value != value) { socialMediaIndicatorComponent.SocialMediaIndicator.Value = value; return(socialMediaIndicatorComponent.Save()); } } } return(0); } catch { return(-1); } }