public LanguagePanelHud(Transform content, LanguageModel model, LanguageModel defaultModel)
 {
     this.content = content;
     this.model = model;
     this.defaultModel = defaultModel;
     setData();
 }
        public PreprocessingContext( LanguageModel languageModel, List<Document> documents,
				String query )
        {
            this.query = query;
            this.documents = documents;
            this.language = languageModel;
        }
	private string prioritize_languages(string key, LanguageModel first, LanguageModel second){
		if (first != null && first.entries.ContainsKey(key))
			return first.entries[key];
		if (second != null && second.entries.ContainsKey(key))
			return "?"+second.entries[key];
		return "!"+key;
	}
 public void SetData(LanguageModel model, LanguageModel defaultModel)
 {
     this.defaultModel = defaultModel;
     this.model = model;
     model.Init();
     defaultModel.Init();
     createHud();
 }
 public void PointsAddTest()
 {
     var builder = new LanguageBuilder();
     var model = new LanguageModel("cs", "Somehting.cs");            
     builder.AddLanguage(model);
     builder.AddLanguage(model);
     model = new LanguageModel("java", "Program.java");
     builder.AddLanguage(model);
     model = new LanguageModel("py", "program.py");
     builder.AddLanguage(model);
     Assert.AreEqual(2, builder.LanguageAttributes["C#"].Count);
     Assert.AreEqual(1, builder.LanguageAttributes["Java"].Count);
     Assert.AreEqual(1, builder.LanguageAttributes["Phyton"].Count);
 }
 public void AddLanguage(LanguageModel model)
 {
     model = GetValidLanguage(model);
     if (model != null)
     {
         ILanguage value = null;
         if (!LanguageAttributes.TryGetValue(model.Name, out value))
         {
             LanguageAttributes.Add(model.Name, new SimpleLanguage(model));
         }
         else
         {
             LanguageAttributes[model.Name].Add(model);
         }
     }
 }
        private LanguageModel GetValidLanguage(LanguageModel model)
        {
            LanguageModel result = null;
            using (var reader = new StreamReader(LanguageConfiguration))
            {
                while (!reader.EndOfStream)
                {
                    var cfg = reader.ReadLine().Split('=');

                    if (model.Name.Equals(cfg[0]) || model.Name.Equals(cfg[1]))
                    {
                        result = new LanguageModel(cfg[1], model.File);
                    }

                }
            }
            return result;
        }
        public void lvlUpTest()
        {
            var builder = new LanguageBuilder();
            var languageModel = new LanguageModel("cs", "file1.cs");
            var lang = new SimpleLanguage(languageModel);
            languageModel = new LanguageModel("cs", "file.cs");
            lang.Add(languageModel);
            languageModel = new LanguageModel("cs", "file23.cs");
            lang.Add(languageModel);
            builder.LanguageAttributes.Add("cs", lang);

            var expLang = new LanguageExperience("Teste", @".\Contents\Level\lvlUpTest.prop", "Language Points");
            expLang.AddModel(builder);

            Assert.AreEqual(2, expLang.Level);
            Assert.AreEqual(3, expLang.ExperiencePoints);
            Assert.AreEqual("Teste", expLang.Name);
        }
 public void AddBuilder(LanguageBuilder currentLang)
 {
     foreach (var key in currentLang.LanguageAttributes.Keys)
     {
         ILanguage value = null;
         if (currentLang.LanguageAttributes.TryGetValue(key, out value))
         {
             for (int i = 0; i < currentLang.LanguageAttributes[key].File.Count; i++)
             {
                 var langModel = new LanguageModel(key, currentLang.LanguageAttributes[key].File[i]);
                 AddLanguage(langModel);
             }
         }
         else
         {
             LanguageAttributes.Add(key, currentLang.LanguageAttributes[key]);                    
         }
     }
 }
