Example #1
0
        /// <summary>
        /// 从IDataReader创建AdvertPositionInfo
        /// </summary>
        public static BannerPositionInfo BuildBannerPositionFromReader(IDataReader reader)
        {
            BannerPositionInfo bannerPositionInfo = new BannerPositionInfo();

            bannerPositionInfo.BanPosId    = TypeHelper.ObjectToInt(reader["banposId"]);
            bannerPositionInfo.Title       = reader["title"].ToString();
            bannerPositionInfo.Description = reader["description"].ToString();

            return(bannerPositionInfo);
        }
Example #2
0
        /// <summary>
        /// 获得广告位置
        /// </summary>
        /// <param name="adPosId">广告位置id</param>
        /// <returns></returns>
        public static BannerPositionInfo GetBannerPositionById(int banPosId)
        {
            BannerPositionInfo bannerPositionInfo = null;
            IDataReader        reader             = BonSite.Core.BSData.RDBS.AdminGetBannerPositionByBanPosId(banPosId);

            if (reader.Read())
            {
                bannerPositionInfo = BuildBannerPositionFromReader(reader);
            }
            reader.Close();
            return(bannerPositionInfo);
        }
Example #3
0
        /// <summary>
        /// 获得Banner位置列表
        /// </summary>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public static List <BannerPositionInfo> GetBannerPositionList()
        {
            List <BannerPositionInfo> bannerPositionList = new List <BannerPositionInfo>();
            IDataReader reader = BonSite.Core.BSData.RDBS.AdminGetBannerPositionList();

            while (reader.Read())
            {
                BannerPositionInfo bannerPositionInfo = BuildBannerPositionFromReader(reader);
                bannerPositionList.Add(bannerPositionInfo);
            }
            reader.Close();
            return(bannerPositionList);
        }
        public ActionResult EditBannerPosition(int id = -1)
        {
            BannerPositionInfo banPositionInfo = Banners.GetBannerPositionById(id);

            if (banPositionInfo == null)
            {
                return(PromptView("Banner位置不存在"));
            }

            BannerPositionModel model = new BannerPositionModel()
            {
                Title       = banPositionInfo.Title,
                Description = banPositionInfo.Description
            };

            ViewData["referer"] = SiteUtils.GetAdminRefererCookie();
            return(View(model));
        }
        public ActionResult AddBannerPosition(BannerPositionModel model)
        {
            if (ModelState.IsValid)
            {
                BannerPositionInfo bannerPositionInfo = new BannerPositionInfo()
                {
                    Title       = model.Title,
                    Description = model.Description
                };

                Banners.CreateBannerPosition(bannerPositionInfo);

                //AddAdminOperateLog("添加广告位置", "添加广告位置,广告位置为:" + model.Title);
                return(PromptView("广告位置添加成功"));
            }
            ViewData["referer"] = SiteUtils.GetAdminRefererCookie();
            return(View(model));
        }
        public ActionResult EditBannerPosition(BannerPositionModel model, int id = -1)
        {
            BannerPositionInfo bannerPositionInfo = Banners.GetBannerPositionById(id);

            if (bannerPositionInfo == null)
            {
                return(PromptView("Banner位置不存在"));
            }

            if (ModelState.IsValid)
            {
                bannerPositionInfo.Title       = model.Title;
                bannerPositionInfo.Description = model.Description;

                Banners.UpdateBannerPosition(bannerPositionInfo);

                return(PromptView("Banner位置修改成功!"));
            }
            ViewData["referer"] = SiteUtils.GetAdminRefererCookie();
            return(View(model));
        }
Example #7
0
 /// <summary>
 /// 更新广告位置
 /// </summary>
 public static void UpdateBannerPosition(BannerPositionInfo bannerPositionInfo)
 {
     BonSite.Core.BSData.RDBS.UpdateBannerPosition(bannerPositionInfo);
 }
Example #8
0
 /// <summary>
 /// 更新banner位置
 /// </summary>
 public static void UpdateBannerPosition(BannerPositionInfo bannerPositionInfo)
 {
     BonSite.Data.Banners.UpdateBannerPosition(bannerPositionInfo);
 }