Exemple #1
0
        /// <summary>
        /// Retorna últimos artigos por categoria
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="category"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        static public List <ArticleModel> LatestArticlesForTranslation(int lang, string userid, int ini, int max)
        {
            if (lang < 3 || lang > 4)
            {
                lang = 2;
            }

            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Article> nn = Article.GetLastArticlesForTranslation(lang, ini, max);

            List <ArticleModel> lst = new List <ArticleModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                ArticleModel v = new ArticleModel(msgs, nn[i], false, false, false, true, true, false, false);

                if (userid != null && userid != "")
                {
                    v.UserVote = (int)nn[i].GetUserVote(userid);
                }

                lst.Add(v);
            }

            return(lst);
        }
Exemple #2
0
 public ArticleActionObservationModel(RacLib.RacMsg msgs, ArticleActionObservation n)
 {
     Observation  = n.observation;
     IncludedBy   = n.includeddByName;
     Included     = msgs.ShowDate(n.included);
     IncludedById = n.userId;
 }
Exemple #3
0
 public ArticleCommentModel(RacLib.RacMsg msgs, ArticleComment n)
 {
     Id           = n.id;
     Comment      = n.comment;
     IncludedBy   = n.userName;
     Included     = msgs.ShowDate(n.date);
     IncludedById = n.userId;
 }
Exemple #4
0
        public NewsStatisticModel(RacLib.RacMsg msgs, Statistics ns)
        {
            switch (ns.realm)
            {
            case Statistics.Realm.Youtube:
                Realm = "Youtube";
                break;

            case Statistics.Realm.Bitchute:
                Realm = "Bitchute";
                break;

            case Statistics.Realm.Facebook:
                Realm = "Facebook";
                break;

            case Statistics.Realm.Minds:
                Realm = "Minds";
                break;

            case Statistics.Realm.Twitter:
                Realm = "Twitter";
                break;

            case Statistics.Realm.Gabai:
                Realm = "Gab";
                break;

            case Statistics.Realm.Site:
                Realm = msgs.Get(RacLib.RacMsg.Id.LibertarianViewSiteName);
                break;
            }

            switch (ns.parameter)
            {
            case Statistics.Parameter.Subscribers:
                Parameter = msgs.Get(RacLib.RacMsg.Id.Subscribers);
                break;

            case Statistics.Parameter.Views:
                Parameter = msgs.Get(RacLib.RacMsg.Id.Views);
                break;
            }

            ImageLink = ns.icon;
            Value     = ns.value;
            Units     = ns.units;
            Link      = ns.link;
        }
Exemple #5
0
        public VideoValue(RacLib.RacMsg msgs, Article a, ArticleAction.ActionType at, double val)
        {
            Id    = "";
            Title = "";
            Date  = "";
            Role  = "";
            Value = 0.0;

            if (a != null)
            {
                Id    = a.id;
                Title = a.title;
                Date  = msgs.ShowDate(a.released);

                switch (at)
                {
                case ArticleAction.ActionType.Suggested:
                    Role = msgs.Get(RacLib.RacMsg.Id.Suggested);
                    break;

                case ArticleAction.ActionType.Created:
                    Role = msgs.Get(RacLib.RacMsg.Id.Writer);
                    break;

                case ArticleAction.ActionType.Approved:
                    Role = msgs.Get(RacLib.RacMsg.Id.Approver);
                    break;

                case ArticleAction.ActionType.Revised:
                    Role = msgs.Get(RacLib.RacMsg.Id.Revisor);
                    break;

                case ArticleAction.ActionType.IncludedNaration:
                    Role = msgs.Get(RacLib.RacMsg.Id.Narrator);
                    break;

                case ArticleAction.ActionType.Produced:
                    Role = msgs.Get(RacLib.RacMsg.Id.Producer);
                    break;

                case ArticleAction.ActionType.Published:
                    Role = msgs.Get(RacLib.RacMsg.Id.Publisher);
                    break;
                }

                Value = val;
            }
        }
Exemple #6
0
        /// <summary>
        /// Retorna últimos vídeos para o usuário
        /// </summary>
        /// <param name="id"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        static public List <VideoModel> LatestVideosForUser(string id, int lang, int ini, int max)
        {
            lang = LibVisLib.Verify.ValidLanguage(lang);
            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Video> nv = Video.GetLastVideosForUser(id, ini, max);

            List <VideoModel> lst = new List <VideoModel>();

            for (int i = 0; i < nv.Count; i++)
            {
                lst.Add(new VideoModel(msgs, nv[i], false, true, true, false));
            }

            return(lst);
        }
