/// <summary>
 /// Copies the elements of the specified <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> array to the end of the collection.
 /// </summary>
 /// <param name="value">An array of type <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> containing the Components to add to the collection.</param>
 public void AddRange(Shoplinkinfo[] value)
 {
     for (int i = 0; (i < value.Length); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
示例#2
0
            /// <summary>
            /// 获得店铺友情链接信息(DTO)
            /// </summary>
            /// <param name="__idatareader">要转换的数据</param>
            /// <returns>返回店铺友情链接信息</returns>
            public static Shoplinkinfo GetShopLinkInfo(IDataReader reader)
            {
                if (reader == null)
                    return null;

                Shoplinkinfo shopLinkInfo = new Shoplinkinfo();
                if (reader.Read())
                {
                    shopLinkInfo.Id = TypeConverter.ObjectToInt(reader["id"]);
                    shopLinkInfo.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"]);
                    shopLinkInfo.Name = reader["name"].ToString().Trim();
                    shopLinkInfo.Linkshopid = TypeConverter.ObjectToInt(reader["linkshopid"]);
                    shopLinkInfo.Shopid = TypeConverter.ObjectToInt(reader["shopid"]);
                }
                reader.Close();
                return shopLinkInfo;
            }
示例#3
0
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(Shoplinkinfo value)
 {
     return(this.List.Contains(value));
 }
示例#4
0
 public int Add(Shoplinkinfo value)
 {
     return(this.List.Add(value));
 }
示例#5
0
 public void Remove(Shoplinkinfo value)
 {
     List.Remove(value);
 }
示例#6
0
 public void Insert(int index, Shoplinkinfo value)
 {
     List.Insert(index, value);
 }
示例#7
0
        /// <summary>
        /// 更新店铺友情链接
        /// </summary>
        /// <param name="shoplink">店铺友情链接信息</param>
        /// <returns></returns>
        public bool UpdateShopLink(Shoplinkinfo shopLink)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4,shopLink.Displayorder),
						DbHelper.MakeInParam("@name", (DbType)SqlDbType.NVarChar, 100,shopLink.Name),
						DbHelper.MakeInParam("@linkshopid", (DbType)SqlDbType.Int, 4,shopLink.Linkshopid),
						DbHelper.MakeInParam("@shopid", (DbType)SqlDbType.Int, 4,shopLink.Shopid),
   						DbHelper.MakeInParam("@id", (DbType)SqlDbType.Int, 4,shopLink.Id)
				};
            string commandText = String.Format("Update [{0}shoplinks]  Set [displayorder] = @displayorder, [name] = @name, [linkshopid] = @linkshopid, [shopid] = @shopid WHERE [id] = @id", BaseConfigs.GetTablePrefix);

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

            return true;
        }
示例#8
0
             /// <summary>
            /// 获得店铺友情链接信息(DTO)
            /// </summary>
            /// <param name="__idatareader">要转换的数据</param>
            /// <returns>返回店铺友情链接信息</returns>
            public static ShoplinkinfoCollection GetShopLinkList(IDataReader reader)
            {
                ShoplinkinfoCollection shopLinkInfoColl = new ShoplinkinfoCollection();

                while (reader.Read())
                {
                    Shoplinkinfo shoplinkinfo = new Shoplinkinfo();
                    shoplinkinfo.Id = TypeConverter.ObjectToInt(reader["id"]);
                    shoplinkinfo.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"]);
                    shoplinkinfo.Name = reader["name"].ToString().Trim();
                    shoplinkinfo.Linkshopid = TypeConverter.ObjectToInt(reader["linkshopid"]);
                    shoplinkinfo.Shopid = TypeConverter.ObjectToInt(reader["shopid"]);

                    shopLinkInfoColl.Add(shoplinkinfo);
                }
                reader.Close();
                return shopLinkInfoColl;
            }
