Example #1
0
            /// <summary>
            /// 获得店铺主题信息(DTO)
            /// </summary>
            /// <param name="__idatareader">要转换的数据</param>
            /// <returns>返回店铺主题信息</returns>
            public static Shopthemeinfo GetShopThemeInfo(IDataReader reader)
            {
                Shopthemeinfo shopThemeInfo = null;
                if (reader.Read())
                {
                    shopThemeInfo = new Shopthemeinfo();
                    shopThemeInfo.Themeid = TypeConverter.ObjectToInt(reader["themeid"]);
                    shopThemeInfo.Directory = reader["directory"].ToString().Trim();
                    shopThemeInfo.Name = reader["name"].ToString().Trim();
                    shopThemeInfo.Author = reader["author"].ToString().Trim();
                    shopThemeInfo.Createdate = reader["createdate"].ToString().Trim();
                    shopThemeInfo.Copyright = reader["copyright"].ToString().Trim();

                    reader.Close();
                }
                return shopThemeInfo;
            }
Example #2
0
 /// <summary>
 /// 更新店铺主题
 /// </summary>
 /// <param name="shopinfo">店铺信息</param>
 /// <returns>更新是否成功</returns>
 public static bool UpdateShop(Shopthemeinfo shopThemeInfo)
 {
     return DbProvider.GetInstance().UpdateShopTheme(shopThemeInfo);
 }
Example #3
0
 /// <summary>
 /// 创建店铺主题
 /// </summary>
 /// <param name="shopinfo">店铺信息</param>
 /// <returns>创建店铺主题id</returns>
 public static int CreateShop(Shopthemeinfo shopThemeInfo)
 {
     return DbProvider.GetInstance().CreateShopTheme(shopThemeInfo);
 }
Example #4
0
            /// <summary>
            /// 获得店铺主题信息(DTO)
            /// </summary>
            /// <param name="__idatareader">要转换的数据表</param>
            /// <returns>返回店铺主题信息</returns>
            public static Shopthemeinfo[] GetShopThemeInfoArray(DataTable dt)
            {
                if (dt == null || dt.Rows.Count == 0)
                    return null;

                Shopthemeinfo[] shopThemeInfoArray = new Shopthemeinfo[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    shopThemeInfoArray[i] = new Shopthemeinfo();
                    shopThemeInfoArray[i].Themeid = TypeConverter.ObjectToInt(dt.Rows[i]["themeid"]);
                    shopThemeInfoArray[i].Directory = dt.Rows[i]["directory"].ToString();
                    shopThemeInfoArray[i].Name = dt.Rows[i]["name"].ToString();
                    shopThemeInfoArray[i].Author = dt.Rows[i]["author"].ToString();
                    shopThemeInfoArray[i].Createdate = dt.Rows[i]["createdate"].ToString();
                    shopThemeInfoArray[i].Copyright = dt.Rows[i]["copyright"].ToString();
                }
                dt.Dispose();
                return shopThemeInfoArray;
            }
Example #5
0
        /// <summary>
        /// 更新店铺主题
        /// </summary>
        /// <param name="shopthemeinfo">店铺主题信息</param>
        /// <returns></returns>
        public bool UpdateShopTheme(Shopthemeinfo shopThemeInfo)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@directory", (DbType)SqlDbType.VarChar, 100,shopThemeInfo.Directory),
						DbHelper.MakeInParam("@name", (DbType)SqlDbType.NVarChar, 50,shopThemeInfo.Name),
						DbHelper.MakeInParam("@author", (DbType)SqlDbType.NVarChar, 100,shopThemeInfo.Author),
						DbHelper.MakeInParam("@createdate", (DbType)SqlDbType.NVarChar, 50,shopThemeInfo.Createdate),
						DbHelper.MakeInParam("@copyright", (DbType)SqlDbType.NVarChar, 100,shopThemeInfo.Copyright),
                    	DbHelper.MakeInParam("@themeid", (DbType)SqlDbType.Int, 4,shopThemeInfo.Themeid)
				};
            string commandText = String.Format("Update [{0}shopthemes]  Set [directory] = @directory, [name] = @name, [author] = @author, [createdate] = @createdate, [copyright] = @copyright WHERE [themeid] = @themeid", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);

            return true;
        }
Example #6
0
        /// <summary>
        /// 创建店铺主题
        /// </summary>
        /// <param name="shopthemeinfo">店铺主题信息</param>
        /// <returns></returns>
        public int CreateShopTheme(Shopthemeinfo shopThemeInfo)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@directory", (DbType)SqlDbType.VarChar, 100,shopThemeInfo.Directory),
						DbHelper.MakeInParam("@name", (DbType)SqlDbType.NVarChar, 50,shopThemeInfo.Name),
						DbHelper.MakeInParam("@author", (DbType)SqlDbType.NVarChar, 100,shopThemeInfo.Author),
						DbHelper.MakeInParam("@createdate", (DbType)SqlDbType.NVarChar, 50,shopThemeInfo.Createdate),
						DbHelper.MakeInParam("@copyright", (DbType)SqlDbType.NVarChar, 100,shopThemeInfo.Copyright)
				};
            string commandText = String.Format("INSERT INTO [{0}shopthemes] ([directory], [name], [author], [createdate], [copyright]) VALUES (@directory, @name, @author, @createdate, @copyright);SELECT SCOPE_IDENTITY()  AS 'id'", BaseConfigs.GetTablePrefix);

            return TypeConverter.ObjectToInt(DbHelper.ExecuteDataset(CommandType.Text, commandText, parms).Tables[0].Rows[0][0], -1);
        }