📄 adzones.cs
字号:
namespace PowerEasy.WebSite.Admin.AD
{
using PowerEasy.AccessManage;
using PowerEasy.AD;
using PowerEasy.Common;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.AD;
using PowerEasy.Web.UI;
using System;
using System.Text.RegularExpressions;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class ADZones : AdminPage
{
protected CheckBox ChkActive;
protected DropDownList DropAdZoneSize;
protected DropDownList DropFixedPosition;
protected DropDownList DropFloatPosition;
protected DropDownList DropFloatType;
protected DropDownList DropMovePosition;
protected DropDownList DropPopPosition;
protected DropDownList DropPopType;
protected Button EBtnAdZone;
protected HiddenField HdnAction;
protected HiddenField HdnZoneId;
protected AlternateLiteral LblTitle;
protected RadioButtonList RadlCoupletShowCloseAD;
protected RadioButtonList RadlDefaultSetting;
protected RadioButtonList RadlFixedShowCloseAD;
protected RadioButtonList RadlFloatShowCloseAD;
protected RadioButtonList RadlMoveShowCloseAD;
protected RadioButtonList RadlShowType;
protected RadioButtonList RadlZoneType;
protected ExtendedSiteMapPath SmpNavigator;
protected ColorPicker TxtCoupletCloseFontColor;
protected TextBox TxtCoupletDelay;
protected TextBox TxtCoupletLeft;
protected TextBox TxtCoupletTop;
protected ColorPicker TxtFixedCloseFontColor;
protected TextBox TxtFixedLeft;
protected TextBox TxtFixedTop;
protected ColorPicker TxtFloatCloseFontColor;
protected TextBox TxtFloatLeft;
protected TextBox TxtFloatTop;
protected ColorPicker TxtMoveCloseFontColor;
protected TextBox TxtMoveDelay;
protected TextBox TxtMoveLeft;
protected TextBox TxtMoveTop;
protected TextBox TxtPopCookieHour;
protected TextBox TxtPopLeft;
protected TextBox TxtPopTop;
protected TextBox TxtZoneHeight;
protected TextBox TxtZoneIntro;
protected TextBox TxtZoneJSName;
protected TextBox TxtZoneName;
protected TextBox TxtZoneWidth;
protected RegularExpressionValidator ValeZoneJSName;
protected PowerEasy.Controls.RequiredFieldValidator ValrTxtZoneHeight;
protected PowerEasy.Controls.RequiredFieldValidator ValrTxtZoneWidth;
protected PowerEasy.Controls.RequiredFieldValidator ValrtZoneJSName;
protected PowerEasy.Controls.RequiredFieldValidator ValrZoneName;
protected HtmlGenericControl ZoneTypeSetting;
protected HtmlTable ZoneTypeSetting1;
protected HtmlTable ZoneTypeSetting2;
protected HtmlTable ZoneTypeSetting3;
protected HtmlTable ZoneTypeSetting4;
protected HtmlTable ZoneTypeSetting5;
protected HtmlTable ZoneTypeSetting6;
protected HtmlTable ZoneTypeSetting7;
protected void EBtnAdZone_Click(object sender, EventArgs e)
{
if (this.Page.IsValid)
{
ADZoneInfo adZoneInfo = new ADZoneInfo();
adZoneInfo.ZoneName = this.TxtZoneName.Text.Trim();
adZoneInfo.ZoneJSName = this.TxtZoneJSName.Text.Trim();
adZoneInfo.ZoneIntro = this.TxtZoneIntro.Text.Trim();
adZoneInfo.ZoneType = (ADZoneType) DataConverter.CLng(this.RadlZoneType.SelectedValue);
adZoneInfo.DefaultSetting = this.GetDefaultSetting(this.RadlDefaultSetting.SelectedValue);
adZoneInfo.Setting = this.GetZoneSetting(adZoneInfo.DefaultSetting);
adZoneInfo.ZoneWidth = DataConverter.CLng(this.TxtZoneWidth.Text.Trim());
adZoneInfo.ZoneHeight = DataConverter.CLng(this.TxtZoneHeight.Text.Trim());
adZoneInfo.ShowType = DataConverter.CLng(this.RadlShowType.SelectedValue);
adZoneInfo.Active = this.ChkActive.Checked;
adZoneInfo.UpdateTime = DateTime.Now;
if (this.HdnAction.Value.Trim() == "Modify")
{
adZoneInfo.ZoneId = DataConverter.CLng(this.HdnZoneId.Value.Trim());
if (ADZone.Update(adZoneInfo))
{
BasePage.ResponseRedirect("ADZoneManage.aspx");
}
else
{
AdminPage.WriteErrMsg("更新出错!", "ADZone.aspx?ZoneId=" + adZoneInfo.ZoneId);
}
}
else if (ADZone.Add(adZoneInfo) == DataActionState.Successed)
{
BasePage.ResponseRedirect("ADZoneManage.aspx");
}
else
{
AdminPage.WriteErrMsg("添加出错!", "ADZone.aspx");
}
}
}
private bool GetDefaultSetting(string defaultset)
{
return (defaultset == "0");
}
private string GetJSFileName()
{
return ADZone.GetNewJSName();
}
private string GetZoneSetting(bool isDefaultSetting)
{
if (isDefaultSetting)
{
switch (this.RadlZoneType.SelectedValue)
{
case "2":
return "1,100,100,0,1";
case "3":
return "15,200,0.015,false,#FFFFFF,1";
case "4":
return "100,100,false,#FFFFFF,1";
case "5":
return "1,100,100,false,#FFFFFF,1";
case "7":
return "15,200,0.015,false,#FFFFFF";
}
return "";
}
switch (this.RadlZoneType.SelectedValue)
{
case "2":
return (this.DropPopType.SelectedValue + "," + this.TxtPopLeft.Text.Trim() + "," + this.TxtPopTop.Text.Trim() + "," + this.TxtPopCookieHour.Text.Trim() + "," + this.DropPopPosition.SelectedValue);
case "3":
return (this.TxtMoveLeft.Text.Trim() + "," + this.TxtMoveTop.Text.Trim() + "," + this.TxtMoveDelay.Text.Trim() + "," + this.RadlMoveShowCloseAD.SelectedValue + "," + this.TxtMoveCloseFontColor.Text.Trim() + "," + this.DropMovePosition.SelectedValue);
case "4":
return (this.TxtFixedLeft.Text.Trim() + "," + this.TxtFixedTop.Text.Trim() + "," + this.RadlFixedShowCloseAD.SelectedValue + "," + this.TxtFixedCloseFontColor.Text.Trim() + "," + this.DropFixedPosition.SelectedValue);
case "5":
return (this.DropFloatType.SelectedValue + "," + this.TxtFloatLeft.Text.Trim() + "," + this.TxtFloatTop.Text.Trim() + "," + this.RadlFloatShowCloseAD.SelectedValue + "," + this.TxtFloatCloseFontColor.Text.Trim() + "," + this.DropFloatPosition.SelectedValue);
case "7":
return (this.TxtCoupletLeft.Text.Trim() + "," + this.TxtCoupletTop.Text.Trim() + "," + this.TxtCoupletDelay.Text.Trim() + "," + this.RadlCoupletShowCloseAD.SelectedValue + "," + this.TxtCoupletCloseFontColor.Text.Trim());
}
return "";
}
private void InitDropADZoneSize(string flag)
{
this.DropAdZoneSize.Attributes.Add("OnChange", "Zone_SelectSize(this)");
if (flag != null)
{
for (int i = 0; i < this.DropAdZoneSize.Items.Count; i++)
{
if (this.DropAdZoneSize.Items[i].Value == flag)
{
this.DropAdZoneSize.Items[i].Selected = true;
}
}
}
else
{
this.DropAdZoneSize.Items[0].Selected = true;
}
}
private void InitRblADZoneDefaultSetting(int selected)
{
ListItem item = new ListItem();
item.Text = "默认设置";
item.Value = "0";
this.RadlDefaultSetting.Items.Add(item);
item = new ListItem();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -