예제 #1
0
 /// <summary>
 /// 更新广告
 /// </summary>
 public static void UpdateAdvert(int oldAdPosId, AdvertInfo advertInfo)
 {
     BrnMall.Data.Adverts.UpdateAdvert(advertInfo);
     if (oldAdPosId == advertInfo.AdPosId)
     {
         BrnMall.Core.BMACache.Remove(CacheKeys.MALL_ADVERT_LIST + advertInfo.AdPosId);
     }
     else
     {
         BrnMall.Core.BMACache.Remove(CacheKeys.MALL_ADVERT_LIST + oldAdPosId);
         BrnMall.Core.BMACache.Remove(CacheKeys.MALL_ADVERT_LIST + advertInfo.AdPosId);
     }
 }
예제 #2
0
파일: Adverts.cs 프로젝트: qq550723504/zone
        /// <summary>
        /// 从IDataReader创建AdvertInfo
        /// </summary>
        public static AdvertInfo BuildAdvertFromReader(IDataReader reader)
        {
            AdvertInfo advertInfo = new AdvertInfo();

            advertInfo.AdId = TypeHelper.ObjectToInt(reader["adid"]);
            advertInfo.ClickCount = TypeHelper.ObjectToInt(reader["clickcount"]);
            advertInfo.AdPosId = TypeHelper.ObjectToInt(reader["adposid"]);
            advertInfo.State = TypeHelper.ObjectToInt(reader["state"]);
            advertInfo.StartTime = TypeHelper.ObjectToDateTime(reader["starttime"]);
            advertInfo.EndTime = TypeHelper.ObjectToDateTime(reader["endtime"]);
            advertInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]);
            advertInfo.Type = TypeHelper.ObjectToInt(reader["type"]);
            advertInfo.Title = reader["title"].ToString();
            advertInfo.Url = reader["url"].ToString();
            advertInfo.Body = reader["body"].ToString();
            advertInfo.ExtField1 = reader["extfield1"].ToString();
            advertInfo.ExtField2 = reader["extfield2"].ToString();
            advertInfo.ExtField3 = reader["extfield3"].ToString();
            advertInfo.ExtField4 = reader["extfield4"].ToString();
            advertInfo.ExtField5 = reader["extfield5"].ToString();

            return advertInfo;
        }
예제 #3
0
파일: Adverts.cs 프로젝트: qq550723504/zone
 /// <summary>
 /// 更新广告
 /// </summary>
 public static void UpdateAdvert(AdvertInfo advertInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateAdvert(advertInfo);
 }
예제 #4
0
 /// <summary>
 /// 更新广告
 /// </summary>
 public void UpdateAdvert(AdvertInfo advertInfo)
 {
     DbParameter[] param = {
                              GenerateInParam("@clickcount",SqlDbType.Int, 4, advertInfo.ClickCount),
                              GenerateInParam("@adposid",SqlDbType.SmallInt, 2, advertInfo.AdPosId),
                              GenerateInParam("@state",SqlDbType.TinyInt, 1, advertInfo.State),
                              GenerateInParam("@starttime",SqlDbType.DateTime, 8, advertInfo.StartTime),
                              GenerateInParam("@endtime",SqlDbType.DateTime, 8, advertInfo.EndTime),
                              GenerateInParam("@displayorder",SqlDbType.Int, 4, advertInfo.DisplayOrder),
                              GenerateInParam("@type",SqlDbType.TinyInt, 1, advertInfo.Type),
                              GenerateInParam("@title",SqlDbType.NVarChar, 50, advertInfo.Title),
                              GenerateInParam("@url",SqlDbType.NVarChar, 200, advertInfo.Url),
                              GenerateInParam("@body",SqlDbType.NVarChar, 800, advertInfo.Body),
                              GenerateInParam("@extfield1",SqlDbType.NVarChar, 500, advertInfo.ExtField1),
                              GenerateInParam("@extfield2",SqlDbType.NVarChar, 500, advertInfo.ExtField2),
                              GenerateInParam("@extfield3",SqlDbType.NVarChar, 500, advertInfo.ExtField3),
                              GenerateInParam("@extfield4",SqlDbType.NVarChar, 500, advertInfo.ExtField4),
                              GenerateInParam("@extfield5",SqlDbType.NVarChar, 500, advertInfo.ExtField5),
                              GenerateInParam("@adid",SqlDbType.Int, 4, advertInfo.AdId)
                            };
     string commandText = String.Format("UPDATE [{0}adverts] SET [clickcount]=@clickcount,[adposid]=@adposid,[state]=@state,[starttime]=@starttime,[endtime]=@endtime,[displayorder]=@displayorder,[type]=@type,[title]=@title,[url]=@url,[body]=@body,[extfield1]=@extfield1,[extfield2]=@extfield2,[extfield3]=@extfield3,[extfield4]=@extfield4,[extfield5]=@extfield5 WHERE [adid]=@adid",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, param);
 }
