Ejemplo n.º 1
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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 3
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);
            }
Ejemplo n.º 4
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 />");
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新店铺友情链接
 /// </summary>
 /// <param name="shoplinkinfo">店铺友情链接信息</param>
 /// <returns>是否更新成功</returns>
 public static bool UpdateShopLink(Shoplinkinfo shopLinkInfo)
 {
     return(DbProvider.GetInstance().UpdateShopLink(shopLinkInfo));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 创建店铺友情链接
 /// </summary>
 /// <param name="shoplinkinfo">店铺友情链接信息</param>
 /// <returns>创建店铺友情链接id</returns>
 public static int CreateShopLink(Shoplinkinfo shopLinkInfo)
 {
     return(DbProvider.GetInstance().CreateShopLink(shopLinkInfo));
 }