/// <summary> /// 删除广告 /// </summary> /// <param name="advId">广告编号</param> /// <returns></returns> public virtual bool DeleteAdv(int advId) { EyouSoft.Model.AdvStructure.AdvInfo adv = GetAdvInfo(advId); if (adv != null) { DbCommand cmd = base.SystemStore.GetSqlStringCommand("A"); EyouSoft.Model.AdvStructure.AdvDisplayType DisplayType = GetPositionInfo(adv.Position).DisplayType; if (DisplayType != EyouSoft.Model.AdvStructure.AdvDisplayType.单位图片广告 && DisplayType != EyouSoft.Model.AdvStructure.AdvDisplayType.单位图文广告 && DisplayType != EyouSoft.Model.AdvStructure.AdvDisplayType.单位文字广告) { cmd = base.SystemStore.GetSqlStringCommand(SQL_DELETEDFILE_DELETEMOVE + SQL_DELETE_DeleteAdv); } else { cmd = base.SystemStore.GetSqlStringCommand(SQL_DELETE_DeleteAdv); } base.SystemStore.AddInParameter(cmd, "AdvId", DbType.Int32, advId); return(DbHelper.ExecuteSql(cmd, base.SystemStore) > 0 ? true : false); } else { return(false); } }
/// <summary> /// 发布广告 /// </summary> /// <param name="info">广告信息业务实体</param> /// <returns>1:成功 0:失败</returns> public virtual int InsertAdv(EyouSoft.Model.AdvStructure.AdvInfo info) { DbCommand cmd = base.SystemStore.GetStoredProcCommand("proc_SysAdv_InsertAdv"); base.SystemStore.AddInParameter(cmd, "PositionId", DbType.Int32, info.Position); base.SystemStore.AddInParameter(cmd, "CategoryId", DbType.Int32, info.Category); base.SystemStore.AddInParameter(cmd, "Title", DbType.String, info.Title); base.SystemStore.AddInParameter(cmd, "Remark", DbType.String, info.Remark); base.SystemStore.AddInParameter(cmd, "RedirectURL", DbType.String, info.RedirectURL); base.SystemStore.AddInParameter(cmd, "ImgPath", DbType.String, info.ImgPath); base.SystemStore.AddInParameter(cmd, "AdvThumbnail", DbType.String, info.AdvThumb); base.SystemStore.AddInParameter(cmd, "CompanyId", DbType.String, info.CompanyId); base.SystemStore.AddInParameter(cmd, "CompanyName", DbType.String, info.CompanyName); base.SystemStore.AddInParameter(cmd, "ContactInfo", DbType.String, info.ContactInfo); base.SystemStore.AddInParameter(cmd, "StartDate", DbType.DateTime, info.StartDate); base.SystemStore.AddInParameter(cmd, "EndDate", DbType.DateTime, info.EndDate); base.SystemStore.AddInParameter(cmd, "OperatorId", DbType.Int32, info.OperatorId); base.SystemStore.AddInParameter(cmd, "OperatorName", DbType.String, info.OperatorName); base.SystemStore.AddInParameter(cmd, "IssueTime", DbType.DateTime, info.IssueTime); base.SystemStore.AddInParameter(cmd, "Range", DbType.Int32, info.Range); base.SystemStore.AddInParameter(cmd, "Relation", DbType.String, this.CreateRelationXML(info.Relation)); base.SystemStore.AddOutParameter(cmd, "Result", DbType.Int32, 4); base.SystemStore.AddOutParameter(cmd, "AdvId", DbType.Int32, 4); DbHelper.ExecuteSql(cmd, base.SystemStore); int result = Convert.ToInt32(base.SystemStore.GetParameterValue(cmd, "Result")); if (result == 1) { info.AdvId = Convert.ToInt32(base.SystemStore.GetParameterValue(cmd, "AdvId")); } return(result); }
/// <summary> /// 酒店频道通栏广告图片 /// </summary> protected void ScenicAdvBannerSecond() { EyouSoft.Model.AdvStructure.AdvInfo model = GetAdvsModel(this.CityId, EyouSoft.Model.AdvStructure.AdvPosition.酒店频道通栏banner2); if (model != null) { this.litImgBoxBannerSecond.Text = Utils.GetImgOrFalash(model.ImgPath, model.RedirectURL); } model = null; }
/// <summary> /// 获取指定位置的广告信息集合 /// </summary> /// <param name="advType">广告投放类型</param> /// <param name="relationId">关联编号(城市或单位类型编号)</param> /// <param name="position">广告位置</param> /// <param name="date">日期</param> /// <param name="expression">指定返回行数的数值表达式</param> /// <param name="isPlatformAd">是否取广告类别为同业114广告</param> /// <returns></returns> public virtual IList <EyouSoft.Model.AdvStructure.AdvInfo> GetAdvs(EyouSoft.Model.AdvStructure.AdvType advType, int relationId, EyouSoft.Model.AdvStructure.AdvPosition position, DateTime date, int expression, bool isPlatformAd) { IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = new List <EyouSoft.Model.AdvStructure.AdvInfo>(); StringBuilder cmdText = new StringBuilder(); cmdText.Append(" SELECT TOP (@Expression) A.Id,A.AdvDescript,A.AdvLink,B.AdvImg,B.AdvThumbnail,A.CompanyId,A.CompanyName,A.IssueTime,A.AdvRemark,D.MQ FROM tbl_SysAdv AS A "); cmdText.Append(" LEFT OUTER JOIN tbl_SysAdvImg AS B ON A.Id=B.AdvId "); cmdText.Append(" INNER JOIN tbl_SysAdvAreaControl AS C ON A.Id=C.AdvId AND C.AreaType=@AdvType AND C.AreaId=@RelationId "); cmdText.Append(" LEFT OUTER JOIN tbl_CompanyUser AS D ON A.CompanyId=D.CompanyId AND IsAdmin='1' "); cmdText.Append(" WHERE A.AreaId=@PositionId AND @Date BETWEEN A.StartDate AND A.EndDate "); if (isPlatformAd) { cmdText.Append(" AND A.ClassId=3 "); } else { cmdText.Append(" AND A.ClassId<3 "); } cmdText.Append(" ORDER BY C.SortId ASC,A.IssueTime ASC "); DbCommand cmd = base.SystemStore.GetSqlStringCommand(cmdText.ToString()); base.SystemStore.AddInParameter(cmd, "Expression", DbType.Int32, expression); base.SystemStore.AddInParameter(cmd, "AdvType", DbType.Byte, advType); base.SystemStore.AddInParameter(cmd, "RelationId", DbType.Int32, relationId); base.SystemStore.AddInParameter(cmd, "PositionId", DbType.Int32, position); base.SystemStore.AddInParameter(cmd, "Date", DbType.DateTime, date); using (IDataReader rdr = DbHelper.ExecuteReader(cmd, base.SystemStore)) { while (rdr.Read()) { EyouSoft.Model.AdvStructure.AdvInfo tmp = new EyouSoft.Model.AdvStructure.AdvInfo(); tmp.AdvId = rdr.GetInt32(0); tmp.Title = rdr[1].ToString(); tmp.RedirectURL = rdr[2].ToString(); tmp.ImgPath = rdr[3].ToString(); tmp.AdvThumb = rdr[4].ToString(); tmp.CompanyId = rdr.GetString(5); tmp.CompanyName = rdr[6].ToString(); tmp.IssueTime = rdr.GetDateTime(7); tmp.Remark = rdr[8].ToString(); tmp.ContactMQ = rdr[9].ToString(); advs.Add(tmp); } } return(advs); }
/// <summary> /// 获取首页广告banner(3) /// </summary> private void GetAdvImg() { EyouSoft.IBLL.AdvStructure.IAdv advBll = EyouSoft.BLL.AdvStructure.Adv.CreateInstance(); //获取通栏广告 EyouSoft.Model.AdvStructure.AdvInfo advModel = advBll.GetAdvs(CityId, EyouSoft.Model.AdvStructure.AdvPosition.首页资讯通栏广告).FirstOrDefault(); if (advModel != null) { bannerAdv = EyouSoft.Common.Utils.GetImgOrFalash(advModel.ImgPath, advModel.RedirectURL); } }
/// <summary> /// 获取广告信息 /// </summary> /// <param name="advId">广告编号</param> /// <returns></returns> public EyouSoft.Model.AdvStructure.AdvInfo GetAdvInfo(int advId) { EyouSoft.Model.AdvStructure.AdvInfo info = dal.GetAdvInfo(advId); if (info != null) { info.Relation = this.GetAdvRelations(info.AdvId, info.Range); } return(info); }
protected string noBannerAdv; //非通栏广告 protected void Page_Load(object sender, EventArgs e) { //获取非通栏广告 int cityId = (this.Page as EyouSoft.Common.Control.FrontPage).CityId; IList <EyouSoft.Model.AdvStructure.AdvInfo> noBannerAdvs = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetNotFillAdvs(cityId, EyouSoft.Model.AdvStructure.AdvPosition.首页资讯非通栏广告); EyouSoft.Model.AdvStructure.AdvInfo noBannerModel = noBannerAdvs.FirstOrDefault(); noBannerAdv = noBannerModel != null?String.Format("<a href=\"{0}\" target=\"_blank\"><img style=\"width:324px;height:60px;\" src=\"{3}{1}\" alt=\"{2}\"/></a>", noBannerModel.RedirectURL, noBannerModel.ImgPath, noBannerModel.Title, EyouSoft.Common.Domain.FileSystem) : "<img alt=\"\" style=\"width:324px;height:60px;\" />"; BindNews(); }
private void UpdateShowInfo(int advId, int position) { EyouSoft.Model.AdvStructure.AdvInfo advinfo = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvInfo(advId); if (advinfo != null) { DatePicker2.Value = advinfo.EndDate.ToString("yyyy-MM-dd"); txtUrl.Value = advinfo.RedirectURL == Utils.EmptyLinkCode ? "" : advinfo.RedirectURL; txtBuyUnit.Value = advinfo.CompanyName; txtLink.Value = advinfo.ContactInfo; txtOpearDate.Value = advinfo.IssueTime.ToString("yyyy-MM-dd"); txtOpearId.Value = advinfo.OperatorName; hdfUnitId.Value = advinfo.CompanyId; DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); txtDescription.Value = advinfo.Title; hdfUnitMQ.Value = advinfo.ContactMQ; txaContent.Value = advinfo.Remark; hdfAdRange.Value = advinfo.Range.ToString(); if (advinfo.EndDate.Date == DateTime.MaxValue.Date) { ckbDate.Checked = true; DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); pnlforver.Visible = false; } else { DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); DatePicker2.Value = advinfo.EndDate.ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(advinfo.ImgPath)) { ltr_ImagePath.Text = string.Format("<a id=\"imgpath\" href=\"{0}\"target='_blank' title=\"点击查看\">查看原图</a>", Domain.FileSystem + advinfo.ImgPath); hdfoldimgpath.Value = advinfo.ImgPath; } #region 判断是否为展示期==true?时间不能修改:可修改 if (DateTime.Now >= advinfo.StartDate && DateTime.Now <= advinfo.EndDate) { IsDateUpdate = false; ckbDate.Enabled = false; ckbDate.Visible = false; if (advinfo.EndDate.Date == DateTime.MaxValue.Date) { ckbDate.Enabled = true; IsDateUpdate = true; ckbDate.Visible = true; } } #endregion SourceBind((int)advinfo.Position, advinfo.Category.ToString()); BindRangeType(advinfo.Relation, advinfo.Range.ToString(), true); //绑定投放类型 advinfo = null; } }
/// <summary> /// 广告测试 /// </summary> private void AdvTest() { int recordCount = 0; IList <int> relation = new List <int>(); EyouSoft.IBLL.AdvStructure.IAdv bll = EyouSoft.BLL.AdvStructure.Adv.CreateInstance(); DateTime d1 = Convert.ToDateTime("2010-07-27"); DateTime d2 = Convert.ToDateTime("2010-08-06"); //bool val = bll.IsValid(EyouSoft.Model.AdvStructure.AdvPosition.供求信息频道促销广告, d1, d2, EyouSoft.Model.AdvStructure.AdvRange.全国, null); EyouSoft.Model.AdvStructure.AdvInfo advInfo = new EyouSoft.Model.AdvStructure.AdvInfo(); advInfo.Position = EyouSoft.Model.AdvStructure.AdvPosition.首页广告精品推荐图文; advInfo.Category = EyouSoft.Model.AdvStructure.AdvCategory.业114广告; advInfo.Title = "test title"; advInfo.Remark = "test content"; advInfo.RedirectURL = "www.baidu.com"; advInfo.ImgPath = "图片路径"; //advInfo.CompanyId = "1e5edc20-4b83-4c16-8c52-008e0c09bd1e"; //advInfo.CompanyName = "测试公司名称"; advInfo.ContactInfo = "联系信息"; advInfo.StartDate = d1; advInfo.EndDate = d2; advInfo.OperatorId = 4; advInfo.OperatorName = "汪奇志"; advInfo.IssueTime = DateTime.Now; advInfo.Range = EyouSoft.Model.AdvStructure.AdvRange.全国; advInfo.Relation = null; relation.Add(1); advInfo.Relation = relation; //Response.Write(bll.InsertAdv(advInfo)+"<br/>"); //advInfo.Range = EyouSoft.Model.AdvStructure.AdvRange.全国; //relation.Add(1); //relation.Add(2); //relation.Add(4); //relation.Add(17); //advInfo.Relation = relation; //advInfo.AdvId = 33; //advInfo.Title = "test title update"; //bll.UpdateAdv(advInfo); //前台 IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = bll.GetAdvs(362, EyouSoft.Model.AdvStructure.AdvPosition.首页广告优秀企业展示); //运营后台 //IList<EyouSoft.Model.AdvStructure.AdvInfo> advs1=bll.GetAdvs(10, 1,ref recordCount, EyouSoft.Model.AdvStructure.AdvPosition.车队频道旗帜广告1, 1, null,null, d1, d2); //bll.SetAdvSort(50, EyouSoft.Model.AdvStructure.AdvPosition.车队频道旗帜广告1, 2, 100); //Response.Write(advs.Count+"<br/>"+recordCount); }
/// <summary> /// 删除广告 /// </summary> /// <param name="advId">广告编号</param> /// <returns></returns> public bool DeleteAdv(int advId) { EyouSoft.Model.AdvStructure.AdvInfo adv = GetAdvInfo(advId); if (adv != null) { string cachename = string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, adv.Position.ToString()); EyouSoft.Cache.Facade.EyouSoftCache.Add(cachename, DateTime.Now); return(dal.DeleteAdv(advId)); } else { return(false); } }
/// <summary> /// 景区广告或者对象方法 /// </summary> protected EyouSoft.Model.AdvStructure.AdvInfo GetAdvsModel(int relationId, EyouSoft.Model.AdvStructure.AdvPosition advPosition) { EyouSoft.Model.AdvStructure.AdvInfo model = null; IList<EyouSoft.Model.AdvStructure.AdvInfo> advInfoList = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvs(relationId, advPosition); if (advInfoList.Count > 0) { model = advInfoList[0]; if (model != null) { return model; } } return null; }
/// <summary> /// 景区频道旗帜广告 /// </summary> protected void ScenicAdvFlagSecond() { EyouSoft.Model.AdvStructure.AdvInfo model = GetAdvsModel(Cid, EyouSoft.Model.AdvStructure.AdvPosition.景区频道旗帜广告2); if (model != null) { if (model.RedirectURL == Utils.EmptyLinkCode) { this.ltlImgAdvFlagSecond.Text = "<a target=\"_self\" href=\"" + model.RedirectURL + "\" ><img src=\"" + Domain.FileSystem + model.ImgPath.Trim() + "\" width=\"220px\" height=\"90px\"/></a>"; } else { this.ltlImgAdvFlagSecond.Text = "<a target=\"_blank\" href=\"" + model.RedirectURL + "\" ><img src=\"" + Domain.FileSystem + model.ImgPath.Trim() + "\" width=\"220px\" height=\"90px\"/></a>"; } } }
protected EyouSoft.Model.AdvStructure.AdvInfo adv = null; //供求广告BANNER protected void Page_Load(object sender, EventArgs e) { pa = (EyouSoft.Common.Control.FrontPage) this.Page; IList <EyouSoft.Model.AdvStructure.AdvInfo> advlist = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvs(pa.CityId, EyouSoft.Model.AdvStructure.AdvPosition.供求信息频道通栏banner); if (advlist != null && advlist.Count > 0) { adv = advlist[0]; } UserPublicCenter.MasterPage.NewPublicCenter masterPage = this.Master as UserPublicCenter.MasterPage.NewPublicCenter; if (masterPage != null) { masterPage.HeadMenuIndex = 6;//选中首页菜单项 } }
private void UpdateShowInfo(int advId, int position) { EyouSoft.Model.AdvStructure.AdvInfo advinfo = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvInfo(advId); if (advinfo != null) { DatePicker2.Value = advinfo.EndDate.ToString("yyyy-MM-dd"); txtBuyUnit.Value = advinfo.CompanyName; txtContact.Value = advinfo.ContactInfo; txtOperTime.Value = advinfo.IssueTime.ToString("yyyy-MM-dd"); txtOperator.Value = advinfo.OperatorName; hdfUnitId.Value = advinfo.CompanyId; DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); hdfUnitMQ.Value = advinfo.ContactMQ; txtTitle.Value = advinfo.Title; fckContent.Value = advinfo.Remark; hdfAdRange.Value = advinfo.Range.ToString(); if (advinfo.EndDate.Date == DateTime.MaxValue.Date) { ckbDate.Checked = true; DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); pnlforver.Visible = false; } else { DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); DatePicker2.Value = advinfo.EndDate.ToString("yyyy-MM-dd"); } #region 判断是否为展示期==true?时间不能修改:可修改 if (DateTime.Now >= advinfo.StartDate && DateTime.Now <= advinfo.EndDate) { IsDateUpdate = false; ckbDate.Enabled = false; ckbDate.Visible = false; if (advinfo.EndDate.Date == DateTime.MaxValue.Date) { IsDateUpdate = true; ckbDate.Enabled = true; ckbDate.Visible = true; } } #endregion SourceBind((int)advinfo.Position, advinfo.Category.ToString()); BindRangeType(advinfo.Relation, advinfo.Range.ToString(), true); advinfo = null; } }
/// <summary> /// 景区主题广告 /// </summary> protected void ScenicAdvTitle() { EyouSoft.Model.AdvStructure.AdvInfo model = GetAdvsModel(this.CityId, EyouSoft.Model.AdvStructure.AdvPosition.景区频道景区主题广告); if (model != null) { if (model.RedirectURL == Utils.EmptyLinkCode) { this.ltlImgTitleAdv.Text = "<a href=\"" + model.RedirectURL + "\" target=_self><img src=\"" + Domain.FileSystem + model.ImgPath.Trim() + "\" width=\"225px\" height=\"130px\"/></a>"; } else { this.ltlImgTitleAdv.Text = "<a href=\"" + model.RedirectURL + "\" target=_blank><img src=\"" + Domain.FileSystem + model.ImgPath.Trim() + "\" width=\"225px\" height=\"130px\"/></a>"; } } model = null; }
/// <summary> /// 是否有效 /// </summary> /// <param name="info">广告信息业务实体</param> /// <returns></returns> public virtual bool IsValid(EyouSoft.Model.AdvStructure.AdvInfo info) { DbCommand cmd = base.SystemStore.GetStoredProcCommand("proc_SysAdv_IsValid"); base.SystemStore.AddInParameter(cmd, "AdvId", DbType.Int32, info.AdvId); base.SystemStore.AddInParameter(cmd, "PositionId", DbType.Int32, info.Position); base.SystemStore.AddInParameter(cmd, "StartDate", DbType.DateTime, info.StartDate); base.SystemStore.AddInParameter(cmd, "EndDate", DbType.DateTime, info.EndDate); base.SystemStore.AddInParameter(cmd, "Range", DbType.Int32, info.Range); base.SystemStore.AddInParameter(cmd, "Relation", DbType.String, this.CreateRelationXML(info.Relation)); base.SystemStore.AddOutParameter(cmd, "Result", DbType.Int32, 4); DbHelper.ExecuteSql(cmd, base.SystemStore); return(Convert.ToInt32(base.SystemStore.GetParameterValue(cmd, "Result")) == 1 ? true : false); }
private void UpdateShowInfo(int advId, int position) { EyouSoft.Model.AdvStructure.AdvInfo advinfo = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvInfo(advId); if (advinfo != null) { txtUrl.Value = advinfo.RedirectURL == Utils.EmptyLinkCode ? "" : advinfo.RedirectURL; txtBuyUnit.Value = advinfo.CompanyName; txtLink.Value = advinfo.ContactInfo; txtOpearDate.Value = advinfo.IssueTime.ToString("yyyy-MM-dd"); txtOpearId.Value = advinfo.OperatorName; hdfUnitId.Value = advinfo.CompanyId; hdfUnitMQ.Value = advinfo.ContactMQ; hdfAdRange.Value = advinfo.Range.ToString(); txtAdvTitle.Value = advinfo.Title; //广告标题 txtAdvBrief.Value = advinfo.Remark; //广告摘要 hdfoldimgpathSmall.Value = advinfo.AdvThumb; //缩略图 if (advinfo.EndDate.Date == DateTime.MaxValue.Date) { ckDate.Checked = true; DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); MessageBox.ResponseScript(this.Page, "$(\"#pnlforver\").hide()"); } else { DatePicker1.Value = advinfo.StartDate.ToString("yyyy-MM-dd"); DatePicker2.Value = advinfo.EndDate.ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(advinfo.ImgPath)) { ltr_ImagePath.Text = string.Format("<a id=\"imgpath\" href=\"{0}\"target='_blank' title=\"点击查看\">查看原图</a>", Domain.FileSystem + advinfo.ImgPath); hdfoldimgpath.Value = advinfo.ImgPath; } if (!string.IsNullOrEmpty(advinfo.AdvThumb)) { this.ltr_ImagePathSmall.Text = string.Format("<a id=\"smallimgpath\" href=\"{0}\"target='_blank' title=\"点击查看\">查看原图</a>", Domain.FileSystem + advinfo.AdvThumb); this.hdfoldimgpathSmall.Value = advinfo.AdvThumb; } // 判断是否为展示期==true?时间不能修改:可修改 GetDateControlType(advinfo.StartDate, advinfo.EndDate); SourceBind((int)advinfo.Position, advinfo.Category.ToString()); BindRangeType(advinfo.Relation, advinfo.Range.ToString(), true); advinfo = null; } }
/// <summary> /// 置顶的供求信息行绑定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rptTopExchange_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { System.Text.StringBuilder strTmp = null; Literal ltrImg = (Literal)e.Item.FindControl("ltrImg"); Literal ltrMQ = (Literal)e.Item.FindControl("ltrMQ"); EyouSoft.Model.AdvStructure.AdvInfo model = (EyouSoft.Model.AdvStructure.AdvInfo)e.Item.DataItem; if (ltrMQ != null && model != null) { ltrMQ.Text = Utils.GetMQ(model.ContactMQ); } if (ltrImg != null && model != null) { ltrImg.Text = string.Format("<a {2}><img src=\"{0}{1}\" width=\"112\" height=\"73\" /></a>", Domain.FileSystem, model.ImgPath, string.IsNullOrEmpty(model.RedirectURL) ? "href=\"javascript:void(0);\" " : string.Format(" target=\"_blank\" href=\"{0}\" ", model.RedirectURL)); } } }
/// <summary> /// 获取广告信息 /// </summary> /// <param name="advId">广告编号</param> /// <returns></returns> public virtual EyouSoft.Model.AdvStructure.AdvInfo GetAdvInfo(int advId) { EyouSoft.Model.AdvStructure.AdvInfo info = null; DbCommand cmd = base.SystemStore.GetSqlStringCommand(SQL_SELECT_GetAdvInfo); base.SystemStore.AddInParameter(cmd, "AdvId", DbType.Int32, advId); using (IDataReader rdr = DbHelper.ExecuteReader(cmd, base.SystemStore)) { if (rdr.Read()) { info = new EyouSoft.Model.AdvStructure.AdvInfo(); info.AdvId = advId; EyouSoft.Model.AdvStructure.AdvDisplayType displayType = (EyouSoft.Model.AdvStructure.AdvDisplayType)rdr.GetByte(rdr.GetOrdinal("DisplayType")); info.AdvType = displayType == EyouSoft.Model.AdvStructure.AdvDisplayType.MQ广告 ? EyouSoft.Model.AdvStructure.AdvType.MQ : EyouSoft.Model.AdvStructure.AdvType.城市; info.Category = (EyouSoft.Model.AdvStructure.AdvCategory)rdr.GetByte(rdr.GetOrdinal("ClassId")); info.CompanyId = rdr.GetString(rdr.GetOrdinal("CompanyId")); info.CompanyName = rdr["CompanyName"].ToString(); info.ContactInfo = rdr["ContactInfo"].ToString(); info.EndDate = rdr.GetDateTime(rdr.GetOrdinal("EndDate")); info.ImgPath = rdr["AdvImg"].ToString(); info.AdvThumb = rdr["AdvThumbnail"].ToString(); info.IssueTime = rdr.GetDateTime(rdr.GetOrdinal("IssueTime")); info.OperatorId = rdr.GetInt32(rdr.GetOrdinal("OperatorId")); info.OperatorName = rdr["OperatorName"].ToString(); info.Position = (EyouSoft.Model.AdvStructure.AdvPosition)rdr.GetInt32(rdr.GetOrdinal("AreaId")); info.Range = (EyouSoft.Model.AdvStructure.AdvRange)rdr.GetByte(rdr.GetOrdinal("AdvArea")); info.RedirectURL = rdr["AdvLink"].ToString(); //info.Relation= info.Remark = rdr["AdvRemark"].ToString(); info.SortId = 0; info.StartDate = rdr.GetDateTime(rdr.GetOrdinal("StartDate")); info.Title = rdr["AdvDescript"].ToString(); } } /*if (info != null) * { * info.Relation = this.GetAdvRelation(info.AdvId); * }*/ return(info); }
/// <summary> /// 是否有效(修改时用) /// </summary> /// <param name="position">广告位置</param> /// <param name="startDate">开始时间</param> /// <param name="endDate">结束时间</param> /// <param name="range">投放范围</param> /// <param name="relation">关联信息(城市或单位类型编号)集合</param> /// <param name="advId">广告编号</param> /// <returns></returns> public bool IsValid(EyouSoft.Model.AdvStructure.AdvPosition position, DateTime startDate, DateTime endDate , EyouSoft.Model.AdvStructure.AdvRange range, IList <int> relation, int advId) { EyouSoft.Model.AdvStructure.AdvInfo info = new EyouSoft.Model.AdvStructure.AdvInfo(); info.Position = position; info.StartDate = startDate; info.EndDate = endDate; if (info.EndDate != DateTime.MaxValue) { info.EndDate = info.EndDate.AddDays(1).AddSeconds(-1); } info.Range = range; info.Relation = relation; info.AdvId = advId; return(dal.IsValid(info)); }
/// <summary> /// 发布广告 /// </summary> /// <param name="info">广告信息业务实体</param> /// <returns>1:成功 0:失败</returns> public int InsertAdv(EyouSoft.Model.AdvStructure.AdvInfo info) { if (info == null || info.EndDate == DateTime.MinValue || info.StartDate == DateTime.MinValue) { return(0); } if (info.EndDate != DateTime.MaxValue) { info.EndDate = info.EndDate.AddDays(1).AddSeconds(-1); } string cachename = string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, info.Position.ToString()); EyouSoft.Cache.Facade.EyouSoftCache.Add(cachename, DateTime.Now); return(dal.InsertAdv(info)); }
/// <summary> /// 更新广告 /// </summary> /// <param name="info">广告信息业务实体</param> /// <returns>1:成功 0:失败</returns> public virtual int UpdateAdv(EyouSoft.Model.AdvStructure.AdvInfo info) { DbCommand cmd = base.SystemStore.GetSqlStringCommand(SQL_DELETEDFILE_UPDATEMOVE); EyouSoft.Model.AdvStructure.AdvDisplayType DisplayType = GetPositionInfo(info.Position).DisplayType; if (DisplayType != EyouSoft.Model.AdvStructure.AdvDisplayType.单位图片广告 && DisplayType != EyouSoft.Model.AdvStructure.AdvDisplayType.单位图文广告 && DisplayType != EyouSoft.Model.AdvStructure.AdvDisplayType.单位文字广告) { base.SystemStore.AddInParameter(cmd, "AdvId", DbType.Int32, info.AdvId); base.SystemStore.AddInParameter(cmd, "AdvImg", DbType.String, info.ImgPath); DbHelper.ExecuteSql(cmd, base.SystemStore); } cmd = base.SystemStore.GetStoredProcCommand("proc_SysAdv_UpdateAdv"); base.SystemStore.AddInParameter(cmd, "AdvId", DbType.Int32, info.AdvId); base.SystemStore.AddInParameter(cmd, "PositionId", DbType.Int32, info.Position); base.SystemStore.AddInParameter(cmd, "CategoryId", DbType.Int32, info.Category); base.SystemStore.AddInParameter(cmd, "Title", DbType.String, info.Title); base.SystemStore.AddInParameter(cmd, "Remark", DbType.String, info.Remark); base.SystemStore.AddInParameter(cmd, "RedirectURL", DbType.String, info.RedirectURL); base.SystemStore.AddInParameter(cmd, "ImgPath", DbType.String, info.ImgPath); base.SystemStore.AddInParameter(cmd, "AdvThumbnail", DbType.String, info.AdvThumb); base.SystemStore.AddInParameter(cmd, "CompanyId", DbType.String, info.CompanyId); base.SystemStore.AddInParameter(cmd, "CompanyName", DbType.String, info.CompanyName); base.SystemStore.AddInParameter(cmd, "ContactInfo", DbType.String, info.ContactInfo); base.SystemStore.AddInParameter(cmd, "StartDate", DbType.DateTime, info.StartDate); base.SystemStore.AddInParameter(cmd, "EndDate", DbType.DateTime, info.EndDate); base.SystemStore.AddInParameter(cmd, "OperatorId", DbType.Int32, info.OperatorId); base.SystemStore.AddInParameter(cmd, "OperatorName", DbType.String, info.OperatorName); base.SystemStore.AddInParameter(cmd, "IssueTime", DbType.DateTime, info.IssueTime); base.SystemStore.AddInParameter(cmd, "Range", DbType.Int32, info.Range); base.SystemStore.AddInParameter(cmd, "Relation", DbType.String, this.CreateRelationXML(info.Relation)); base.SystemStore.AddOutParameter(cmd, "Result", DbType.Int32, 4); DbHelper.ExecuteSql(cmd, base.SystemStore); return(Convert.ToInt32(base.SystemStore.GetParameterValue(cmd, "Result"))); }
/// <summary> /// 广告管理:Ajax页面 /// 功能:执行删除和排序操作 /// 创建人:袁惠 /// 创建时间: 2010-7-22 /// </summary> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Utils.GetInt(HttpContext.Current.Request.QueryString["Id"], -1); string type = HttpContext.Current.Request.QueryString["Type"]; int result = 0; if (id != -1) { if (type == "Sort") { if (!CheckMasterGrant(YuYingPermission.业114广告_管理该栏目)) { Utils.ResponseNoPermit(YuYingPermission.业114广告_修改, true); return; } int sort = Utils.GetInt(HttpContext.Current.Request.QueryString["sort"], -1); string postion = Request.QueryString["postion"]; int cityid = Utils.GetInt(HttpContext.Current.Request.QueryString["city"], -1); int provinceid = Utils.GetInt(HttpContext.Current.Request.QueryString["province"], -1); int relation = -1; if (cityid != -1 && provinceid != -1) { relation = cityid; } else if (provinceid != -1 && cityid == -1) { relation = provinceid; } if (sort == -1 && postion == "" && cityid == -1 && provinceid == -1 && relation == -1) { result = 0; } else { EyouSoft.Model.AdvStructure.AdvInfo info = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvInfo(id); if (info != null) { if (EyouSoft.BLL.AdvStructure.Adv.CreateInstance().SetAdvSort(id, (EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), postion), relation, sort)) { result = 2; //成功 } else { result = 1; //失败 } } else { result = -1; } } } else { if (!CheckMasterGrant(YuYingPermission.业114广告_管理该栏目)) { Utils.ResponseNoPermit(YuYingPermission.业114广告_删除, true); return; } if (EyouSoft.BLL.AdvStructure.Adv.CreateInstance().DeleteAdv(id)) { result = 2; } else { result = 1; } } } else { result = -1; } HttpContext.Current.Response.Write(result.ToString()); HttpContext.Current.Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { string titleInfo = ""; string url = ""; string url2 = ""; if (Utils.GetFormValue("method") == "save") //航班折扣申请 { SavePlaneInfo(); return; } if (!string.IsNullOrEmpty(Utils.InputText(Request.QueryString["TypeID"]))) { TypeID = Utils.GetInt(Request.QueryString["TypeID"]); if (!string.IsNullOrEmpty(Utils.InputText(Request.QueryString["NewsID"]))) { NewsID = Utils.GetInt(Request.QueryString["NewsID"]); //实例化类的对象,更新浏览次数 EyouSoft.BLL.SystemStructure.Affiche.CreateInstance().UpdateReadCount(NewsID); //绑定数据 BindListInfo(); } else { EyouSoft.Common.Function.MessageBox.ShowAndRedirect(this.Page, "暂无该新闻信息!", "PlaneListPage.aspx?CityId=" + CityId); return; } url = Utils.GeneratePublicCenterUrl("PlaneListPage.aspx", CityId); switch (TypeID) { case 0: titleName += "_运价参考"; url2 = Utils.GeneratePublicCenterUrl("PlaneNewsList.aspx?TypeID=0", CityId); titleInfo = string.Format("<a href=\"{0}\">机票首页</a> <a href=\"{1}\"> >运价参考</a> >正文", url, url2); #region 加载航班折扣申请用到的js,css,控件 this.AddStylesheetInclude(CssManage.GetCssFilePath("boxy")); this.AddJavaScriptInclude(JsManage.GetJsFilePath("boxy"), true, false); this.AddJavaScriptInclude(JsManage.GetJsFilePath("validatorform"), true, false); divPlaneAppl.Visible = true; #endregion break; case 1: titleName += "_帮助信息"; url2 = Utils.GeneratePublicCenterUrl("PlaneNewsList.aspx?TypeID=1", CityId); titleInfo = string.Format("<a href=\"{0}\">机票首页</a> <a href=\"{1}\"> >帮助信息</a> >正文", url, url2); break; default: titleName += "_合作供应商"; url2 = Utils.GeneratePublicCenterUrl("PlaneNewsList.aspx?TypeID=2", CityId); titleInfo = string.Format("<a href=\"{0}\">机票首页</a> <a href=\"{1}\"> >合作供应商</a> >正文", url, url2); break; } this.div_Title.InnerHtml = titleInfo; this.CityAndMenu1.HeadMenuIndex = 3; this.Page.Title = titleName; this.hidNewId.Value = NewsID.ToString(); //文章ID (用于机票) this.hidTitle.Value = titleName; } else { //广告连接过来 if (!string.IsNullOrEmpty(Utils.InputText(Request.QueryString["NewsID"]))) { int advID = Utils.GetInt(Request.QueryString["NewsID"]); EyouSoft.Model.AdvStructure.AdvInfo advModel = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvInfo(advID); if (advModel != null) { //初始化信息:时间,标题,内容 this.lbl_Time.Text = advModel.IssueTime.ToString("yyyy年MM月dd日 hh:mm"); this.lbl_Title.Text = advModel.Title; this.lit_Content.Text = advModel.Remark; this.divShow.Visible = false; this.Page.Title = advModel.Title; this.hidNewId.Value = advID.ToString(); //文章ID (用于机票) this.hidTitle.Value = advModel.Title; } advModel = null; } else { EyouSoft.Common.Function.MessageBox.ShowAndRedirect(this.Page, "暂无该广告信息!", "/Default.aspx?CityId=" + CityId); return; } } }
/// <summary> /// 获取指定位置的广告信息集合 /// </summary> /// <param name="relationId">城市或单位类型(MQ)编号</param> /// <param name="position">广告位置</param> /// <returns></returns> public IList <EyouSoft.Model.AdvStructure.AdvInfo> GetAdvs(int relationId, EyouSoft.Model.AdvStructure.AdvPosition position) { string cachename = string.Format(EyouSoft.CacheTag.Adv.SystemAdv, position.ToString(), relationId); EyouSoft.Cache.Facade.EyouSoftCacheTime <List <EyouSoft.Model.AdvStructure.AdvInfo> > list = (EyouSoft.Cache.Facade.EyouSoftCacheTime <List <EyouSoft.Model.AdvStructure.AdvInfo> >) EyouSoft.Cache.Facade.EyouSoftCache.GetCache(cachename); object UpdateTime = EyouSoft.Cache.Facade.EyouSoftCache.GetCache(string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, position.ToString())); if (UpdateTime == null) { EyouSoft.Cache.Facade.EyouSoftCache.Add(string.Format(EyouSoft.CacheTag.Adv.SystemAdvUpdateKey, position.ToString()), DateTime.Now); } if (list != null && UpdateTime != null && list.UpdateTime > (DateTime)UpdateTime) { return(list.Data); } else { list = new EyouSoft.Cache.Facade.EyouSoftCacheTime <List <EyouSoft.Model.AdvStructure.AdvInfo> >(); EyouSoft.Model.AdvStructure.AdvPositionInfo positionInfo = this.GetPositionInfo(position); IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = dal.GetAdvs(positionInfo.AdvType, relationId, position, DateTime.Today, positionInfo.AdvCount, false); int appendItems = positionInfo.AdvCount; #region 补平台广告 if (advs != null && advs.Count > 0) { appendItems = positionInfo.AdvCount - advs.Count; } else { advs = new List <EyouSoft.Model.AdvStructure.AdvInfo>(); } if (appendItems > 0) { IList <EyouSoft.Model.AdvStructure.AdvInfo> platformAdvs = dal.GetAdvs(positionInfo.AdvType, relationId, position, DateTime.Today, appendItems, true); if (platformAdvs != null && platformAdvs.Count > 0) { //advs = advs.Union(platformAdvs).ToList(); foreach (EyouSoft.Model.AdvStructure.AdvInfo advInfo in platformAdvs) { advs.Add(advInfo); } } } #endregion #region 补空白广告 if (advs != null && advs.Count > 0) { appendItems = positionInfo.AdvCount - advs.Count; } else { advs = new List <EyouSoft.Model.AdvStructure.AdvInfo>(); } EyouSoft.Model.AdvStructure.AdvInfo tmp = new EyouSoft.Model.AdvStructure.AdvInfo(); tmp.Title = positionInfo.DefaultTitle; tmp.ImgPath = positionInfo.DefaultImgPath; tmp.RedirectURL = positionInfo.DefaultRedirectURL; for (int i = 0; i < appendItems; i++) { advs.Add(tmp); } tmp = null; #endregion list.Data = advs.ToList(); list.UpdateTime = DateTime.Now; EyouSoft.Cache.Facade.EyouSoftCache.Add(cachename, list, DateTime.Today.AddDays(1).AddMinutes(10)); } return(list.Data); }
private void AdvTest1() { EyouSoft.Model.AdvStructure.AdvInfo info = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().GetAdvInfo(243); Response.Write(EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, info.Relation, info.AdvId)); }
/// <summary> /// 按照指定条件获取广告信息集合 /// </summary> /// <param name="pageSize">每页显示记录数</param> /// <param name="pageIndex">当前页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="position">广告位置 为空时不做为查询条件</param> /// <param name="advType">广告投放类型</param> /// <param name="relationId">关联编号(城市或单位类型编号)</param> /// <param name="companyName">公司名称 为null时不做为查询条件</param> /// <param name="category">广告类别 为null时不做为查询条件</param> /// <param name="startDate">有效期起始时间 为null时不做为查询条件</param> /// <param name="endDate">有效期截止时间 为null时不做为查询条件</param> /// <param name="catalog">广告栏目(频道)</param> /// <param name="title">广告标题 为null时不做为查询条件</param> /// <returns></returns> public virtual IList <EyouSoft.Model.AdvStructure.AdvInfo> GetAdvs(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.AdvStructure.AdvPosition?position , EyouSoft.Model.AdvStructure.AdvType advType, int relationId , string companyName, EyouSoft.Model.AdvStructure.AdvCategory?category, DateTime?startDate, DateTime?endDate , EyouSoft.Model.AdvStructure.AdvCatalog?catalog, string title) { IList <EyouSoft.Model.AdvStructure.AdvInfo> advs = new List <EyouSoft.Model.AdvStructure.AdvInfo>(); StringBuilder cmdQuery = new StringBuilder(); string tableName = "tbl_SysAdv"; string primaryKey = "Id"; string orderByString = "IssueTime ASC"; StringBuilder fields = new StringBuilder(); fields.Append("*"); fields.Append(",(SELECT AdvImg FROM tbl_SysAdvImg WHERE AdvId=tbl_SysAdv.Id) AS AdvImg"); fields.Append(",(SELECT AdvThumbnail FROM tbl_SysAdvImg WHERE AdvId=tbl_SysAdv.Id) AS AdvThumb"); fields.AppendFormat(",(SELECT SortId FROM tbl_SysAdvAreaControl WHERE AdvId=tbl_SysAdv.Id AND AreaType={0} AND AreaId={1}) AS SortId ", (int)advType, relationId); fields.Append(",(SELECT MQ FROM tbl_CompanyUser WHERE CompanyId=tbl_SysAdv.CompanyId AND IsAdmin='1' ) AS ContactMQ"); #region 拼接查询条件 cmdQuery.Append(" 1=1 "); if (relationId > 0) { cmdQuery.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_SysAdvAreaControl WHERE AdvId=tbl_SysAdv.Id AND AreaType={0} AND AreaId={1}) ", (int)advType, relationId); } if (position.HasValue) { cmdQuery.AppendFormat(" AND AreaId={0} ", (int)position.Value); } if (!string.IsNullOrEmpty(companyName)) { cmdQuery.AppendFormat(" AND CompanyName LIKE '%{0}%' ", companyName); } if (category.HasValue) { cmdQuery.AppendFormat(" AND ClassId={0} ", (int)category.Value); } if (startDate.HasValue || endDate.HasValue) { /*cmdQuery.Append(" AND(1=0 "); * if (startDate.HasValue) * { * cmdQuery.AppendFormat(" OR '{0}' BETWEEN StartDate AND EndDate ", startDate.Value); * } * if (endDate.HasValue) * { * cmdQuery.AppendFormat(" OR '{0}' BETWEEN StartDate AND EndDate ", endDate.Value); * } * cmdQuery.Append(")");*/ cmdQuery.Append(" AND (EndDate>='9999-12-31' "); cmdQuery.Append(" OR (1=1 "); if (startDate.HasValue) { cmdQuery.AppendFormat(" AND StartDate>='{0}' ", startDate.Value); } if (endDate.HasValue) { cmdQuery.AppendFormat(" AND EndDate<='{0}' ", endDate.Value); } cmdQuery.Append(" ) "); cmdQuery.Append(" ) "); } if (catalog.HasValue) { cmdQuery.AppendFormat(" AND AreaId IN(SELECT AreaId FROM tbl_SysAdvArea WHERE CatalogId={0}) ", (int)catalog.Value); } if (!string.IsNullOrEmpty(title)) { cmdQuery.AppendFormat(" AND AdvDescript LIKE '%{0}%' ", title); } #endregion using (IDataReader rdr = DbHelper.ExecuteReader(base.SystemStore, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields.ToString(), cmdQuery.ToString(), orderByString)) { while (rdr.Read()) { EyouSoft.Model.AdvStructure.AdvInfo tmp = new EyouSoft.Model.AdvStructure.AdvInfo(); tmp.AdvId = rdr.GetInt32(rdr.GetOrdinal("Id")); tmp.AdvType = advType; tmp.Category = (EyouSoft.Model.AdvStructure.AdvCategory)rdr.GetByte(rdr.GetOrdinal("ClassId")); tmp.CompanyId = rdr.GetString(rdr.GetOrdinal("CompanyId")); tmp.CompanyName = rdr["CompanyName"].ToString(); tmp.ContactInfo = rdr["ContactInfo"].ToString(); tmp.EndDate = rdr.GetDateTime(rdr.GetOrdinal("EndDate")); tmp.ImgPath = rdr["AdvImg"].ToString(); tmp.AdvThumb = rdr["AdvThumb"].ToString(); tmp.IssueTime = rdr.GetDateTime(rdr.GetOrdinal("IssueTime")); tmp.OperatorId = rdr.GetInt32(rdr.GetOrdinal("OperatorId")); tmp.OperatorName = rdr["OperatorName"].ToString(); tmp.Position = (EyouSoft.Model.AdvStructure.AdvPosition)rdr.GetInt32(rdr.GetOrdinal("AreaId")); tmp.Range = (EyouSoft.Model.AdvStructure.AdvRange)rdr.GetByte(rdr.GetOrdinal("AdvArea")); tmp.RedirectURL = rdr["AdvLink"].ToString(); //tmp.Relation tmp.Remark = rdr.IsDBNull(rdr.GetOrdinal("AdvRemark")) ? string.Empty : rdr.GetString(rdr.GetOrdinal("AdvRemark")); if (!rdr.IsDBNull(rdr.GetOrdinal("SortId"))) { tmp.SortId = rdr.GetInt32(rdr.GetOrdinal("SortId")); } tmp.StartDate = rdr.GetDateTime(rdr.GetOrdinal("StartDate")); tmp.Title = rdr["AdvDescript"].ToString(); tmp.ContactMQ = rdr["ContactMQ"].ToString(); advs.Add(tmp); } } return(advs); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { DateTime StartDate = ckbDate.Checked == true?DateTime.Today: Utils.GetDateTime(DatePicker1.Value); DateTime EndDate = ckbDate.Checked == true?DateTime.MaxValue: Utils.GetDateTime(DatePicker2.Value); string Position = ltr_advPostion.Text; string Category = ddlCategory.SelectedValue; string Range = hdfAdRange.Value; string Relation = StringValidate.IsIntegerArray(hdfResult.Value) == true ? hdfResult.Value :"-1"; string link = txtContact.Value; string title = Utils.InputText(txtTitle.Value); string content = Utils.EditInputText(fckContent.Value); string unitname = Utils.InputText(txtBuyUnit.Value); string unitid = Utils.InputText(hdfUnitId.Value); int advid = Utils.GetInt(Request.QueryString["AdvId"], -1); if (Category.Length > 0 && Range.Length > 0 && Relation.Length > 0 && content.Length > 0 && title.Length > 0 && unitname.Length > 0 && unitid.Length > 0) { if (Range.Length <= 0 && Relation.Length <= 0) { MessageBox.ResponseScript(this.Page, "alert('请选择投放范围');"); BindRangeType(null, "", false); IsDateUpdate = advid != -1 ? false : true; return; } IList <int> intrelas = null; if (Range != "全国") { intrelas = new List <int>(); string[] rels = Relation.Split(','); foreach (string item in rels) { intrelas.Add(Convert.ToInt32(item)); } } if (advid != -1) //修改 { if (StartDate > EndDate) { IsInsert = false; MessageBox.ResponseScript(this.Page, "alert('有效期填写错误!');"); BindRangeType(intrelas, Range, true); return; } } else { if (!(StartDate <= EndDate && StartDate >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")))) { MessageBox.ResponseScript(this.Page, "alert('有效期填写错误!');"); BindRangeType(intrelas, Range, true); return; } } EyouSoft.Model.AdvStructure.AdvInfo info = new EyouSoft.Model.AdvStructure.AdvInfo(); info.EndDate = EndDate; info.StartDate = StartDate; info.IssueTime = DateTime.Now; info.OperatorId = this.MasterUserInfo.ID; //操作员编号 info.OperatorName = this.MasterUserInfo.UserName; info.Title = title; info.Remark = content; info.CompanyId = unitid; info.CompanyName = unitname; info.ContactInfo = link; info.ContactMQ = hdfUnitMQ.Value; info.AdvType = EyouSoft.Model.AdvStructure.AdvType.城市; //广告类型1 info.Category = (EyouSoft.Model.AdvStructure.AdvCategory)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvCategory), Category); //广告类别 info.Position = (EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), Position); info.Range = (EyouSoft.Model.AdvStructure.AdvRange)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvRange), Range); info.Relation = intrelas; int intPosition = (int)((EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), Position)); int row = 0; if (advid != -1) { if (info.Category == EyouSoft.Model.AdvStructure.AdvCategory.业114广告 || EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, intrelas, advid)) { info.AdvId = advid; row = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().UpdateAdv(info); } else { MessageBox.ShowAndRedirect(this.Page, "该位置的时间范围内已经存在广告,您不能修改!", hdfListUrl.Value); return; } } else { if (info.Category == EyouSoft.Model.AdvStructure.AdvCategory.业114广告 || EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, intrelas)) { row = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().InsertAdv(info); } else { MessageBox.ShowAndRedirect(this.Page, "该位置的时间范围内已经存在广告,您不能再次插入!", "AddWritingAd.aspx?position=" + intPosition); return; } } info = null; pnlforver.Visible = ckbDate.Checked == true ? false : true; if (row == 1) { MessageBox.ShowAndRedirect(this.Page, "操作成功!", hdfListUrl.Value); } else { MessageBox.ShowAndRedirect(this.Page, "操作失败!", hdfListUrl.Value); } } else { MessageBox.ResponseScript(this.Page, "alert('内容请填写完整!');"); BindRangeType(null, "", false); IsDateUpdate = advid != -1 ? false : true; } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { DateTime EndDate = ckDate.Checked == true?DateTime.MaxValue:Utils.GetDateTime(DatePicker2.Value); DateTime StartDate = ckDate.Checked == true?DateTime.Today:Utils.GetDateTime(DatePicker1.Value); string Position = ltr_advPostion.Text; string Category = ddlCategory.SelectedValue; string Range = hdfAdRange.Value; string Relation = StringValidate.IsIntegerArray(hdfResult.Value) == true ? hdfResult.Value : "-1"; string url = txtUrl.Value.Trim(); string advTitle = Utils.GetText(txtAdvTitle.Value, 100); string advRemark = Utils.GetText(txtAdvBrief.Value, 255); if (url == "") { url = Utils.EmptyLinkCode; } else { if (url.IndexOf("http://") < 0) { url = Utils.InputText("http://" + url); } } string link = Utils.InputText(txtLink.Value); string imgpath = Utils.GetFormValue("sfuPhotoImg$hidFileName"); string imgpathThumb = Utils.GetFormValue("sfuSmallPhotoImg$hidFileName"); string unitname = Utils.InputText(txtBuyUnit.Value); string unitid = Utils.InputText(hdfUnitId.Value); if (string.IsNullOrEmpty(imgpath)) { imgpath = hdfoldimgpath.Value; } if (string.IsNullOrEmpty(imgpathThumb)) { imgpathThumb = this.hdfoldimgpathSmall.Value; } int advid = Utils.GetInt(Request.QueryString["AdvId"], -1); //修改 广告id if (Category.Length > 0 && imgpath.Length > 0 && unitid.Length > 0 && unitname.Length > 0) { if (Range.Length <= 0 && Relation.Length <= 0) { MessageBox.ResponseScript(this.Page, "alert('请选择投放范围!');"); BindRangeType(null, "", false); IsDateUpdate = advid != -1 ? false : true; return; } IList <int> intrelas = null; if (Range != "全国") { intrelas = new List <int>(); string[] rels = Relation.Split(','); foreach (string item in rels) { intrelas.Add(Convert.ToInt32(item)); } } if (advid != -1) //修改 { if (StartDate > EndDate) { IsInsert = false; MessageBox.ResponseScript(this.Page, "alert('有效期填写错误!');"); BindRangeType(intrelas, Range, true); return; } } else { if (!(StartDate <= EndDate && StartDate >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")))) { MessageBox.ResponseScript(this.Page, "alert('有效期填写错误!');"); BindRangeType(intrelas, Range, true); return; } } if (string.IsNullOrEmpty(url)) { url = Utils.EmptyLinkCode; } EyouSoft.Model.AdvStructure.AdvInfo info = new EyouSoft.Model.AdvStructure.AdvInfo(); info.AdvType = EyouSoft.Model.AdvStructure.AdvType.城市; //广告类型 info.Category = (EyouSoft.Model.AdvStructure.AdvCategory)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvCategory), Category); //广告类别 info.Relation = intrelas; info.CompanyId = unitid; info.CompanyName = unitname; info.ContactMQ = hdfUnitMQ.Value; info.ContactInfo = link; info.Title = Utils.InputText(txtBuyUnit.Value); info.StartDate = Convert.ToDateTime(StartDate); info.EndDate = Convert.ToDateTime(EndDate); info.ImgPath = imgpath; //大图 info.AdvThumb = imgpathThumb; //缩略图 info.Title = advTitle; info.Remark = advRemark; info.IssueTime = DateTime.Now; info.OperatorId = this.MasterUserInfo.ID; //操作员编号 info.OperatorName = this.MasterUserInfo.UserName; info.RedirectURL = url; info.Position = (EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), Position); info.Range = (EyouSoft.Model.AdvStructure.AdvRange)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvRange), Range); int row = 0; int intPosition = (int)((EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), Position)); if (advid != -1) { if (info.Category == EyouSoft.Model.AdvStructure.AdvCategory.业114广告 || EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, intrelas, advid)) { info.AdvId = advid; row = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().UpdateAdv(info); } else { MessageBox.ShowAndRedirect(this.Page, "该位置的时间范围内已经存在广告,您不能修改!", hdfListUrl.Value); return; } } else { if (info.Category == EyouSoft.Model.AdvStructure.AdvCategory.业114广告 || EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, intrelas)) { row = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().InsertAdv(info); } else { MessageBox.ShowAndRedirect(this.Page, "该位置的时间范围内已经存在广告,您不能再次插入!", "AddPhotoAd.aspx?position=" + intPosition); return; } } info = null; pnlforver.Visible = ckDate.Checked == true ? false : true; if (row == 1) { MessageBox.ShowAndRedirect(this.Page, "操作成功!", hdfListUrl.Value); } else { MessageBox.ShowAndRedirect(this.Page, "操作失败!", hdfListUrl.Value); } } else { MessageBox.ResponseScript(this.Page, "alert('内容请填写完整!');"); BindRangeType(null, "", false); IsDateUpdate = advid != -1 ? false : true; } }
protected void btnSubmit_Click(object sender, EventArgs e) { DateTime StartDate = ckbDate.Checked == true?DateTime.Today:Utils.GetDateTime(DatePicker1.Value); DateTime EndDate = ckbDate.Checked == true?DateTime.MaxValue: Utils.GetDateTime(DatePicker2.Value); string Position = ltr_advPostion.Text; string Category = ddlCategory.SelectedValue; string Range = hdfAdRange.Value; string Relation = StringValidate.IsIntegerArray(hdfResult.Value) == true ? hdfResult.Value : "-1"; string link = Utils.InputText(txtLink.Value); string unitname = Utils.InputText(txtBuyUnit.Value); int advid = Utils.GetInt(Request.QueryString["AdvId"], -1); string imgpath = Utils.GetFormValue("sfuPhotoImg$hidFileName"); if (string.IsNullOrEmpty(imgpath)) { imgpath = hdfoldimgpath.Value; } if (Category.Length > 0 && Relation.Length > 0 && unitname.Length > 0) { if (Range.Length <= 0 && Relation.Length <= 0) { MessageBox.ResponseScript(this.Page, "alert('请选择投放范围!')"); BindRangeType(null, "", false); IsDateUpdate = advid != -1 ? false : true; return; } IList <int> intrelas = null; if (Range != "全国") { intrelas = new List <int>(); string[] rels = Relation.Split(','); foreach (string item in rels) { intrelas.Add(Convert.ToInt32(item)); } } if (advid != -1) { if (StartDate > EndDate) { IsInsert = false; MessageBox.ResponseScript(this.Page, "alert('有效期填写错误!');"); BindRangeType(intrelas, Range, true); return; } } else { if (!(StartDate <= EndDate && StartDate >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")))) { MessageBox.ResponseScript(this.Page, "alert('有效期填写错误!');"); BindRangeType(intrelas, Range, true); return; } } EyouSoft.Model.AdvStructure.AdvInfo info = new EyouSoft.Model.AdvStructure.AdvInfo(); info.EndDate = Convert.ToDateTime(EndDate); info.StartDate = Convert.ToDateTime(StartDate); info.IssueTime = DateTime.Now; info.OperatorId = this.MasterUserInfo.ID; //操作员编号 info.OperatorName = this.MasterUserInfo.UserName; info.ContactInfo = link; info.AdvType = EyouSoft.Model.AdvStructure.AdvType.城市; //广告类型 info.Category = (EyouSoft.Model.AdvStructure.AdvCategory)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvCategory), Category); //广告类别 info.Position = (EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), Position); info.Range = (EyouSoft.Model.AdvStructure.AdvRange)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvRange), Range); //投放类型 info.Title = Utils.InputText(txtBuyUnit.Value); info.Relation = intrelas; info.ImgPath = imgpath;// 上传的Logo #region 单位图片|图文广告,添加logo,url EyouSoft.Model.CompanyStructure.CompanyDetailInfo companyInfo = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(hdfUnitId.Value); EyouSoft.Model.CompanyStructure.CompanyType? unitType = null; if (companyInfo != null) { unitType = Utils.GetCompanyType(companyInfo.ID); //获取公司类型 info.RedirectURL = unitType.HasValue?Utils.GetCompanyDomain(companyInfo.ID, unitType.Value):string.Empty; //info.ImgPath = companyInfo.AttachInfo.CompanyLogo.ImagePath; info.Title = unitname; info.CompanyId = companyInfo.ID; info.CompanyName = unitname; info.ContactMQ = hdfUnitMQ.Value; info.Remark = unitname; companyInfo = null; } #endregion int row = 0; int intPostion = (int)((EyouSoft.Model.AdvStructure.AdvPosition)Enum.Parse(typeof(EyouSoft.Model.AdvStructure.AdvPosition), Position)); if (advid != -1) { if (info.Category == EyouSoft.Model.AdvStructure.AdvCategory.业114广告 || EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, intrelas, advid)) { info.AdvId = advid; row = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().UpdateAdv(info); } else { MessageBox.ShowAndRedirect(this.Page, "该位置的时间范围内已经存在广告,您不能修改!", hdfLisUrl.Value); return; } } else { if (info.Category == EyouSoft.Model.AdvStructure.AdvCategory.业114广告 || EyouSoft.BLL.AdvStructure.Adv.CreateInstance().IsValid(info.Position, info.StartDate, info.EndDate, info.Range, intrelas)) { row = EyouSoft.BLL.AdvStructure.Adv.CreateInstance().InsertAdv(info); } else { MessageBox.ShowAndRedirect(this.Page, "该位置的时间范围内已经存在广告,您不能再次插入!", "AddUnitAd.aspx?position=" + intPostion); return; } } info = null; pnlforver.Visible = ckbDate.Checked == true ? false : true; if (row == 1) { MessageBox.ShowAndRedirect(this.Page, "操作成功!", hdfLisUrl.Value); } else { MessageBox.ShowAndRedirect(this.Page, "操作失败!", hdfLisUrl.Value); } } else { MessageBox.ResponseScript(this.Page, "alert('内容请填写完整!');"); BindRangeType(null, "", false); IsDateUpdate = advid != -1 ? false :true; } }