Exemplo n.º 1
0
        internal HttpResponseMessage LanguageGenerateCSS(HttpRequestMessage request, LanguageDTO cqDTO)
        {
            var    lr          = new LanguageRepository();
            var    er          = new EnglishTermRepository();
            var    tr          = new TranslatedTermRepository();
            var    lang        = lr.GetById(int.Parse(cqDTO.LanguageID));
            string cssfilename = lang.CssFileName;
            var    eTerms      = er.GetEnglishTerms();
            var    tTerms      = tr.GetTranslatedTerms(int.Parse(cqDTO.LanguageID));

            string retVal = "";

            foreach (EnglishTerm eTerm in eTerms)
            {
                string trans = "";
                var    tTerm = tTerms.Where(x => x.EnglishTermID == eTerm.EnglishTermID).FirstOrDefault();
                if (tTerm != null)
                {
                    trans = tTerm.TermTranslated;
                }
                retVal += "[data-test='" + eTerm.Term + "']:" + eTerm.BeforeOrAfter + " { content: '" + trans + "';}" + Environment.NewLine;
            }
            var res = Request.CreateResponse(HttpStatusCode.OK);

            res.Content = new StringContent(retVal, Encoding.UTF8, "text/css");
            return(res);
        }
        internal HttpResponseMessage TranslatedTerms(HttpRequestMessage request, TranslatedTermDTO cqDTO)
        {
            var ur     = new TranslatedTermRepository();
            var u      = new TranslatedTerm();
            var data   = ur.GetTranslatedTerms(int.Parse(cqDTO.LanguageID));
            var er     = new EnglishTermRepository();
            var eterms = er.GetEnglishTerms();
            var col    = new Collection <Dictionary <string, string> >();

            foreach (var item in eterms)
            {
                var tTerm = data.Where(x => x.EnglishTermID == item.EnglishTermID).FirstOrDefault();
                var dic   = new Dictionary <string, string>();
                dic.Add("EnglishTermID", item.EnglishTermID.ToString());
                dic.Add("LanguageID", cqDTO.LanguageID);
                dic.Add("Term", item.Term.ToString());

                if (tTerm == null)
                {
                    dic.Add("TranslationID", "-1");
                    dic.Add("TermTranslated", "");
                }
                else
                {
                    dic.Add("TranslationID", tTerm.TranslationID.ToString());
                    dic.Add("TermTranslated", tTerm.TermTranslated);
                }

                col.Add(dic);
            }

            var retVal = new GenericDTO
            {
                ReturnData = col
            };

            return(Request.CreateResponse(HttpStatusCode.OK, retVal));
        }
Exemplo n.º 3
0
        internal HttpResponseMessage EnglishTerms(HttpRequestMessage request, EnglishTermDTO cqDTO)
        {
            var ur   = new EnglishTermRepository();
            var u    = new EnglishTerm();
            var data = ur.GetEnglishTerms();
            var col  = new Collection <Dictionary <string, string> >();

            foreach (var item in data)
            {
                var dic = new Dictionary <string, string>();
                dic.Add("EnglishTermID", item.EnglishTermID.ToString());
                dic.Add("Term", item.Term);
                dic.Add("BeforeOrAfter", item.BeforeOrAfter);
                col.Add(dic);
            }

            var retVal = new GenericDTO
            {
                ReturnData = col
            };

            return(Request.CreateResponse(HttpStatusCode.OK, retVal));
        }