コード例 #1
0
        public List <H_FsuEvent> GetEventsInType(DateTime start, DateTime end, EnmFsuEvent type)
        {
            SqlParameter[] parms = { new SqlParameter("@Start",     SqlDbType.DateTime),
                                     new SqlParameter("@End",       SqlDbType.DateTime),
                                     new SqlParameter("@EventType", SqlDbType.Int) };

            parms[0].Value = SqlTypeConverter.DBNullDateTimeHandler(start);
            parms[1].Value = SqlTypeConverter.DBNullDateTimeHandler(end);
            parms[2].Value = (int)type;

            var entities = new List <H_FsuEvent>();

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Cs.Sql_H_FsuEvent_Repository_GetEventsInType, parms)) {
                while (rdr.Read())
                {
                    var entity = new H_FsuEvent();
                    entity.FsuId     = SqlTypeConverter.DBNullStringHandler(rdr["FsuId"]);
                    entity.EventType = SqlTypeConverter.DBNullEnmFsuEventHandler(rdr["EventType"]);
                    entity.Message   = SqlTypeConverter.DBNullStringHandler(rdr["Message"]);
                    entity.EventTime = SqlTypeConverter.DBNullDateTimeHandler(rdr["EventTime"]);
                    entities.Add(entity);
                }
            }
            return(entities);
        }