Пример #1
0
        /// <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();
            }
        }
Пример #2
0
        /// <summary>
        /// The Read method uses the Language_DTO_Read object and passes the LngIsoCode property to the stored procedure
        /// If the LngIsoCode property is null, this is recognised by the stored procedure as a request for a list of ALL language entities
        /// The method returns a list of Language_DTO objects, which may be empty (i.e. if no corresponding data is found)
        /// </summary>
        /// <param name="language"></param>
        /// <returns></returns>
        internal ADO_readerOutput Read(Language_DTO_Read language)
        {
            ADO_readerOutput output = new ADO_readerOutput();

            //The ExecuteReaderProcedure method requires that the parameters be contained in a List<ADO_inputParams>
            List <ADO_inputParams> paramList = new List <ADO_inputParams>();

            if (!string.IsNullOrEmpty(language.LngIsoCode))
            {
                paramList.Add(new ADO_inputParams()
                {
                    name = "@LngIsoCode", value = language.LngIsoCode
                });
            }

            //Call the stored procedure
            output = ado.ExecuteReaderProcedure("System_Settings_Language_Read", paramList);

            //return the list of entities that have been found
            return(output);
        }