Exemple #7
0
        /// <summary>
        /// Retorna últimas notícias por categoria
        /// </summary>
        /// <param name="categ"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        static public List <VideoModel> LatestVideosByCategory(int lang, string categ, int ini, int max, string search = "")
        {
            lang = LibVisLib.Verify.ValidLanguage(lang);
            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Video> nn = Video.GetLastVideos(lang, categ, ini, max, search);

            List <VideoModel> lst = new List <VideoModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                lst.Add(new VideoModel(msgs, nn[i], false, true, true, false));
            }

            return(lst);
        }
Exemple #8
0
        /// <summary>
        /// Retorna últimos artigos por categoria
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="category"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        static public List <AccountModel> GetUsers(int lang, int ini, int max, string search = "")
        {
            lang = LibVisLib.Verify.ValidLanguage(lang);
            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Profile> nn = Profile.GetUsers(ini, max, search);

            List <AccountModel> lst = new List <AccountModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                AccountModel v = new AccountModel(nn[i], false, true);
                lst.Add(v);
            }

            return(lst);
        }
Exemple #9
0
        /// <summary>
        /// Retorna pautas do usuário
        /// </summary>
        /// <param name="id"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        static public List <TargetModel> LatestTargetForUser(string id, int lang, int ini, int max, DateTime n)
        {
            lang = LibVisLib.Verify.ValidLanguage(lang);
            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Target> nn = Target.GetLastTargetsForUser(id, ini, max, n);

            List <TargetModel> lst = new List <TargetModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                TargetModel v = new TargetModel(msgs, nn[i], false, true, true, false);
                v.UserVote = (int)nn[i].GetUserVote(id);

                lst.Add(v);
            }

            return(lst);
        }
Exemple #10
0
        public ValuesPerUser(RacLib.RacMsg msgs, Article a, ArticleAction.ActionType at, double val, Profile prf)
        {
            Id          = "";
            Name        = "";
            Bicoin      = "";
            Month       = "";
            Description = "";
            Values      = new List <VideoValue>();

            Id     = prf.user.id;
            Name   = prf.user.name;
            Bicoin = prf.bitcoin;
            Month  = msgs.ShowDate(a.released);

            VideoValue vv = new VideoValue(msgs, a, at, val);

            Values.Add(vv);

            Total = 0;
        }
Exemple #11
0
        /// <summary>
        /// Retorna as últimas notícias na versão V2
        /// </summary>
        /// <param name="max"></param>
        /// <returns></returns>
        static public List <ArticleModel> LatestArticles(int lang, int max)
        {
            if (lang < 3 || lang > 4)
            {
                lang = 2;
            }

            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Article> nn = Article.GetLastArticles(lang, "", "", 0, max, 0);

            List <ArticleModel> lst = new List <ArticleModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                lst.Add(new ArticleModel(msgs, nn[i], false, false, false, true, true, false, false));
            }

            return(lst);
        }
Exemple #12
0
        /// <summary>
        /// Retorna as estatísticas
        /// </summary>
        /// <returns></returns>
        static public List <NewsStatisticModel> GetStatistics(int lang)
        {
            if (lang < 3 || lang > 4)
            {
                lang = 2;
            }

            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Statistics> nv = Statistics.GetStatistics(lang);

            List <NewsStatisticModel> lst = new List <NewsStatisticModel>();

            for (int i = 0; i < nv.Count && i < 6; i++)
            {
                lst.Add(new NewsStatisticModel(msgs, nv[i]));
            }

            return(lst);
        }
Exemple #13
0
        /// <summary>
        /// Retorna as últimas notícias
        /// </summary>
        /// <param name="max"></param>
        /// <param name="numperrow"></param>
        /// <returns></returns>
        static public List <ArticleRowModel> LatestArticlesInRow(int lang, int max, int numperrow)
        {
            if (lang < 3 || lang > 4)
            {
                lang = 2;
            }

            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Article> nn = Article.GetLastArticles(lang, "", "", 0, max, 0);

            int nl = nn.Count / numperrow;

            if (nn.Count % numperrow != 0)
            {
                nl++;
            }

            int c = 0;

            List <ArticleRowModel> lst = new List <ArticleRowModel>();

            for (int i = 0; i < nl; i++)
            {
                ArticleRowModel nr = new ArticleRowModel();
                lst.Add(nr);

                for (int j = 0; j < numperrow && c < nn.Count; j++)
                {
                    nr.Articles.Add(new ArticleModel(msgs, nn[c++], false, false, false, true, true, false, false));
                }

                if (c >= nn.Count)
                {
                    break;
                }
            }

            return(lst);
        }