示例#9
0
 /// <summary>
 /// 更新店铺友情链接
 /// </summary>
 /// <param name="shoplinkinfo">店铺友情链接信息</param>
 /// <returns>是否更新成功</returns>
 public static bool UpdateShopLink(Shoplinkinfo shopLinkInfo)
 {
     return DbProvider.GetInstance().UpdateShopLink(shopLinkInfo);
 }
 public int Add(Shoplinkinfo value)
 {
     return this.List.Add(value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> class containing the specified array of <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> Components.
 /// </summary>
 /// <param name="value">An array of <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> Components with which to initialize the collection. </param>
 public ShoplinkinfoCollection(Shoplinkinfo[] value)
 {
     this.AddRange(value);
 }
 public void Remove(Shoplinkinfo value)
 {
     List.Remove(value);
 }
 public void Insert(int index, Shoplinkinfo value)
 {
     List.Insert(index, value);
 }
 /// <summary>
 /// Gets the index in the collection of the specified <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref=" ShoplinkinfoCollection">ShoplinkinfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(Shoplinkinfo value)
 {
     return this.List.IndexOf(value);
 }
示例#15
0
            /// <summary>
            /// 获得店铺友情链接信息(DTO)
            /// </summary>
            /// <param name="__idatareader">要转换的数据表</param>
            /// <returns>返回店铺友情链接信息</returns>
            public static Shoplinkinfo[] GetShopLinkInfoArray(DataTable dt)
            {
                if (dt == null || dt.Rows.Count == 0)
                    return null;

                Shoplinkinfo[] shoplinkarray = new Shoplinkinfo[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    shoplinkarray[i] = new Shoplinkinfo();
                    shoplinkarray[i].Id = TypeConverter.ObjectToInt(dt.Rows[i]["id"]);
                    shoplinkarray[i].Displayorder = TypeConverter.ObjectToInt(dt.Rows[i]["displayorder"]);
                    shoplinkarray[i].Name = dt.Rows[i]["name"].ToString();
                    shoplinkarray[i].Linkshopid = TypeConverter.ObjectToInt(dt.Rows[i]["linkshopid"]);
                    shoplinkarray[i].Shopid = TypeConverter.ObjectToInt(dt.Rows[i]["shopid"]);
                }
                dt.Dispose();
                return shoplinkarray;
            }
示例#16
0
 /// <summary>
 /// 创建店铺友情链接
 /// </summary>
 /// <param name="shoplinkinfo">店铺友情链接信息</param>
 /// <returns>创建店铺友情链接id</returns>
 public static int CreateShopLink(Shoplinkinfo shopLinkInfo)
 {
     return DbProvider.GetInstance().CreateShopLink(shopLinkInfo);
 }
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(Shoplinkinfo value)
 {
     return this.List.Contains(value);
 }
 /// <summary>
 /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
 /// <param name="index">The index of the array at which to begin inserting.</param>
 public void CopyTo(Shoplinkinfo[] array, int index)
 {
     this.List.CopyTo(array, index);
 }
示例#19
0
 /// <summary>
 /// Gets the index in the collection of the specified <see cref=" ShoplinkinfoCollection"> ShoplinkinfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref=" ShoplinkinfoCollection">ShoplinkinfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(Shoplinkinfo value)
 {
     return(this.List.IndexOf(value));
 }
示例#20
0
        protected override void ShowPage()
        {
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

            if (config.Enablemall < 2)
            {
                AddErrLine("当前操作只有在开启商城(高级)模式时才可以使用!");
                return;
            }

            user = Users.GetUserInfo(userid);

            shopinfo = Shops.GetShopByUserId(user.Uid);

            shoplinkinfolist = ShopLinks.GetShopLinkByShopId(shopinfo.Shopid);
            //如果不是提交...
            if (ispost)
            { 
                string operation = DNTRequest.GetString("operation");

                if (operation == "")
                    operation = "add";

                switch (operation)
                {
                    case "add": //添加店铺友情链接
                        {
                            if (shoplinkinfolist.Count >= 16)
                            {
                                AddErrLine("目前系统允许您最多添加 20 个友情链接");
                                return;
                            }

                            string addusername = DNTRequest.GetString("username");
                            if (addusername == "")
                            {
                                AddErrLine("请输入店主姓名!");
                                return;
                            }

                            int adduserid = Users.GetUserId(addusername);
                            if (adduserid < 0)
                            {
                                AddErrLine("用户名不存在!");
                                return;
                            }
                            if (adduserid == userid)
                            {
                                AddErrLine("店主不能将本人店铺作为友情链接!");
                                return;
                            }

                            Shopinfo add_shopinfo = Shops.GetShopByUserId(Users.GetUserId(addusername));
                            if (add_shopinfo == null && add_shopinfo.Shopid <= 0)
                            {
                                AddErrLine("用户:" + addusername + " 未在本站开店,因此无法添加该友情链接");
                                return;
                            }

                            Shoplinkinfo shoplinkinfo = new Shoplinkinfo();
                            shoplinkinfo.Displayorder = 0;
                            shoplinkinfo.Name = add_shopinfo.Shopname;
                            shoplinkinfo.Linkshopid = add_shopinfo.Shopid;
                            shoplinkinfo.Shopid = shopinfo.Shopid;
                            ShopLinks.CreateShopLink(shoplinkinfo);
                            break;
                        }
                    case "delete": //删除店铺友情链接
                        {
                            string delshoplink = DNTRequest.GetString("shoplinkid");
                            if (delshoplink == "")
                            {
                                AddErrLine("您未选中友情链接");
                                return;
                            }
                            ShopLinks.DeleteShopLink(delshoplink);
                            break;
                        }
                    case "updatedisplayorder": //更新店铺友情链接显示顺序
                        {
                            foreach (Shoplinkinfo shoplinkinfo in shoplinkinfolist)
                            {
                                //当显示顺序值发生变化时,则更新相应的信息
                                if (shoplinkinfo.Displayorder != DNTRequest.GetInt("displayorder_" + shoplinkinfo.Id, 0))
                                {
                                    shoplinkinfo.Displayorder = DNTRequest.GetInt("displayorder_" + shoplinkinfo.Id, 0);
                                    ShopLinks.UpdateShopLink(shoplinkinfo);
                                }
                            }
                            break;
                        }
                }

                SetUrl("usercpshoplink.aspx");
                SetMetaRefresh();
                AddMsgLine("操作成功. <br />(<a href=\"usercpshoplink.aspx\">点击这里返回</a>)<br />");      
            }
        }
示例#21
0
        /// <summary>
        /// 创建店铺友情链接
        /// </summary>
        /// <param name="shoplink">店铺友情链接信息</param>
        /// <returns></returns>
        public int CreateShopLink(Shoplinkinfo shopLink)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4,shopLink.Displayorder),
						DbHelper.MakeInParam("@name", (DbType)SqlDbType.NVarChar, 100,shopLink.Name),
						DbHelper.MakeInParam("@linkshopid", (DbType)SqlDbType.Int, 4,shopLink.Linkshopid),
						DbHelper.MakeInParam("@shopid", (DbType)SqlDbType.Int, 4,shopLink.Shopid)
				};
            string commandText = String.Format("INSERT INTO [{0}shoplinks] ([displayorder], [name], [linkshopid], [shopid]) VALUES (@displayorder, @name, @linkshopid, @shopid);SELECT SCOPE_IDENTITY()  AS 'id'", BaseConfigs.GetTablePrefix);

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