Beispiel #1
0
        public List <C_Brand> GetBrands()
        {
            var entities = new List <C_Brand>();

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Rs.Sql_C_Brand_Repository_GetBrands, null)) {
                while (rdr.Read())
                {
                    var entity = new C_Brand();
                    entity.Id          = SqlTypeConverter.DBNullStringHandler(rdr["Id"]);
                    entity.Name        = SqlTypeConverter.DBNullStringHandler(rdr["Name"]);
                    entity.ProductorId = SqlTypeConverter.DBNullStringHandler(rdr["ProductorId"]);
                    entity.Comment     = SqlTypeConverter.DBNullStringHandler(rdr["Desc"]);
                    entity.Enabled     = SqlTypeConverter.DBNullBooleanHandler(rdr["Enabled"]);
                    entities.Add(entity);
                }
            }
            return(entities);
        }
Beispiel #2
0
        public C_Brand GetBrand(string id)
        {
            SqlParameter[] parms = { new SqlParameter("@Id", SqlDbType.VarChar, 100) };
            parms[0].Value = SqlTypeConverter.DBNullStringChecker(id);

            C_Brand entity = null;

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Rs.Sql_C_Brand_Repository_GetBrand, parms)) {
                if (rdr.Read())
                {
                    entity             = new C_Brand();
                    entity.Id          = SqlTypeConverter.DBNullStringHandler(rdr["Id"]);
                    entity.Name        = SqlTypeConverter.DBNullStringHandler(rdr["Name"]);
                    entity.ProductorId = SqlTypeConverter.DBNullStringHandler(rdr["ProductorId"]);
                    entity.Comment     = SqlTypeConverter.DBNullStringHandler(rdr["Desc"]);
                    entity.Enabled     = SqlTypeConverter.DBNullBooleanHandler(rdr["Enabled"]);
                }
            }
            return(entity);
        }