Exemple #14
0
        public ValuesPerVideoPerUser(RacLib.RacMsg msgs, LibVisLib.ArticleAction act)
        {
            Id    = act.id;
            Title = act.article.title;
            Date  = msgs.ShowDate(act.article.released);

            switch (act.type)
            {
            case ArticleAction.ActionType.Suggested:
                Role = msgs.Get(RacLib.RacMsg.Id.Suggested);
                break;

            case ArticleAction.ActionType.Created:
                Role = msgs.Get(RacLib.RacMsg.Id.Writer);
                break;

            case ArticleAction.ActionType.Approved:
                Role = msgs.Get(RacLib.RacMsg.Id.Approver);
                break;

            case ArticleAction.ActionType.Revised:
                Role = msgs.Get(RacLib.RacMsg.Id.Revisor);
                break;

            case ArticleAction.ActionType.IncludedNaration:
                Role = msgs.Get(RacLib.RacMsg.Id.Narrator);
                break;

            case ArticleAction.ActionType.Produced:
                Role = msgs.Get(RacLib.RacMsg.Id.Producer);
                break;

            case ArticleAction.ActionType.Published:
                Role = msgs.Get(RacLib.RacMsg.Id.Publisher);
                break;
            }

            Word  = act.billableWords;
            Total = act.value;
        }
Exemple #15
0
        public ArticleLinkModel(RacLib.RacMsg msgs, ArticleLink n)
        {
            Type        = (int)n.type;
            TypeName    = "";
            Link        = n.link;
            Description = n.description;

            switch (n.type)
            {
            case ArticleLink.LinkType.ExternalLink:
                TypeName = msgs.Get(RacLib.RacMsg.Id.ExternalLink);
                break;

            case ArticleLink.LinkType.Image:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Image);
                break;

            case ArticleLink.LinkType.Video:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Video);
                break;
            }
        }
Exemple #16
0
        public ValuesPerUser(RacLib.RacMsg msgs, ArticleAction aa)
        {
            Id          = "";
            Name        = "";
            Bicoin      = "";
            Month       = "";
            Description = "";
            Values      = new List <VideoValue>();

            if (aa != null)
            {
                Id     = aa.userId;
                Name   = aa.userName;
                Bicoin = aa.profile.bitcoin;
                Month  = msgs.ShowDate(aa.date);

                VideoValue vv = new VideoValue(msgs, aa);
                Values.Add(vv);
            }

            Total = 0;
        }
Exemple #17
0
        /// <summary>
        /// Retorna últimos artigos por categoria
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="category"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        static public List <ArticleModel> LatestArticlesByCategory(int lang, string userid, string category, int ini, int max, int sts, string search = "")
        {
            lang = LibVisLib.Verify.ValidLanguage(lang);
            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Article> nn = Article.GetLastArticles(lang, userid, category, ini, max, sts, search);

            List <ArticleModel> lst = new List <ArticleModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                ArticleModel v = new ArticleModel(msgs, nn[i], false, false, false, true, true, false, false);

                if (userid != null && userid != "")
                {
                    v.UserVote = (int)nn[i].GetUserVote(userid);
                }

                lst.Add(v);
            }

            return(lst);
        }
Exemple #18
0
        /// <summary>
        /// Retorna as pautas por categoria
        /// </summary>
        /// <param name="categ"></param>
        /// <param name="onlyValid"></param>
        /// <param name="ini"></param>
        /// <param name="max"></param>
        /// <param name="userid"></param>
        /// <param name="lastdate"></param>
        /// <returns></returns>
        static public List <TargetModel> LatestTargetByCategory(int lang, string categ, bool onlyValid, int ini, int max, string userid, DateTime lastdate, string search = "")
        {
            lang = LibVisLib.Verify.ValidLanguage(lang);
            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage((RacLib.RacMsg.Language)lang);

            List <Target> nn = Target.GetLastTargets(lang, categ, onlyValid, ini, max, lastdate, search);

            List <TargetModel> lst = new List <TargetModel>();

            for (int i = 0; i < nn.Count; i++)
            {
                TargetModel v = new TargetModel(msgs, nn[i], false, true, true, false);

                if (userid != null && userid != "")
                {
                    v.UserVote = (int)nn[i].GetUserVote(userid);
                }

                lst.Add(v);
            }

            return(lst);
        }
