public ValuesPerVideo() { Id = ""; Title = ""; Date = ""; Month = ""; Author = new UserValue(); Revisor = new UserValue(); Narrator = new UserValue(); Producer = new UserValue(); Total = 0; }
public ValuesPerVideo(RacLib.RacMsg msgs, LibVisLib.Article art, string userid) { Id = art.id; Title = art.title; Date = msgs.ShowDate(art.released); Month = art.released.Year.ToString("0000") + art.released.Month.ToString("00"); Total = 0; ArticleAction a0 = art.GetActionForType(ArticleAction.ActionType.Created); Author = new UserValue(); if (a0 != null && (userid == "" || a0.userId == userid)) { Author = new UserValue(a0); Total += Author.Value; } else { double val = ArticleAction.CalcRevenue(art, ArticleAction.ActionType.Created, art.wordCount, art.wordCount); Author = new UserValue(art, Profile.Administrator, val); Total += val; } ArticleAction a1 = art.GetActionForType(ArticleAction.ActionType.Revised); Revisor = new UserValue(); if (a1 != null && (userid == "" || a1.userId == userid)) { Revisor = new UserValue(a1); Total += Revisor.Value; } else { double val = ArticleAction.CalcRevenue(art, ArticleAction.ActionType.Revised, art.wordCount, art.wordCount); Revisor = new UserValue(art, Profile.Administrator, val); Total += val; } ArticleAction a2 = art.GetActionForType(ArticleAction.ActionType.IncludedNaration, art.finalNarratorId); Narrator = new UserValue(); if (a2 != null && (userid == "" || a2.userId == userid)) { Narrator = new UserValue(a2); Total += Narrator.Value; } else { double val = ArticleAction.CalcRevenue(art, ArticleAction.ActionType.IncludedNaration, art.wordCount, art.wordCount); Narrator = new UserValue(art, Profile.Administrator, val); Total += val; } ArticleAction a3 = art.GetActionForType(ArticleAction.ActionType.Produced); Producer = new UserValue(); if (a3 != null && (userid == "" || a3.userId == userid)) { Producer = new UserValue(a3); Total += Producer.Value; } else { double val = ArticleAction.CalcRevenue(art, ArticleAction.ActionType.Produced, art.wordCount, art.wordCount); Producer = new UserValue(art, Profile.Administrator, val); Total += val; } }