Beispiel #10
0
    /// <summary>
    /// Returns list of languages from the Country Database ut_language table.
    /// </summary>
    /// <returns>JSON string (LanguageModel)</returns>
    public static string GetLangNidFromlangCode(string languageCode)
    {
        LanguageModel dbLanguages = new LanguageModel();
        DataTable dtLanguages;
        DIConnection DIConnection;
        string retVal = "0";

        try
        {
            using (DIConnection = Global.GetDbConnection(Int32.Parse(Global.GetDefaultDbNId())))
            {
                retVal = "0";
                dtLanguages = DIConnection.DILanguages(DIConnection.DIDataSetDefault());
                string langNid;

                foreach (DataRow row in dtLanguages.Select("Language_Code='" + languageCode + "'"))
                {
                    langNid = Convert.ToString(row[Language.LanguageNId].ToString());
                    retVal = langNid;

                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }

        return retVal;
    }
Beispiel #11
0
    /// <summary>
    /// Returns language code from the Country Database ut_language table.
    /// </summary>
    /// <returns>JSON string (LanguageModel)</returns>
    public static string GetLangCodeFromDB(string languageNid)
    {
        LanguageModel dbLanguages = new LanguageModel();
        DataTable dtLanguages;
        DIConnection DIConnection;
        string retVal = string.Empty;

        try
        {
            using (DIConnection = Global.GetDbConnection(Int32.Parse(Global.GetDefaultDbNId())))
            {
                retVal = "false";
                dtLanguages = DIConnection.DILanguages(DIConnection.DIDataSetDefault());
                string langCode;

                foreach (DataRow row in dtLanguages.Select("Language_NId=" + languageNid))
                {
                    langCode = Convert.ToString(row[Language.LanguageCode].ToString());
                    retVal = Convert.ToString(langCode);
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }

        return retVal;
    }
Beispiel #12
0
 public Task <BaseResponseMessage> SetDefaultRecognitionLanguage(LanguageModel language, Guid userId)
 {
     throw new NotImplementedException();
 }
	public void set_language(string key, LanguageModel value){
		get_language_property(key).Value = value;
	}
 protected bool Equals(LanguageModel other)
 {
     return(string.Equals(Language, other.Language));
 }
Beispiel #15
0
 public static Language ToEntity(this LanguageModel model)
 {
     return(model.MapTo <LanguageModel, Language>());
 }
        private async Task <LocalizedUrlHelper> CreateUrlHelperForLanguageSelectorAsync(LanguageModel model, int currentLanguageId)
        {
            if (currentLanguageId != model.Id)
            {
                var routeValues    = Request.RouteValues;
                var controllerName = routeValues.GetControllerName();

                if (!routeValues.TryGetValue(controllerName + "id", out var val))
                {
                    controllerName = routeValues.GetActionName();
                    routeValues.TryGetValue(controllerName + "id", out val);
                }

                int entityId = 0;
                if (val != null)
                {
                    entityId = val.Convert <int>();
                }

                if (entityId > 0)
                {
                    var activeSlug = await _urlService.GetActiveSlugAsync(entityId, controllerName, model.Id);

                    if (activeSlug.IsEmpty())
                    {
                        // Fallback to default value.
                        activeSlug = await _urlService.GetActiveSlugAsync(entityId, controllerName, 0);
                    }

                    if (activeSlug.HasValue())
                    {
                        var helper = new LocalizedUrlHelper(Request.PathBase, activeSlug);
                        return(helper);
                    }
                }
            }

            return(new LocalizedUrlHelper(Request));
        }
Beispiel #17
0
 public void SetLanguage(LanguageModel languageModel) => SetLanguage(languageModel.Code);
Beispiel #18
0
        private void InitializeLanguage()
        {
            languageModel            = new LanguageModel();
            languageModel.Id         = 0;
            languageModel.Name       = "English";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 1;
            languageModel.Name       = "Dutch";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 2;
            languageModel.Name       = "French";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 3;
            languageModel.Name       = "Portuguese";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 4;
            languageModel.Name       = "German";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 5;
            languageModel.Name       = "Italian";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 6;
            languageModel.Name       = "Japanese";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);


            languageModel            = new LanguageModel();
            languageModel.Id         = 7;
            languageModel.Name       = "Hebrew";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 8;
            languageModel.Name       = "Spanish";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);

            languageModel            = new LanguageModel();
            languageModel.Id         = 9;
            languageModel.Name       = "Italian";
            languageModel.IsSelected = false;
            _languages.Add(languageModel);
        }
Beispiel #19
0
 public void CreateLanguage(LanguageModel model)
 {
     _languageRepository.Add(model.ToEntity());
 }
Beispiel #20
0
 private void WebClient_DownloadDataCompleted(LanguageModel model)
 {
     model.IsDownloading = false;
 }
Beispiel #21
0
 public UpdateLanguage(LanguageModel model)
 {
     urlData.Add("languages");
     urlData.Add("update");
     postData.Add("data", JsonConvert.SerializeObject(model, Formatting.None, new JsonConverter[] { new Vector2Converter() }));
 }
 public XElement ToXml(LanguageModel<T> languageModel)
 {
     var result =
         new XElement(RootElement,
                      new XElement(LanguageElement,
                                   new[]
                                       {
                                           Tuple.Create(LanguageIso639_2T_Attribute, languageModel.Language.Iso639_2T),
                                           Tuple.Create(LanguageIso639_3_Attribute, languageModel.Language.Iso639_3),
                                           Tuple.Create(LanguageEnglishNameAttribute, languageModel.Language.EnglishName),
                                           Tuple.Create(LanguageLocalNameAttribute, languageModel.Language.LocalName)
                                       }
                                       .Where(t => t.Item2 != null).Select(t => new XAttribute(t.Item1, t.Item2)).ToArray()),
                      new XElement(MetadataElement,
                                   languageModel.Metadata.Select(kvp => new XElement(kvp.Key, kvp.Value))),
                      new XElement(NGramsElement,
                                   new XAttribute(TotalNoiseCountAtribute, languageModel.Features.TotalNoiseEventsCount),
                                   new XAttribute(DistinctNoiseCountAtribute, languageModel.Features.DistinctNoiseEventsCount),
                                   languageModel.Features.DistinctRepresentedEvents
                                       .Select(
                                           event_ =>
                                           new XElement(NGramElement,
                                                        new XAttribute(TextAttribute, _serializeFeature(event_)),
                                                        new XAttribute(CountAttribute, languageModel.Features.GetEventCount(event_))))));
     return result;
 }
Beispiel #23
0
 public ActionResult AAIndex()
 {
     LanguageModel securityQuestionModel = new LanguageModel();
     securityQuestionModel.LanguageList = LanguageModel.GetList();
     return View("AAIndex", securityQuestionModel);
 }
Beispiel #24
0
        public static List <LanguageModel> ListAllLanguages()
        {
            LanguageModel languages = new LanguageModel();

            return(languages.ListLanguages());
        }
Beispiel #25
0
 public static Language ToEntity(this LanguageModel model, Language destination)
 {
     return(model.MapTo(destination));
 }
        public void InvalidLanguageTest()
        {
            var builder = new LanguageBuilder();
            var valid = new LanguageModel("rb", "file1.rb");
            builder.AddLanguage(valid);
            valid = new LanguageModel("html", "file1.html");
            builder.AddLanguage(valid);            

            Assert.AreEqual(0, builder.LanguageAttributes.Count);
            Assert.IsFalse(builder.LanguageAttributes.ContainsKey("Ruby"));
            Assert.IsFalse(builder.LanguageAttributes.ContainsKey("HTML"));            
        }
 public void UpdateLanguage(LanguageModel model, Action onLanguageUpdated)
 {
     wwwService.Send<UpdateLanguage>(new UpdateLanguage(model), (request) => onLanguageUpdated(), onRequestFailed);
 }
 /**
  * /// Returns the smear term for the given word sequence
  *
  * /// @param ws the word sequence
  * /// @return the smear term for the word sequence
  */
 public float GetSmearTermFromLanguageModel(WordSequence ws)
 {
     return(LanguageModel.GetSmear(ws));
 }
Beispiel #29
0
        public static bool AddLanguage(string languageName, string languageId)
        {
            LanguageModel language = new LanguageModel();

            return(language.AddLanguage(languageName, languageId));
        }
        private void ReadCharacterArchive(Stream stream)
        {
            XMLImporter xmlImporter = new XMLImporter(_stringService);

            using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Read))
            {
                ZipArchiveEntry backgroundsEntry = archive.GetEntry("resources/backgrounds.xml");
                using (StreamReader reader = new StreamReader(backgroundsEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _backgrounds.AddRange(xmlImporter.ReadBackgrounds(xml));
                }

                ZipArchiveEntry classesEntry = archive.GetEntry("resources/classes.xml");
                using (StreamReader reader = new StreamReader(classesEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _classes.AddRange(xmlImporter.ReadClasses(xml));
                }

                ZipArchiveEntry conditionsEntry = archive.GetEntry("resources/conditions.xml");
                using (StreamReader reader = new StreamReader(conditionsEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _conditions.AddRange(xmlImporter.ReadConditions(xml));
                }

                ZipArchiveEntry featsEntry = archive.GetEntry("resources/feats.xml");
                using (StreamReader reader = new StreamReader(featsEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _feats.AddRange(xmlImporter.ReadFeats(xml));
                }

                ZipArchiveEntry itemsEntry = archive.GetEntry("resources/items.xml");
                using (StreamReader reader = new StreamReader(itemsEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _items.AddRange(xmlImporter.ReadItems(xml));
                }

                ZipArchiveEntry languagesEntry = archive.GetEntry("resources/languages.csv");
                using (StreamReader reader = new StreamReader(languagesEntry.Open(), Encoding.UTF8))
                {
                    while (!reader.EndOfStream)
                    {
                        string languageLine = reader.ReadLine();
                        if (!String.IsNullOrWhiteSpace(languageLine))
                        {
                            string[] parts = languageLine.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            if (parts.Length == 2)
                            {
                                if (Guid.TryParse(parts[0], out Guid id))
                                {
                                    LanguageModel languageModel = new LanguageModel();
                                    languageModel.Id   = id;
                                    languageModel.Name = parts[1].Trim();
                                    _languages.Add(languageModel);
                                }
                            }
                        }
                    }
                }

                ZipArchiveEntry monstersEntry = archive.GetEntry("resources/monsters.xml");
                using (StreamReader reader = new StreamReader(monstersEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _monsters.AddRange(xmlImporter.ReadMonsters(xml));
                }

                ZipArchiveEntry racesEntry = archive.GetEntry("resources/races.xml");
                using (StreamReader reader = new StreamReader(racesEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _races.AddRange(xmlImporter.ReadRaces(xml));
                }

                ZipArchiveEntry spellsEntry = archive.GetEntry("resources/spells.xml");
                using (StreamReader reader = new StreamReader(spellsEntry.Open(), Encoding.UTF8))
                {
                    string xml = reader.ReadToEnd();
                    _spells.AddRange(xmlImporter.ReadSpells(xml));
                }

                ZipArchiveEntry characterEntry = archive.GetEntry("character.ccc");
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    using (Stream characterEntryStream = characterEntry.Open())
                    {
                        characterEntryStream.CopyTo(memoryStream);
                        _characters.Add(memoryStream.ToArray());
                    }
                }
            }
        }
        public void ValidAndInvalidLanguageTest()
        {
            var builder = new LanguageBuilder();
            var valid = new LanguageModel("rb", "file1.rb");
            builder.AddLanguage(valid);
            valid = new LanguageModel("html", "file1.html");
            builder.AddLanguage(valid);
            valid = new LanguageModel("java", "file1.java");
            builder.AddLanguage(valid);
            valid = new LanguageModel("js", "file1.js");
            builder.AddLanguage(valid);

            Assert.AreEqual(2, builder.LanguageAttributes.Count);
            Assert.IsTrue(builder.LanguageAttributes.ContainsKey("JavaScript"));
            Assert.IsTrue(builder.LanguageAttributes.ContainsKey("Java"));            
            Assert.IsFalse(builder.LanguageAttributes.ContainsKey("Ruby"));
            Assert.IsFalse(builder.LanguageAttributes.ContainsKey("HTML"));            
        }
Beispiel #32
0
        public static List <LanguageModel> ListLanguagesForAdmin()
        {
            LanguageModel listLanguages = new LanguageModel();

            return(listLanguages.ListLanguagesForAdmin());
        }
        public void ValidLanguageTests()
        {            
            var builder = new LanguageBuilder();
            var valid = new LanguageModel("cs", "file1.cs");
            builder.AddLanguage(valid);
            valid = new LanguageModel("java", "file1.java");
            builder.AddLanguage(valid);
            valid = new LanguageModel("js", "file1.js");
            builder.AddLanguage(valid);


            Assert.AreEqual(3, builder.LanguageAttributes.Count);
            Assert.IsTrue(builder.LanguageAttributes.ContainsKey("JavaScript"));
            Assert.IsTrue(builder.LanguageAttributes.ContainsKey("C#"));
            Assert.IsTrue(builder.LanguageAttributes.ContainsKey("Java"));
        }
 public SimpleLanguage(LanguageModel model)
 {
     Name = model.Name;
     File = new List<string>();
     Add(model);
 }
Beispiel #35
0
        public static List <LanguageModel> ListLanguageWords(string LangId)
        {
            LanguageModel listLanguages = new LanguageModel();

            return(listLanguages.ListLanguageWords(LangId));
        }
Beispiel #36
0
 public override void ParseResult()
 {
     Model = JsonConvert.DeserializeObject<LanguageModel>(result);
 }
 public void Add(LanguageModel model)
 {
     File.Add(model.File);
 }
Beispiel #38
0
        public static bool LanguageTranslation(string englishWord, string languageId, string languageWord)
        {
            LanguageModel listLanguages = new LanguageModel();

            return(listLanguages.LanguageTranslation(englishWord, languageId, languageWord));
        }
Beispiel #39
0
        /// <summary>
        /// Map the terms values returned from the IATE API response with the SearchResultModel
        /// </summary>
        /// <param name="response">IATE API response</param>
        /// <param name="domainResponseModel">domains response model</param>
        /// <returns>list of terms</returns>
        private List <ISearchResult> MapResponseValues(string response, JsonDomainResponseModel domainResponseModel)
        {
            var termsList = new List <ISearchResult>();

            if (!string.IsNullOrEmpty(response))
            {
                var jObject    = JObject.Parse(response);
                var itemTokens = (JArray)jObject.SelectToken("items");
                if (itemTokens != null)
                {
                    foreach (var item in itemTokens)
                    {
                        _termIndexId++;

                        var itemId      = item.SelectToken("id").ToString();
                        var domainModel = domainResponseModel.Items.FirstOrDefault(i => i.Id == itemId);
                        var domain      = SetTermDomain(domainModel);
                        SetTermSubdomains(domainModel);

                        var searchResultItems = new List <SearchResultModel>();

                        // get language children (source + target languages)
                        var languageTokens = item.SelectToken("language").Children().ToList();
                        if (languageTokens.Any())
                        {
                            // foreach language token get the terms
                            foreach (var jToken in languageTokens)
                            {
                                var languageToken = (JProperty)jToken;

                                // Multilingual and Latin translations are automatically returned by IATE API response->"la" code
                                // Ignore the "mul" and "la" translations
                                if (languageToken.Name.Equals("la") || languageToken.Name.Equals("mul"))
                                {
                                    continue;
                                }

                                var termEntries = languageToken.FirstOrDefault()?.SelectToken("term_entries");
                                if (termEntries == null)
                                {
                                    continue;
                                }

                                foreach (var termEntry in termEntries)
                                {
                                    var termValue      = termEntry.SelectToken("term_value").ToString();
                                    var termType       = GetTermTypeByCode(termEntry.SelectToken("type").ToString());
                                    var langTwoLetters = languageToken.Name;
                                    var definition     = languageToken.Children().FirstOrDefault() != null
                                                                                ? languageToken.Children().FirstOrDefault()?.SelectToken("definition")
                                                                                : null;

                                    var displayOrder = -1;
                                    var evaluation   = -1;
                                    var metaData     = termEntry.SelectToken("metadata");

                                    if (metaData != null)
                                    {
                                        var displayOrderObject = metaData.SelectToken("display_order");
                                        if (displayOrderObject != null)
                                        {
                                            displayOrder = displayOrderObject.Value <int>();
                                        }

                                        var evaluationObject = metaData.SelectToken("evaluation");
                                        if (evaluationObject != null)
                                        {
                                            evaluation = evaluationObject.Value <int>();
                                        }
                                    }

                                    try
                                    {
                                        var languageModel = new LanguageModel
                                        {
                                            Name   = new Language(langTwoLetters).DisplayName,
                                            Locale = new Language(langTwoLetters).CultureInfo
                                        };

                                        var termResult = new SearchResultModel
                                        {
                                            Text         = termValue,
                                            Id           = _termIndexId,
                                            ItemId       = itemId,
                                            Score        = 100,
                                            Language     = languageModel,
                                            Definition   = definition?.ToString() ?? string.Empty,
                                            Domain       = domain,
                                            Subdomain    = FormatSubdomain(),
                                            TermType     = termType,
                                            DisplayOrder = displayOrder,
                                            Evaluation   = evaluation
                                        };

                                        searchResultItems.Add(termResult);
                                    }
                                    catch (Exception e)
                                    {
                                        _logger.Error($"{e.Message}\n{e.StackTrace}");
                                    }
                                }
                            }
                        }

                        termsList.AddRange(searchResultItems);
                    }
                }
            }
            return(termsList);
        }
Beispiel #40
0
 public static Language ToEntity(this LanguageModel model)
 {
     return(Mapper.Map <LanguageModel, Language>(model));
 }
Beispiel #41
0
    /// <summary>
    /// Returns list of languages from the Country Database ut_language table.
    /// </summary>
    /// <returns>JSON string (LanguageModel)</returns>
    public static string GetLangFromDB()
    {
        LanguageModel dbLanguages = new LanguageModel();
        DataTable dtLanguages;
        DIConnection DIConnection;
        string retVal = string.Empty;
        bool defaultLang;
        try
        {
            using (DIConnection = Global.GetDbConnection(Int32.Parse(Global.GetDefaultDbNId())))
            {
                retVal = "false";
                dtLanguages = DIConnection.DILanguages(DIConnection.DIDataSetDefault());
                int langNid;
                string langName;
                defaultLang = false;

                foreach (DataRow row in dtLanguages.Rows)
                {
                    langNid = Int32.Parse(row[Language.LanguageNId].ToString());
                    langName = row[Language.LanguageName].ToString();
                    defaultLang = Convert.ToBoolean(row[Language.LanguageDefault]);//.ToString();
                    dbLanguages.LanguagesFromDB.Add(langNid, langName);

                    // Check if default lang
                    if (defaultLang)
                    {
                        dbLanguages.DefaultLang = langName;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        retVal = JsonHelper.JsonSerializer<LanguageModel>(dbLanguages);
        return retVal;
    }
Beispiel #42
0
 public static Language ToEntity(this LanguageModel model, Language destination)
 {
     return(Mapper.Map(model, destination));
 }
Beispiel #43
0
    /// <summary>
    /// Resolves the language name using the passed Nid. Uses SQL DB(ut_languages)
    /// </summary>
    /// <param name="langNid"></param>
    /// <returns>string</returns>
    public static string GetLanguageNameFromNid(string langNid)
    {
        string langName;
        LanguageModel lngModel;

        langName = String.Empty;
        lngModel = new LanguageModel();
        lngModel = JsonHelper.JsonDeserialize<LanguageModel>(Global.GetLangFromDB());
        // Resolve preferred language from langNid to pass to OAT grid
        foreach (int id in lngModel.LanguagesFromDB.Keys)
        {
            if (!string.IsNullOrEmpty(langNid))
            {
                if (id == Int32.Parse(langNid))
                {
                    if (lngModel.LanguagesFromDB[id].Contains("DI"))
                    {
                        langName = lngModel.LanguagesFromDB[id].Split(new string[] { "_" }, StringSplitOptions.None)[1];
                    }
                    else
                    {
                        langName = lngModel.LanguagesFromDB[id];
                    }
                    break;
                }
            }
        }
        return langName;
    }
Beispiel #44
0
        private void frmManageSubject_Load(object sender, EventArgs e)
        {
            StaffModel = frmHome.staffModel;
            if (frmHome.lstDecent != null)
            {
                foreach (DecentralizeModel decen in frmHome.lstDecent)
                {
                    if (StaffModel.StrStaffTypeID == decen.StrStaffTypeID && this.Name == decen.StrFormID)
                    {
                        Decentralize = _Decen.getDecentralizeStaffIdForm(decen.StrStaffTypeID, decen.StrFormID);
                    }
                }
            }
            #region Multi-Language
            //string lan = Language.StrLanguageID;
            // _lstWord = _Word.getLstWord(this.Name);
            Language = frmHome.languageModel;
            //_lstLanWord = _WL.getLstLanguageWord(Language.StrLanguageID, this.Name);
            if (frmHome.lstLanguageWord != null)
            {
                _lstLanWord = _WL.getLstLanguageWord(Language.StrLanguageID, this.Name);
                foreach (LanguageWordModel lnword in _lstLanWord)
                {
                    _wordModel = _Word.getWordSelected(lnword.StrWordID);
                    if (lblTitle.Text == _wordModel.StrWordName)
                    {
                        lblTitle.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnAdd.Text == _wordModel.StrWordName)
                    {
                        btnAdd.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnUpdate.Text == _wordModel.StrWordName)
                    {
                        btnUpdate.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnDelete.Text == _wordModel.StrWordName)
                    {
                        btnDelete.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnSave.Text == _wordModel.StrWordName)
                    {
                        btnSave.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblSubjectID.Text == _wordModel.StrWordName)
                    {
                        lblSubjectID.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblSubjectName.Text == _wordModel.StrWordName)
                    {
                        lblSubjectName.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblFacuty.Text == _wordModel.StrWordName)
                    {
                        lblFacuty.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblStartDay.Text == _wordModel.StrWordName)
                    {
                        lblStartDay.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblEndDay.Text == _wordModel.StrWordName)
                    {
                        lblEndDay.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lkeFaculty.Text == _wordModel.StrWordName)
                    {
                        lkeFaculty.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colSubjectID.Caption == _wordModel.StrWordName)
                    {
                        colSubjectID.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colSubjectName.Caption == _wordModel.StrWordName)
                    {
                        colSubjectName.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colFaculty.Caption == _wordModel.StrWordName)
                    {
                        colFaculty.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colEndTime.Caption == _wordModel.StrWordName)
                    {
                        colEndTime.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colStartTime.Caption == _wordModel.StrWordName)
                    {
                        colStartTime.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (gcListSubject.Text == _wordModel.StrWordName)
                    {
                        gcListSubject.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (grpInformationSubject.Text == _wordModel.StrWordName)
                    {
                        grpInformationSubject.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                }
            }
            #endregion
            dteStartTime.EditValue = DateTime.Now.Date;
            dteEndTime.EditValue   = DateTime.Now.Date;

            _lstFaculty = _Faculty.loadFaculty();
            lkeFaculty.Properties.ValueMember   = "StrFacultyID";
            lkeFaculty.Properties.DisplayMember = "StrFacultyName";
            lkeFaculty.Properties.DataSource    = _lstFaculty;
            lkeFaculty.Properties.Columns["colFacultyID"].FieldName   = "StrFacultyID";
            lkeFaculty.Properties.Columns["colFacultyName"].FieldName = "StrFacultyName";

            ///*GridView*/
            _lstSubject = _Subject.loadSubject();

            LookUpEdit_Faculty.DataSource = _lstFaculty;
            LookUpEdit_Faculty.Columns["colFacultyID"].FieldName   = "StrFacultyID";
            LookUpEdit_Faculty.Columns["colFacultyName"].FieldName = "StrFacultyName";

            gcListSubject.DataSource = _lstSubject;
            _setStatusForm();
        }
 public void Save(LanguageModel<T> languageModel, Stream destinationStream)
 {
     var document = new XDocument(ToXml(languageModel));
     using (var xmlWriter = XmlWriter.Create(destinationStream, new XmlWriterSettings{Indent = true}))
     {
         document.Save(xmlWriter);
     }
 }
Beispiel #46
0
        private void frmManageWord_Load(object sender, EventArgs e)
        {
            this.Visible = false;
            Util.EndAnimate(this, Util.Effect.Slide, 150, 180);
            #region Decen
            StaffModel = frmHome.staffModel;
            if (frmHome.lstDecent != null)
            {
                foreach (DecentralizeModel decen in frmHome.lstDecent)
                {
                    if (StaffModel.StrStaffTypeID == decen.StrStaffTypeID && this.Name == decen.StrFormID)
                    {
                        Decentralize = _Decen.getDecentralizeStaffIdForm(decen.StrStaffTypeID, decen.StrFormID);
                    }
                }
            }
            #endregion

            #region Multi-Lan
            Language = frmHome.languageModel;
            //_lstLanWord = _WL.getLstLanguageWord(Language.StrLanguageID, this.Name);
            if (frmHome.lstLanguageWord != null)
            {
                _lstLanWord = _WL.getLstLanguageWord(Language.StrLanguageID, this.Name);
                foreach (LanguageWordModel lnword in _lstLanWord)
                {
                    _wordModel = _Word.getWordSelected(lnword.StrWordID);
                    if (lblTitle.Text == _wordModel.StrWordName)
                    {
                        lblTitle.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnAdd.Text == _wordModel.StrWordName)
                    {
                        btnAdd.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnUpdate.Text == _wordModel.StrWordName)
                    {
                        btnUpdate.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnDelete.Text == _wordModel.StrWordName)
                    {
                        btnDelete.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (btnSave.Text == _wordModel.StrWordName)
                    {
                        btnSave.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblID.Text == _wordModel.StrWordName)
                    {
                        lblID.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (lblName.Text == _wordModel.StrWordName)
                    {
                        lblName.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colWordID.Caption == _wordModel.StrWordName)
                    {
                        colWordID.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (colWordName.Caption == _wordModel.StrWordName)
                    {
                        colWordName.Caption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (gvWordList.ViewCaption == _wordModel.StrWordName)
                    {
                        gvWordList.ViewCaption = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                    if (grpInformationWord.Text == _wordModel.StrWordName)
                    {
                        grpInformationWord.Text = _WL.getMeanByID(lnword.StrID, Language.StrLanguageID);
                    }
                }
            }
            #endregion
            //lookup-edit

            _lstWord = _Word.loadWord();
            //_lstForm = _Form.loadForm();
            //lkeModule.Properties.ValueMember = "StrFormID";
            //lkeModule.Properties.DisplayMember = "StrFormName";
            //lkeModule.Properties.DataSource = _lstForm;
            //lkeModule.Properties.Columns["colFormID"].FieldName = "StrFormID";
            //lkeModule.Properties.Columns["colFormName"].FieldName = "StrFormName";

            gcListWord.DataSource = _lstWord;
            _setStatusForm();
        }