Exemple #19
0
        public AccountModel(LibVisLib.Profile p, bool isOwn, bool isInternal)
        {
            Id      = p.user.id;
            Email   = p.user.email;
            Name    = p.user.name;
            Profile = (int)p.user.GetProfileForInternalSystem(RacLib.InternalSystem.LibVisId);

            RacLib.RacMsg msgs = RacLib.RacMsg.cache.GetMessage(p.user.defaultLanguage);

            if (isOwn || isInternal)
            {
                Bitcoin = p.bitcoin;
            }
            else
            {
                Bitcoin = "";
            }

            ProfileName = msgs.Get(RacLib.RacMsg.Id.Anonymous);

            if (p.user.GetProfileForInternalSystem(RacLib.InternalSystem.LibVisId) >= RacLib.BaseUser.InternalSystemProfile.Public)
            {
                ProfileName = ProfileName = msgs.Get(RacLib.RacMsg.Id.User);
            }

            if (p.user.GetProfileForInternalSystem(RacLib.InternalSystem.LibVisId) >= RacLib.BaseUser.InternalSystemProfile.InternalStaff)
            {
                ProfileName = ProfileName = msgs.Get(RacLib.RacMsg.Id.Internal);
            }

            if (p.user.GetProfileForInternalSystem(RacLib.InternalSystem.LibVisId) >= RacLib.BaseUser.InternalSystemProfile.Administrator)
            {
                ProfileName = ProfileName = msgs.Get(RacLib.RacMsg.Id.Administrator);
            }

            if (isOwn || isInternal)
            {
                NewsLetter = p.newsLetter;

                p.CheckMedals();

                Xp     = (int)p.xp;
                NextXp = (int)p.nextXp;
                Ap     = (int)p.ap;
                NextAp = (int)p.nextAp;
                Rp     = (int)p.rp;
                NextRp = (int)p.nextRp;
                Op     = (int)p.op;
                NextOp = (int)p.nextOp;
                Qp     = (int)p.qp;
                NextQp = (int)p.nextQp;
                Tp     = (int)p.tp;
                NextTp = (int)p.nextTp;
                Up     = (int)p.up;
                NextUp = (int)p.nextUp;
                Sp     = (int)p.sp;
                NextSp = (int)p.nextSp;
                Ep     = (int)p.ep;
                NextEp = (int)p.nextEp;
            }
            else
            {
                Xp     = 0;
                NextXp = 0;
                Ap     = 0;
                NextAp = 0;
                Rp     = 0;
                NextRp = 0;
                Op     = 0;
                NextOp = 0;
                Qp     = 0;
                NextQp = 0;
                Tp     = 0;
                NextTp = 0;
                Up     = 0;
                NextUp = 0;
                Sp     = 0;
                NextSp = 0;
                Ep     = 0;
                NextEp = 0;
            }

            Medals = new List <MedalsModel>();

            for (int i = 0; i < p.medals.Count; i++)
            {
                MedalsModel m = new MedalsModel(msgs, p.medals[i].medals);
                Medals.Add(m);
            }

            Payments = new List <PaymentModel>();

            if (isOwn || isInternal)
            {
                for (int i = 0; i < p.payments.Count; i++)
                {
                    PaymentModel pa = new PaymentModel(p.payments[i]);
                    Payments.Add(pa);
                }
            }

            Videos = new List <ValuesPerVideoPerUser>();
            Value  = 0;
            if (isOwn || isInternal)
            {
                int year  = DateTime.Now.Year;
                int month = DateTime.Now.Month;

                DateTime start = new DateTime(year, month, 1);
                DateTime end   = new DateTime(year, month, DateTime.DaysInMonth(year, month), 23, 59, 59);

                List <LibVisLib.Article> articles = LibVisLib.Article.ListPublishedArticlesForInterval(Id, start, end);

                double val = 0;

                for (int i = 0; i < articles.Count; i++)
                {
                    Article art = articles[i];

                    ArticleAction a0 = art.GetActionForType(ArticleAction.ActionType.Created);

                    if (a0 != null && a0.userId == Id)
                    {
                        ValuesPerVideoPerUser a = new ValuesPerVideoPerUser(msgs, a0);
                        Videos.Add(a);
                        val += a.Total;
                    }

                    ArticleAction a1 = art.GetActionForType(ArticleAction.ActionType.Revised);

                    if (a1 != null && a1.userId == Id)
                    {
                        ValuesPerVideoPerUser a = new ValuesPerVideoPerUser(msgs, a1);
                        Videos.Add(a);
                        val += a.Total;
                    }

                    ArticleAction a2 = art.GetActionForType(ArticleAction.ActionType.IncludedNaration, art.finalNarratorId);

                    if (a2 != null && a2.userId == Id)
                    {
                        ValuesPerVideoPerUser a = new ValuesPerVideoPerUser(msgs, a2);
                        Videos.Add(a);
                        val += a.Total;
                    }

                    ArticleAction a3 = art.GetActionForType(ArticleAction.ActionType.Produced);

                    if (a3 != null && a3.userId == Id)
                    {
                        ValuesPerVideoPerUser a = new ValuesPerVideoPerUser(msgs, a3);
                        Videos.Add(a);
                        val += a.Total;
                    }
                }

                Value = val;
            }

            TotalQualification    = p.GetTotalQualification(msgs);
            EditorQualification   = p.GetEditorQualification(msgs);
            ReporterQualification = p.GetReporterQualification(msgs);

            if (EditorQualification != "" && ReporterQualification != "")
            {
                GeneralQualification = EditorQualification + ", " + ReporterQualification;
            }
            else
            {
                GeneralQualification = EditorQualification + ReporterQualification;
            }

            if (Profile >= 9)
            {
                GeneralQualification += ((GeneralQualification != "") ? " " : "") + "(Admin)";
                Staff = 1;
                Admin = 1;
            }
            else if (Profile >= 7)
            {
                GeneralQualification += ((GeneralQualification != "") ? " " : "") + "(Staff)";
                Staff = 1;
            }
            else
            {
                Staff = p.staff ? 1 : 0;
            }

            Lang = p.user.defaultLanguageId;

            RoleTranslatorEn = p.translatorEnglish ? 1 : 0;
            RoleTranslatorPt = p.translatorPortuguese ? 1 : 0;
            RoleTranslatorEs = p.translatorSpanish ? 1 : 0;

            RoleRevisorEn = p.revisorEnglish ? 1 : 0;
            RoleRevisorPt = p.revisorPortuguese ? 1 : 0;
            RoleRevisorEs = p.revisorSpanish ? 1 : 0;

            RoleNarratorEn = p.narratorEnglish ? 1 : 0;
            RoleNarratorPt = p.narratorPortuguese ? 1 : 0;
            RoleNarratorEs = p.narratorSpanish ? 1 : 0;

            RoleProducerEn = p.producerEnglish ? 1 : 0;
            RoleProducerPt = p.producerPortuguese ? 1 : 0;
            RoleProducerEs = p.producerSpanish ? 1 : 0;

            Sponsor = p.sponsor ? 1 : 0;

            Blocked      = p.user.isBlocked || p.user.isDisabled ? 1 : 0;
            NotConfirmed = p.user.isConfirmed ? 0 : 1;

            if (p.user.defaultLanguage == RacLib.RacMsg.Language.Portugues)
            {
                Translator = p.translatorPortuguese ? 1 : 0;
                Revisor    = p.revisorPortuguese ? 1 : 0;
                Narrator   = p.narratorPortuguese ? 1 : 0;
                Producer   = p.producerPortuguese ? 1 : 0;
            }
            else if (p.user.defaultLanguage == RacLib.RacMsg.Language.Espanol)
            {
                Translator = p.translatorSpanish ? 1 : 0;
                Revisor    = p.revisorSpanish ? 1 : 0;
                Narrator   = p.narratorSpanish ? 1 : 0;
                Producer   = p.producerSpanish ? 1 : 0;
            }
            else
            {
                Translator = p.translatorEnglish ? 1 : 0;
                Revisor    = p.revisorEnglish ? 1 : 0;
                Narrator   = p.narratorEnglish ? 1 : 0;
                Producer   = p.producerEnglish ? 1 : 0;
            }
        }
