/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Validation of parameters and user have been successful. We may now proceed to read from the database var adoLanguage = new Language_ADO(Ado); //First we must check if the language exists already (we can't have duplicates) if (adoLanguage.Exists(DTO.LngIsoCode)) { //This language exists already, we can't proceed Log.Instance.Debug("The ISO Code '" + DTO.LngIsoCode + "' exists already."); Response.error = Label.Get("error.duplicate"); return(false); } //Create the language - and retrieve the newly created Id int newId = adoLanguage.Create(DTO, SamAccountName); if (newId == 0) { Log.Instance.Debug("Can't Create Language"); Response.error = Label.Get("error.create"); return(false); } Response.data = JSONRPC.success; return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Validation of parameters and user have been successful. We may now proceed to read from the database var adoLanguage = new Language_ADO(Ado); LanguageUtility lu = new LanguageUtility(); var languageFileNames = lu.GetLanguageCodes(); if (!languageFileNames.Contains(DTO.LngIsoCode)) { //This language exists already, we can't proceed Log.Instance.Debug("You must create a language file in resources for language " + DTO.LngIsoName); Response.error = Label.Get("error.settings.language-json-invalid"); return(false); } //First we must check if the language exists already (we can't have duplicates) if (adoLanguage.Exists(DTO.LngIsoCode)) { //This language exists already, we can't proceed Log.Instance.Debug("The ISO Code '" + DTO.LngIsoCode + "' exists already."); Response.error = Label.Get("error.duplicate"); return(false); } //Create the language - and retrieve the newly created Id int newId = adoLanguage.Create(DTO, SamAccountName); if (newId == 0) { Log.Instance.Debug("Can't Create Language"); Response.error = Label.Get("error.create"); return(false); } Response.data = JSONRPC.success; return(true); }