/// <summary> /// Read a language /// </summary> /// <param name="lngIsoCode"></param> /// <returns></returns> internal Language_DTO_Create Read(string lngIsoCode) { ADO Ado = new ADO("defaultConnection"); try { Language_DTO_Create dto = new Language_DTO_Create(); Language_ADO lAdo = new Language_ADO(Ado); Language_DTO_Read readDTO = new Language_DTO_Read(); readDTO.LngIsoCode = lngIsoCode; var retval = lAdo.Read(readDTO); if (retval.hasData) { dto.LngIsoCode = lngIsoCode; dto.LngIsoName = retval.data[0].LngIsoName; } return(dto); } catch (Exception ex) { throw ex; } finally { Ado.Dispose(); } }
/// <summary> /// Creates a new language with the validated input parameters as supplied by the client /// The parameters must include LngIsoCode and LngIsoName /// If a language already exists i.e. its LngIsoCode is already in the database, the Create request is refused /// </summary> /// <param name="parameters"></param> /// <param name="ccnUsername"></param> /// <returns></returns> internal int Create(Language_DTO_Create language, string ccnUsername) { List <ADO_inputParams> inputParamList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@LngIsoCode", value = language.LngIsoCode }, new ADO_inputParams() { name = "@LngIsoName", value = language.LngIsoName }, new ADO_inputParams() { name = "@CcnUsername", value = ccnUsername } }; // A return parameter is required for the operation ADO_returnParam retParam = new ADO_returnParam(); retParam.name = "return"; retParam.value = 0; //Attempting to create the new entity ado.ExecuteNonQueryProcedure("System_Settings_Language_Create", inputParamList, ref retParam); //Assign the returned value for checking and output return(retParam.value); }