Exemple #20
0
        public ArticleModel(RacLib.RacMsg msgs, Article nv, bool incText, bool incComment, bool incTarg, bool incAuth, bool incCateg, bool incLink, bool incAct)
        {
            Id    = nv.id;
            Title = nv.title;

            StartingText = (nv.text.Length < 300) ? nv.text : nv.text.Substring(0, 300);

            if (incText)
            {
                Text       = nv.text;
                Paragraphs = nv.text.Split('\n').ToList();
            }
            else
            {
                Text       = "";
                Paragraphs = new List <string>();
            }

            if (incTarg && nv.target != null)
            {
                Target = new TargetModel(msgs, nv.target, false, false, false, false);
            }
            else
            {
                Target = new TargetModel();
            }

            Comments = new List <ArticleCommentModel>();

            if (incComment)
            {
                for (int i = 0; i < nv.comments.Count; i++)
                {
                    Comments.Add(new ArticleCommentModel(msgs, nv.comments[i]));
                }
            }

            Authors = new AuthorInfo();

            if (incAuth)
            {
                Authors.Date       = msgs.ShowDate(nv.released);
                Authors.DateLabel  = msgs.Get(RacLib.RacMsg.Id.In);
                Authors.StatusText = "";

                Authors.SuggestedLabel = msgs.Get(RacLib.RacMsg.Id.Suggested);
                Authors.AuthoredLabel  = msgs.Get(RacLib.RacMsg.Id.Written);
                Authors.RevisedLabel   = msgs.Get(RacLib.RacMsg.Id.Revised);
                Authors.NarratedLabel  = msgs.Get(RacLib.RacMsg.Id.Narrated);
                Authors.ProducedLabel  = msgs.Get(RacLib.RacMsg.Id.Produced);

                Authors.Suggested = new UserIdModel(nv.suggestedId, nv.suggested);
                Authors.Authored  = new UserIdModel(nv.authoredId, nv.authored);
                Authors.Revised   = new UserIdModel(nv.revisedId, nv.revised);
                Authors.Narrated  = new UserIdModel(nv.narratedId, nv.narrated);
                Authors.Produced  = new UserIdModel(nv.producedId, nv.produced);
            }

            Links = new List <ArticleLinkModel>();

            if (incLink)
            {
                for (int i = 0; i < nv.links.Count; i++)
                {
                    Links.Add(new ArticleLinkModel(msgs, nv.links[i]));
                }
            }

            Actions = new List <ArticleActionModel>();
            if (incAct)
            {
                for (int i = 0; i < nv.actions.Count; i++)
                {
                    Actions.Add(new ArticleActionModel(msgs, nv.actions[i]));
                }
            }

            preferredRevisor  = nv.preferredRevisorId;
            preferredNarrator = nv.preferredNarratorId;
            preferredProducer = nv.preferredProducerId;

            beingRevised  = nv.beingRevisedId;
            beingNarrated = nv.beingNarratedId;
            beingProduced = nv.beingProducedId;

            preferredRevisorName  = nv.preferredRevisorName;
            preferredNarratorName = nv.preferredNarratorName;
            preferredProducerName = nv.preferredProducerName;

            beingRevisedName  = nv.beingRevisedName;
            beingNarratedName = nv.beingNarratedName;
            beingProducedName = nv.beingProducedName;

            Categories = new CategInfo();
            if (incCateg)
            {
                Categories.Categories = new List <NewsCategory>();
                for (int i = 0; i < nv.categories.Count; i++)
                {
                    NewsCategory nc = new NewsCategory();
                    nc.Label    = nv.categories[i];
                    nc.Category = msgs.Get(Category.GetNameForLabel(nc.Label));

                    Categories.Categories.Add(nc);
                }

                Categories.MainCategory = new NewsCategory();
                if (Categories.Categories.Count > 0)
                {
                    Categories.MainCategory = Categories.Categories[0];
                }
            }

            VoteApprove = nv.voteApproved;
            VoteNot     = nv.voteDontLike;
            VoteAlready = nv.voteAlreadyWritten;
            VotePoorly  = nv.votePoorlyWritten;

            UserVote = 0;

            Status          = (int)nv.status;
            StatusNarration = (int)nv.statusNarration;
            Type            = (int)nv.type;
            ArticleType     = (int)nv.textSizeType;

            switch (nv.status)
            {
            case Article.ArticleStatus.Created:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.WaitingApproval);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Written);
                break;

            case Article.ArticleStatus.Approved:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.WaitingRevision);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Approved);
                break;

            case Article.ArticleStatus.Revised:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.WaitingNarration);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Revised);
                break;

            case Article.ArticleStatus.Ready:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.WaitingProduction);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Narrated);
                break;

            case Article.ArticleStatus.Produced:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.WaitingPublishing);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Produced);
                break;

            case Article.ArticleStatus.Published:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.Published);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Published);
                break;

            case Article.ArticleStatus.Removed:
                StatusName         = msgs.Get(RacLib.RacMsg.Id.Removed);
                Authors.StatusText = msgs.Get(RacLib.RacMsg.Id.Removed);
                break;
            }

            switch (nv.statusNarration)
            {
            case Article.ArticleNarrationStatus.Undefined:
                StatusNarrationName = "Aguardando";
                break;


            case Article.ArticleNarrationStatus.Created:
                StatusNarrationName = "Submetido";
                break;

            case Article.ArticleNarrationStatus.Approved:
                StatusNarrationName = "Aprovado";
                break;
            }

            switch (nv.type)
            {
            case Article.ArticleType.ShortNote:
                TypeName = "Tapa Libertário";
                break;

            case Article.ArticleType.Note:
                TypeName = "Nota Libertária";
                break;

            case Article.ArticleType.Article:
                TypeName = "Artigo";
                break;

            case Article.ArticleType.Script:
                TypeName = "Script";
                break;

            case Article.ArticleType.Chronicle:
                TypeName = "Crônica";
                break;

            case Article.ArticleType.Interview:
                TypeName = "Entrevista";
                break;
            }

            switch (nv.textSizeType)
            {
            case Article.TextSizeType.TooShort:
            case Article.TextSizeType.ShortNote:
                ArticleTypeName = "Tapa Libertário";
                break;

            case Article.TextSizeType.Note:
                ArticleTypeName = "Nota Libertária";
                break;

            case Article.TextSizeType.Article:
            case Article.TextSizeType.TooLong:
                ArticleTypeName = "Artigo";
                break;

            default:
                ArticleTypeName = "N/D";
                break;
            }
        }