예제 #5
0
 /// <summary>
 /// 创建广告
 /// </summary>
 public void CreateAdvert(AdvertInfo advertInfo)
 {
     DbParameter[] param = {
                              GenerateInParam("@clickcount",SqlDbType.Int, 4, advertInfo.ClickCount),
                              GenerateInParam("@adposid",SqlDbType.SmallInt, 2, advertInfo.AdPosId),
                              GenerateInParam("@state",SqlDbType.TinyInt, 1, advertInfo.State),
                              GenerateInParam("@starttime",SqlDbType.DateTime, 8, advertInfo.StartTime),
                              GenerateInParam("@endtime",SqlDbType.DateTime, 8, advertInfo.EndTime),
                              GenerateInParam("@displayorder",SqlDbType.Int, 4, advertInfo.DisplayOrder),
                              GenerateInParam("@type",SqlDbType.TinyInt, 1, advertInfo.Type),
                              GenerateInParam("@title",SqlDbType.NVarChar, 50, advertInfo.Title),
                              GenerateInParam("@url",SqlDbType.NVarChar, 200, advertInfo.Url),
                              GenerateInParam("@body",SqlDbType.NVarChar, 800, advertInfo.Body),
                              GenerateInParam("@extfield1",SqlDbType.NVarChar, 500, advertInfo.ExtField1),
                              GenerateInParam("@extfield2",SqlDbType.NVarChar, 500, advertInfo.ExtField2),
                              GenerateInParam("@extfield3",SqlDbType.NVarChar, 500, advertInfo.ExtField3),
                              GenerateInParam("@extfield4",SqlDbType.NVarChar, 500, advertInfo.ExtField4),
                              GenerateInParam("@extfield5",SqlDbType.NVarChar, 500, advertInfo.ExtField5)
                            };
     string commandText = String.Format("INSERT INTO [{0}adverts]([clickcount],[adposid],[state],[starttime],[endtime],[displayorder],[type],[title],[url],[body],[extfield1],[extfield2],[extfield3],[extfield4],[extfield5]) VALUES(@clickcount,@adposid,@state,@starttime,@endtime,@displayorder,@type,@title,@url,@body,@extfield1,@extfield2,@extfield3,@extfield4,@extfield5)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, param);
 }
예제 #6
0
 /// <summary>
 /// 创建广告
 /// </summary>
 public static void CreateAdvert(AdvertInfo advertInfo)
 {
     BrnMall.Data.Adverts.CreateAdvert(advertInfo);
     BrnMall.Core.BMACache.Remove(CacheKeys.MALL_ADVERT_LIST + advertInfo.AdPosId);
 }
예제 #7
0
        public ActionResult AddAdvert(AdvertModel model)
        {
            if (AdminAdverts.GetAdvertPositionById(model.AdPosId) == null)
                ModelState.AddModelError("AdPosId", "广告位置不存在");

            if (ModelState.IsValid)
            {
                AdvertInfo advertInfo = new AdvertInfo()
                {
                    ClickCount = 0,
                    AdPosId = model.AdPosId,
                    Type = model.Type,
                    Title = model.Title,
                    Body = model.Body,
                    Url = model.Url ?? "",
                    StartTime = model.StartTime,
                    EndTime = model.EndTime,
                    ExtField1 = model.ExtField1 ?? "",
                    ExtField2 = model.ExtField2 ?? "",
                    ExtField3 = model.ExtField3 ?? "",
                    ExtField4 = model.ExtField4 ?? "",
                    ExtField5 = model.ExtField5 ?? "",
                    State = model.State,
                    DisplayOrder = model.DisplayOrder
                };

                AdminAdverts.CreateAdvert(advertInfo);
                AddMallAdminLog("添加广告", "添加广告,广告为:" + model.Title);
                return PromptView("广告添加成功");
            }
            Load();
            return View(model);
        }