public void UpdateBannerLocation(BannerLocation loc) { DataCommand dc = DataCommandManager.GetDataCommand("Banner_UpdateBannerLocation"); dc.SetParameterValue(loc); dc.ExecuteNonQuery(); }
private void CreateBanner(BannerLocation bannerLocation) { _bannerDA.CreateBannerInfo(bannerLocation.Infos); _bannerDA.CreateBannerLocation(bannerLocation); //创建广告和主要投放区域之间的关系 foreach (var area in bannerLocation.AreaShow) { ObjectFactory <IAreaRelationDA> .Instance.Create(area, bannerLocation.SysNo.Value, AreaRelationType.Banner); } }
public void CreateBannerLocation(BannerLocation loc) { DataCommand dc = DataCommandManager.GetDataCommand("Banner_InsertBannerLocation"); dc.SetParameterValue(loc); dc.ExecuteNonQuery(); loc.SysNo = Convert.ToInt32(dc.GetParameterValue("@SysNo")); }
//通过前台3级类别找到对应的后台3级类别, //然后把与后台3级类别对用的所有前台3级类别找出来,所有类别都插入记录 private void ProcessECCategory3Extend(BannerLocation bannerLocation) { if (bannerLocation.IsExtendValid && bannerLocation.Status == ADStatus.Active) { if (bannerLocation.PageID.HasValue) { var relatedECCategory3List = ObjectFactory <IECCategoryDA> .Instance.GetRelatedECCategory3SysNo(bannerLocation.PageID.Value); foreach (var c3 in relatedECCategory3List) { bannerLocation.PageID = c3.SysNo; CreateBanner(bannerLocation); } } } }
/// <summary> /// 更新广告信息 /// </summary> /// <param name="bannerLocation">广告信息</param> public virtual void Update(BannerLocation bannerLocation) { if (!bannerLocation.BeginDate.HasValue) { bannerLocation.BeginDate = DateTime.Now; } Validate(bannerLocation); using (TransactionScope ts = new TransactionScope()) { //1.更新广告和主要投放区域之间的关系 var orginal = Load(bannerLocation.SysNo.Value); var temp = bannerLocation.AreaShow.Intersect(orginal.AreaShow).ToList <int>(); //不在交集中的就删除 foreach (int r in orginal.AreaShow.Except(temp).ToList <int>()) { ObjectFactory <IAreaRelationDA> .Instance.Delete(r, bannerLocation.SysNo.Value, AreaRelationType.Banner); } //不在交集中的就新增 foreach (int r in bannerLocation.AreaShow.Except(temp).ToList <int>()) { ObjectFactory <IAreaRelationDA> .Instance.Create(r, bannerLocation.SysNo.Value, AreaRelationType.Banner); } //2.持久化广告信息 bannerLocation.Infos.Status = bannerLocation.Status; _bannerDA.UpdateBannerInfo(bannerLocation.Infos); _bannerDA.UpdateBannerLocation(bannerLocation); //TODO:写入修改日志 ExternalDomainBroker.CreateOperationLog( String.Format("{0}{1}SysNo:{2}| 广告类型:{3}| 广告标题:{4} | 资源地址:{5} | 链接地址:{6} | 广告脚本{7}| 状态:{8}", DateTime.Now.ToString(), ResouceManager.GetMessageString("MKT.Banner", "Banner_Update") , bannerLocation.SysNo, bannerLocation.Infos.BannerType , bannerLocation.Infos.BannerTitle , bannerLocation.Infos.BannerResourceUrl , bannerLocation.Infos.BannerLink , bannerLocation.Infos.BannerOnClick , bannerLocation.Infos.Status == ADStatus.Active ? "有效" : "无效") , BizEntity.Common.BizLogType.Banner_Update , bannerLocation.SysNo.Value, bannerLocation.CompanyCode); ts.Complete(); } }
private void Validate(BannerLocation loc) { //BeginDate不能大于EndDate if (loc.BeginDate.HasValue && loc.EndDate.HasValue && loc.BeginDate.Value > loc.EndDate.Value) { //throw new BizException("开始时间不能大于结束时间。"); throw new BizException(ResouceManager.GetMessageString("MKT.Banner", "Banner_BeginDateEndDateInvalid")); } ////投放地区必须选一个 //if (loc.AreaShow == null || loc.AreaShow.Count == 0) //{ // throw new BizException("主要投放区域至少选一个。"); //} //验证广告位是否存在 var bd = ObjectFactory <IBannerDimensionDA> .Instance.LoadBannerDimension(loc.BannerDimensionSysNo); if (bd == null) { //throw new BizException("广告对应的位置在系统中不存在。"); throw new BizException(ResouceManager.GetMessageString("MKT.Banner", "Banner_BannerDimensionNotExists")); } }
/// <summary> /// 创建广告信息 /// </summary> /// <param name="bannerLocation">广告信息</param> public virtual void Create(BannerLocation bannerLocation) { if (!bannerLocation.BeginDate.HasValue) { bannerLocation.BeginDate = DateTime.Now; } Validate(bannerLocation); using (TransactionScope ts = new TransactionScope()) { //新建广告 CreateBanner(bannerLocation); //处理三级分类扩展生效 ProcessECCategory3Extend(bannerLocation); //TODO:写入创建日志 ExternalDomainBroker.CreateOperationLog( String.Format("{0}{1}SysNo:{2}", DateTime.Now.ToString(), ResouceManager.GetMessageString("MKT.Banner", "Banner_Add") , bannerLocation.SysNo) , BizEntity.Common.BizLogType.Banner_Add , bannerLocation.SysNo.Value, bannerLocation.CompanyCode); ts.Complete(); } }
public virtual void UpdateBanner(BannerLocation bannerLocation) { _bannerAppService.Update(bannerLocation); }
/// <summary> /// 更新广告信息 /// </summary> /// <param name="bannerLocation">广告信息</param> public virtual void Update(BannerLocation bannerLocation) { _bannerProcessor.Update(bannerLocation); }
/// <summary> /// 创建广告信息 /// </summary> /// <param name="bannerLocation">广告信息</param> public virtual void Create(BannerLocation bannerLocation) { _bannerProcessor.Create(bannerLocation); }