Exemple #21
0
 public ArticleActionGantModel(RacLib.RacMsg msgs, ArticleActionGrant n)
 {
     AwardId   = n.awardId;
     GrantedBy = n.grantedByName;
     Granted   = msgs.ShowDate(n.granted);
 }
Exemple #22
0
 public NewsCategory(RacLib.RacMsg msgs, LibVisLib.Category c)
 {
     Label    = c.label;
     Category = msgs.Get(c.nameMsg);
 }
Exemple #23
0
        public ArticleActionModel(RacLib.RacMsg msgs, ArticleAction n)
        {
            Id            = n.id;
            UserId        = n.userId;
            UserName      = n.userName;
            Type          = (int)n.type;
            Observation   = n.observation;
            Date          = msgs.ShowDate(n.date);
            BillableWords = n.billableWords;

            Audios = new List <ArticleActionAudioModel>();

            if (n.type == ArticleAction.ActionType.IncludedNaration)
            {
                int na = n.CheckNumberAudioFiles();
                for (int i = 0; i < na; i++)
                {
                    ArticleActionAudioModel aaa = new ArticleActionAudioModel();

                    aaa.FileName  = n.GetAttachFileName(i);
                    aaa.MimeType  = n.GetAttachFileType(i);
                    aaa.Extension = "." + (aaa.FileName.Length > 3 ? aaa.FileName.Substring(aaa.FileName.Length - 3) : aaa.FileName);

                    Audios.Add(aaa);
                }
            }

            switch (n.type)
            {
            case ArticleAction.ActionType.Suggested:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Suggested);
                break;

            case ArticleAction.ActionType.Created:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Created);
                break;

            case ArticleAction.ActionType.Approved:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Approved);
                break;

            case ArticleAction.ActionType.Revised:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Revised);
                break;

            case ArticleAction.ActionType.IncludedNaration:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Narrated);
                break;

            case ArticleAction.ActionType.Produced:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Produced);
                break;

            case ArticleAction.ActionType.Published:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Published);
                break;

            case ArticleAction.ActionType.Removed:
                TypeName = msgs.Get(RacLib.RacMsg.Id.Removed);
                break;
            }

            Grants = new List <ArticleActionGantModel>();

            for (int i = 0; i < n.grants.Count; i++)
            {
                Grants.Add(new ArticleActionGantModel(msgs, n.grants[i]));
            }

            Observations = new List <ArticleActionObservationModel>();

            for (int i = 0; i < n.observations.Count; i++)
            {
                Observations.Add(new ArticleActionObservationModel(msgs, n.observations[i]));
            }
        }
