Beispiel #1
0
        public IQueryable <CoreLanguage> Search(List <string> listLanguage)
        {
            var listLanguageUpperCase = listLanguage.Select(x => x.Trim().ToUpper()).ToList();
            var currentDateTime       = DateTime.Now;
            //var keyList = listLanguage.Select(x => x.CoreLanguageId).ToList();
            //var menuId = int.Parse(base.getMenuIdFromUrl());
            var menuid       = 0;
            var searchResult = db.CoreLanguages.Where(
                x => listLanguageUpperCase.Contains(x.CoreLanguageId.Trim().ToUpper()) &&
                (x.MenuId == 99999 || x.MenuId == menuid)
                ).OrderBy(x => x.MenuId);

            var availKeyList = searchResult.Select(x => x.CoreLanguageId.ToUpper().Trim()).ToList();

            var notAvailKeyList = listLanguage.Where(x => !availKeyList.Contains(x.ToUpper().Trim())).Select(x => x.Trim()).Distinct(StringComparer.CurrentCultureIgnoreCase).ToList();
            var listNewLanguage = new List <CoreLanguage>();

            foreach (var x in notAvailKeyList)
            {
                var newKey = new CoreLanguage();
                newKey.CoreLanguageId = x;
                newKey.Value          = x;
                newKey.Culture        = "EN";
                newKey.MenuId         = 99999;
                listNewLanguage.Add(newKey);
            }
            db.CoreLanguages.AddRange(listNewLanguage);
            db.SaveChanges();
            return(searchResult);
        }
Beispiel #2
0
 public CoreLanguageClass(CoreLanguage lang, int id, string name,
                          string titleInEnglish, string titleInNative)
 {
     this.Language       = lang;
     this.Id             = id;
     this.name           = name;
     this.TitleInEnglish = titleInEnglish;
     this.TitleInNative  = titleInNative;
 }
Beispiel #3
0
        public static CoreLanguageClass GetLangugageClassByEnum(CoreLanguage lang)
        {
            foreach (CoreLanguageClass c in LanguageList)
            {
                if (c.Language == lang)
                {
                    return(c);
                }
            }

            return(DefaultLanguage);
        }
Beispiel #4
0
 private static void Repl(IScope scope, IStack stack)
 {
     while (true)
     {
         stack.Dump();
         var line = G.C.GetLine(":");
         if (line == null)
         {
             break;
         }
         Capsuled(
             () =>
         {
             CoreLanguage.Execute(new CharStream(line), scope, stack);
         });
     }
 }
Beispiel #5
0
        private static void Prompted()
        {
            SetupConsole();

            Woo.Doo();

            var rootBase  = MakeRootFrame(out var root);
            var testBase  = WithTest(root, rootBase);
            var rootScope = rootBase.Chain(Binder.From("prompt"));
            var testScope = testBase.Chain(Binder.From("test"));
            var stack     = Stack.From();

            Capsuled(() => CoreLanguage.Load(testScope, stack, Symbol.Get("tests.all")));
            Capsuled(() => CoreLanguage.Load(rootScope, stack, Symbol.Get("startup")));

            Repl(rootScope, stack);
        }