Ejemplo n.º 1
0
        /// <summary>
        /// Populates one or more fields with values from the <code>appSettings</code>
        /// section of the <code>App.Config</code> file.
        /// </summary>
        /// <exception cref="iClickerQuizPts.AppExceptions.InalidAppConfigItemException">
        /// Thrown if the specified key value cannot be found in the <code>App.Config</code> file.
        /// </exception>
        public virtual void ReadAppConfigDataIntoFields()
        {
            AppSettingsReader ar = new AppSettingsReader();

            try
            {
                _nmbNonScoreCols = (byte)ar.GetValue("NmbrNonScoreCols", typeof(byte));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "NmbrNonScoreCols";
                throw ex;
            }
        }
Ejemplo n.º 2
0
        private void ReadAppConfigDataIntoFields()
        {
            AppSettingsReader ar = new AppSettingsReader();

            try
            {
                _studentEmailCol = (byte)ar.GetValue("ColNoEmailXL", typeof(byte));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColNoEmailXL";
                throw ex;
            }

            try
            {
                _studentNameCol = (byte)ar.GetValue("ColNoStdntNmXL", typeof(byte));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColNoStdntNmXL";
                throw ex;
            }

            try
            {
                _firstDataCol = (byte)ar.GetValue("ColNoDataBeginsXL", typeof(byte));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColNoDataBeginsXL";
                throw ex;
            }

            try
            {
                _colNmID = (string)ar.GetValue("ColID", typeof(string));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColID";
                throw ex;
            }

            try
            {
                _colNmEmail = (string)ar.GetValue("ColEmail", typeof(string));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColEmail";
                throw ex;
            }

            try
            {
                _colNmFirstNm = (string)ar.GetValue("ColFN", typeof(string));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColFN";
                throw ex;
            }

            try
            {
                _colNmLastNm = (string)ar.GetValue("ColLN", typeof(string));
            }
            catch
            {
                InalidAppConfigItemException ex = new InalidAppConfigItemException();
                ex.MissingKey = "ColLN";
                throw ex;
            }
        }