Exemple #24
0
 public MedalsModel(RacLib.RacMsg msgs, LibVisLib.Medal m)
 {
     Id          = m.id;
     Name        = msgs.Get(m.nameMsg);
     Description = msgs.Get(m.descriptionMsg);
 }
Exemple #25
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;
            }
        }
Exemple #26
0
        public TargetModel(RacLib.RacMsg msgs, Target nt, bool incText, bool incCateg, bool incAuth, bool incAct)
        {
            Id           = nt.id;
            Title        = nt.title;
            Link         = nt.link;
            StartingText = (nt.text.Length < 300) ? nt.text : nt.text.Substring(0, 300);

            if (incText)
            {
                Text       = nt.text;
                Paragraphs = nt.text.Split('\n').ToList();
            }
            else
            {
                Text       = "";
                Paragraphs = new List <string>();
            }

            Authors = new AuthorInfo();

            if (incAuth)
            {
                Authors.SuggestedLabel = msgs.Get(RacLib.RacMsg.Id.SuggestedBy);
                Authors.AuthoredLabel  = msgs.Get(RacLib.RacMsg.Id.SuggestedBy);

                Authors.Date       = msgs.ShowDate(nt.registered);
                Authors.DateLabel  = msgs.Get(RacLib.RacMsg.Id.Registered2);
                Authors.StatusText = "";

                Authors.Authored = new UserIdModel(nt.authorId, nt.author);
            }

            Actions = new List <TargetActionModel>();
            if (incAct)
            {
                for (int i = 0; i < nt.actions.Count; i++)
                {
                    Actions.Add(new TargetActionModel(nt.actions[i]));
                }
            }

            Categories = new CategInfo();
            if (incCateg)
            {
                Categories.Categories = new List <NewsCategory>();
                for (int i = 0; i < nt.categories.Count; i++)
                {
                    NewsCategory nc = new NewsCategory();
                    nc.Label    = nt.categories[i];
                    nc.Category = msgs.Get(Category.GetNameForLabel(nc.Label));

                    Categories.Categories.Add(nc);
                }

                Categories.MainCategory = new NewsCategory();
                if (Categories.Categories.Count > 0)
                {
                    Categories.MainCategory = Categories.Categories[0];
                }
            }

            VoteWrite = nt.voteWillWriteArticle;
            VoteVery  = nt.voteVeryGood;
            VoteGood  = nt.voteGood;
            VoteNot   = nt.voteNotInteresting;
            VoteOld   = nt.voteOldNews;
            VoteFake  = nt.voteFalseFact;

            UserVote = 0;

            Status     = 1;
            StatusName = "Registrado";

            AssociatedArticleId    = "";
            AssociatedArticleTitle = "";

            Article art = Article.ArticleFromTarget(nt.id);

            if (art != null)
            {
                Status     = 2;
                StatusName = "Já usado";

                AssociatedArticleId    = art.id;
                AssociatedArticleTitle = art.title;
            }
        }
