Exemple #1
0
        public async Task <IEnumerable <T> > CreateListAsync <T>(SqliteDataReader sqlDataReader)
        {
            var collection = new Collection <T>();

            while (await sqlDataReader.ReadAsync())
            {
                collection.Add(SqlDataReaderExtensions.SqlDataReaderToObject <T>(sqlDataReader));
            }

            return(collection);
        }
Exemple #2
0
        /// <summary>
        /// Parses a SqlDataReader object into a location object
        /// </summary>
        /// <param name="DataReader"></param>
        private void ParseSqlDataReader(SqlDataReader DataReader)
        {
            //Validate Argument
            ArgumentValidation.ValidateSqlDataReader(DataReader, Globals.UserSettings.GetCultureInfo());

            this._ID          = DataReader.GetInt32(DataReader.GetOrdinal("id"));
            this._SimID       = DataReader.GetInt16(DataReader.GetOrdinal("sim_id"));
            this._Name        = DataReader.GetString(DataReader.GetOrdinal("name"));
            this.TIPLOC       = DataReader.GetNullableString("tiploc");
            this.SimSigCode   = DataReader.GetString(DataReader.GetOrdinal("simsig_code"));
            this.EntryPoint   = DataReader.GetBoolean(DataReader.GetOrdinal("simsig_entry_point"));
            this.LocationType = (SimSigLocationType)SqlDataReaderExtensions.GetNullableByte(DataReader, "location_type_id");
        }
Exemple #3
0
        /// <summary>
        /// Parses a SqlDataReader object into a location node object
        /// </summary>
        /// <param name="DataReader">The SqlDataReader object to parse into this Location Node object</param>
        /// <param name="LoadPathEdges">Flag to indicate whether the Path Edge should be loaded</param>
        private void ParseSqlDataReader(SqlDataReader DataReader, bool LoadPathEdges)
        {
            //Validate Argument
            ArgumentValidation.ValidateSqlDataReader(DataReader, Globals.UserSettings.GetCultureInfo());

            this._ID                 = DataReader.GetInt32(DataReader.GetOrdinal("id"));
            this._SimID              = DataReader.GetInt16(DataReader.GetOrdinal("sim_id"));
            this._LocationID         = DataReader.GetInt32(DataReader.GetOrdinal("location_id"));
            this._EraID              = DataReader.GetInt16(DataReader.GetOrdinal("simera_id"));
            this._Version            = new Version(DataReader.GetInt16(DataReader.GetOrdinal("version_id")), this._SQLConnector);
            this.Length              = DataReader.GetNullableInt16("length") == 0 ? null : new Length(DataReader.GetNullableInt16("length"));
            this.Electrification     = DataReader.GetNullableByte("simsig_elec_bitmap") == 0 ? null : new Electrification((ElectrificationBitValue)DataReader.GetNullableByte("simsig_elec_bitmap"));
            this.FreightOnly         = DataReader.GetBoolean(DataReader.GetOrdinal("freight_only"));
            this.Platform            = DataReader.GetNullableString("simsig_platform_code");
            this.Path                = DataReader.GetNullableString("simsig_path");
            this.Line                = DataReader.GetNullableString("simsig_line");
            this._LocationSimSigCode = DataReader.GetNullableString("simsig_code");
            this.LocationType        = (SimSigLocationType)SqlDataReaderExtensions.GetNullableByte(DataReader, "location_type_id");

            if (LoadPathEdges)
            {
                this._PathEdges = new PathEdgeCollection(this, this._SQLConnector);
            }
        }