public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { if (_isEdit == false) { if (DataProvider.AdAreaDao.IsExists(AdAreaName.Text, PublishmentSystemId)) { FailMessage($"名称为“{AdAreaName.Text}”的广告位已存在,请更改广告位名称!"); return; } } try { if (_isEdit) { var adAreaInfo = DataProvider.AdAreaDao.GetAdAreaInfo(_theAdAreaName, PublishmentSystemId); adAreaInfo.AdAreaName = AdAreaName.Text; adAreaInfo.IsEnabled = TranslateUtils.ToBool(IsEnabled.SelectedValue); adAreaInfo.Width = TranslateUtils.ToInt(Width.Text); adAreaInfo.Height = TranslateUtils.ToInt(Height.Text); adAreaInfo.Summary = Summary.Text; if (adAreaInfo.AdAreaName != AdAreaName.Text.Trim()) { if (DataProvider.AdAreaDao.IsExists(AdAreaName.Text, PublishmentSystemId)) { FailMessage($"名称为“{AdAreaName.Text}”的广告位已存在,请更改广告位名称!"); return; } } DataProvider.AdAreaDao.Update(adAreaInfo); Body.AddSiteLog(PublishmentSystemId, "修改固定广告", $"广告名称:{adAreaInfo.AdAreaName}"); SuccessMessage("修改广告成功!"); } else { var adAreaInfo = new AdAreaInfo(0, PublishmentSystemId, AdAreaName.Text, TranslateUtils.ToInt(Width.Text), TranslateUtils.ToInt(Height.Text), Summary.Text, TranslateUtils.ToBool(IsEnabled.SelectedValue), DateTime.Now); DataProvider.AdAreaDao.Insert(adAreaInfo); Body.AddSiteLog(PublishmentSystemId, "新增固定广告位", $"广告位名称:{adAreaInfo.AdAreaName}"); SuccessMessage("新增广告位成功!"); } AddWaitAndRedirectScript(PageAdArea.GetRedirectUrl(PublishmentSystemId)); } catch (Exception ex) { FailMessage(ex, $"操作失败:{ex.Message}"); } } }
public void Insert(AdAreaInfo adAreaInfo) { var adParms = new IDataParameter[] { GetParameter(ParmPublishmentsystemid, EDataType.Integer, adAreaInfo.PublishmentSystemID), GetParameter(ParmAdareaName, EDataType.NVarChar, 255, adAreaInfo.AdAreaName), GetParameter(ParmWidth, EDataType.Integer, adAreaInfo.Width), GetParameter(ParmHight, EDataType.Integer, adAreaInfo.Height), GetParameter(ParmSummary, EDataType.NVarChar, 255, adAreaInfo.Summary), GetParameter(ParmIsEnabled, EDataType.VarChar, 18, adAreaInfo.IsEnabled.ToString()), GetParameter(ParmAddDate, EDataType.DateTime, adAreaInfo.AddDate) }; ExecuteNonQuery(SqlInsertAdarea, adParms); }
public ArrayList GetAdAreaInfoArrayList(int publishmentSystemId) { var arraylist = new ArrayList(); var parms = new IDataParameter[] { GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId) }; using (var rdr = ExecuteReader(SqlSelectAllAdarea, parms)) { while (rdr.Read()) { var i = 0; var adAreaInfo = new AdAreaInfo(GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetDateTime(rdr, i)); arraylist.Add(adAreaInfo); } rdr.Close(); } return(arraylist); }
public AdAreaInfo GetAdAreaInfo(string adAreaName, int publishmentSystemId) { AdAreaInfo adAreaInfo = null; var parms = new IDataParameter[] { GetParameter(ParmAdareaName, EDataType.NVarChar, 255, adAreaName), GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId) }; using (var rdr = ExecuteReader(SqlSelectAdareaByname, parms)) { if (rdr.Read()) { var i = 0; adAreaInfo = new AdAreaInfo(GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetDateTime(rdr, i)); } rdr.Close(); } return(adAreaInfo); }
public static string GetSlideAdvHtml(PublishmentSystemInfo publishmentSystemInfo, AdAreaInfo adAreaInfo, AdvInfo advInfo, ArrayList adMaterialInfoList) { var strHtml = new StringBuilder(); strHtml.Append($@"<link href=""{SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "Styles/Css/slideAdv.css")}"" rel=""stylesheet"" />"); strHtml.Append($@"<script src=""{SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "JQuery/jquery-1.4.3.min.js")}""></script>"); strHtml.AppendFormat(@" <script type=""text/javascript""> var t = n = 0, count; $(document).ready(function () {{ count = $(""#banner_list a"").length; $(""#banner_list a:not(:first-child)"").hide(); $(""#banner_info"").html($(""#banner_list a:first-child"").find(""img"").attr('alt')); $(""#banner_info"").click(function () {{ window.open($(""#banner_list a:first-child"").attr('href'), ""_blank"") }}); $(""#banner li"").click(function () {{ var i = $(this).text() - 1; n = i; if (i >= count) return; $(""#banner_info"").html($(""#banner_list a"").eq(i).find(""img"").attr('alt')); $(""#banner_info"").unbind().click(function () {{ window.open($(""#banner_list a"").eq(i).attr('href'), ""_blank"") }}) $(""#banner_list a"").filter("":visible"").fadeOut(500).parent().children().eq(i).fadeIn(1000); document.getElementById(""banner"").style.background = """"; $(this).toggleClass(""on""); $(this).siblings().removeAttr(""class""); }}); t = setInterval(""showAuto()"", {0}000); $(""#banner"").hover(function () {{ clearInterval(t) }}, function () {{ t = setInterval(""showAuto()"", {0}000); }}); }}) function showAuto() {{ n = n >= (count - 1) ? 0 : ++n; $(""#banner li"").eq(n).trigger('click'); }} </script> ", advInfo.RotateInterval); strHtml.AppendFormat(@"<div id=""banner"" style=""width:{0}px;height:{1}px;"">", adAreaInfo.Width, adAreaInfo.Height); strHtml.AppendFormat(@"<div id=""banner_bg""></div> <!--标题背景-->"); strHtml.AppendFormat(@"<div id=""banner_info""></div><ul> <!--标题-->"); if (adMaterialInfoList.Count == 1) { var info = adMaterialInfoList[0] as AdMaterialInfo; strHtml.AppendFormat(@"<li class=""on"">1</li></ul><div id=""banner_list"">"); strHtml.AppendFormat(GetImageHtml(publishmentSystemInfo, info)); strHtml.AppendFormat(@"</div></div>"); } else if (adMaterialInfoList.Count > 1) { var index = 0; foreach (AdMaterialInfo info in adMaterialInfoList) { index++; if (index == 1) { strHtml.AppendFormat(@"<li class=""on"">1</li>"); } else { if (index != adMaterialInfoList.Count) { strHtml.AppendFormat(@"<li>{0}</li>", index); } else { strHtml.AppendFormat(@"<li>{0}</li>", index); strHtml.AppendFormat(@"</ul><div id=""banner_list"">"); } } } foreach (AdMaterialInfo info in adMaterialInfoList) { strHtml.AppendFormat(GetImageHtml(publishmentSystemInfo, info)); } strHtml.AppendFormat(@"</div></div>"); } return(strHtml.ToString()); }