Exemple #27
0
        public VideoModel(RacLib.RacMsg msgs, Video nv, bool incText, bool incCateg, bool incAuth, bool incAct)
        {
            Id    = nv.id;
            Title = nv.title;

            YoutubeLink  = nv.linkYoutube;
            BitchuteLink = nv.linkBitchute;

            StartingDescription = (nv.description.Length < 300) ? nv.description : nv.description.Substring(0, 300);

            if (incText)
            {
                Description     = nv.description;
                Script          = nv.script;
                DescriptionPars = nv.description.Split('\n').ToList();
                ScriptPars      = nv.script.Split('\n').ToList();
            }
            else
            {
                Description     = "";
                Script          = "";
                DescriptionPars = new List <string>();
                ScriptPars      = new List <string>();
            }

            Authors = new AuthorInfo();

            if (incAuth)
            {
                Authors.AuthoredLabel = "Produzido por";

                Authors.Date      = nv.released.ToString("dd/MM/yyyy");
                Authors.DateLabel = "em";

                Authors.Authored = new UserIdModel(nv.authorId, nv.author);
            }

            Actions = new List <VideoActionModel>();
            if (incAct)
            {
                for (int i = 0; i < nv.actions.Count; i++)
                {
                    Actions.Add(new VideoActionModel(nv.actions[i]));
                }
            }

            Categories = new CategInfo();
            if (incCateg)
            {
                Categories.Categories = new List <NewsCategory>();
                for (int i = 0; i < nv.categories.Count; i++)
                {
                    NewsCategory nc = new NewsCategory();
                    nc.Label    = nv.categories[i];
                    nc.Category = msgs.Get(Category.GetNameForLabel(nc.Label));

                    Categories.Categories.Add(nc);
                }

                Categories.MainCategory = new NewsCategory();
                if (Categories.Categories.Count > 0)
                {
                    Categories.MainCategory = Categories.Categories[0];
                }
            }

            Status     = (int)1;
            StatusName = "Publicado";
        }