Ejemplo n.º 1
0
        public void AddAlbumCategory(AlbumCategoryInfo aci)
        {
            DbParameter[] parms = {
                                        DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50, aci.Title),
                                        DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 300, aci.Description),
                                        DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, aci.Displayorder)
                                };

            string commandText = string.Format(@"INSERT INTO [{0}albumcategories]([title], [description], [albumcount], [displayorder]) VALUES(@title, @description, 0, @displayorder)", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
        }
Ejemplo n.º 2
0
        public SAS.Common.Generic.List<AlbumCategoryInfo> GetAlbumCategory()
        {
            string commandText = string.Format("SELECT * FROM [{0}albumcategories] ORDER BY [displayorder]", BaseConfigs.GetTablePrefix);

            IDataReader reader = DbHelper.ExecuteReader(CommandType.Text, commandText);
            SAS.Common.Generic.List<AlbumCategoryInfo> acic = new SAS.Common.Generic.List<AlbumCategoryInfo>();
            while (reader.Read())
            {
                AlbumCategoryInfo aci = new AlbumCategoryInfo();
                aci.Albumcateid = TypeConverter.ObjectToInt(reader["albumcateid"], 0);
                aci.Albumcount = TypeConverter.ObjectToInt(reader["albumcount"], 0);
                aci.Description = reader["description"].ToString();
                aci.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"], 0);
                aci.Title = reader["title"].ToString();
                acic.Add(aci);
            }
            reader.Close();
            return acic;
        }