Exemplo n.º 1
0
 /// <summary>
 /// 添加版位
 /// </summary>
 /// <param name="adZone"></param>
 /// <returns></returns>
 public static bool ADZone_Add(M_Adzone adZone)
 {
     if (!adzone.ADZone_Add(adZone))
     {
         return false;
     }
     else
     {
         CreateJS(adZone.ZoneID.ToString());
     }
     return true;
 }
Exemplo n.º 2
0
        public M_Adzone GetModelFromReader(DbDataReader rdr)
        {
            M_Adzone model = new M_Adzone();

            model.ZoneID         = Convert.ToInt32(rdr["ZoneID"]);
            model.ZoneName       = ConverToStr(rdr["ZoneName"]);
            model.ZoneJSName     = ConverToStr(rdr["ZoneJSName"]);
            model.ZoneIntro      = ConverToStr(rdr["ZoneIntro"]);
            model.ZoneType       = ConvertToInt(rdr["ZoneType"]);
            model.DefaultSetting = ConverToBool(rdr["DefaultSetting"]);
            model.ZoneSetting    = ConverToStr(rdr["ZoneSetting"]);
            model.ZoneWidth      = ConvertToInt(rdr["ZoneWidth"]);
            model.ZoneHeight     = ConvertToInt(rdr["ZoneHeight"]);
            model.Active         = ConverToBool(rdr["Active"]);
            model.ShowType       = ConvertToInt(rdr["ShowType"]);
            model.UpdateTime     = ConvertToDate(rdr["UpdateTime"]);
            model.Sales          = ConvertToInt(rdr["Sales"]);
            rdr.Close();
            rdr.Dispose();
            return(model);
        }
Exemplo n.º 3
0
        public override SqlParameter[] GetParameters()
        {
            M_Adzone model = this;

            SqlParameter[] sp = GetSP();
            sp[0].Value  = model.ZoneID;
            sp[1].Value  = model.ZoneName;
            sp[2].Value  = model.ZoneJSName;
            sp[3].Value  = model.ZoneIntro;
            sp[4].Value  = model.ZoneType;
            sp[5].Value  = model.DefaultSetting;
            sp[6].Value  = model.ZoneSetting;
            sp[7].Value  = model.ZoneWidth;
            sp[8].Value  = model.ZoneHeight;
            sp[9].Value  = model.Active;
            sp[10].Value = model.ShowType;
            sp[11].Value = model.UpdateTime;
            sp[12].Value = model.Sales;

            return(sp);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 创建广告版位JS
 /// </summary>
 /// <param name="adZoneInfo"></param>
 /// <param name="advertisementInfoList"></param>
 public void CreateJS(M_Adzone adZoneInfo, IList<M_Advertisement> advertisementInfoList)
 {
     //将当前版位对象设置为要操作的版位对象
     this.zoneInfo = adZoneInfo;
     //读取模板基本代码
     StringBuilder builder = new StringBuilder(this.GetZoneJSTemplate());
     //定义版位对象
     builder.Append("var ZoneAD_" + adZoneInfo.ZoneID + "=new ");
     builder.Append(string.Concat(new object[] { this.zoneConfig[adZoneInfo.ZoneType], "ZoneAD(\"ZoneAD_", adZoneInfo.ZoneID, "\");" }));
     //将广告对象定义加入到JS代码中
     for (int i = 0; i < advertisementInfoList.Count; i++)
     {
         this.advertisementInfo = advertisementInfoList[i];
         this.advertisementInfo.ZoneID = adZoneInfo.ZoneID;
         if (this.advertisementInfo.Passed && (this.advertisementInfo.Days >= 0))
         {
             builder.Append(this.CreatAdvertisementJS());
         }
     }
     //加入版位属性定义
     builder.Append(this.CreateADZoneJS());
     FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Server.MapPath("~/" + SiteConfig.SiteOption.AdvertisementDir)) + adZoneInfo.ZoneJSName, builder.ToString());
 }
Exemplo n.º 5
0
 /// <summary>
 /// 添加版位
 /// </summary>
 /// <param name="adZone"></param>
 /// <returns></returns>
 bool ID_Adzone.ADZone_Add(M_Adzone adZone)
 {
     SqlParameter[] parameter = null;
     this.GetAdzoneParameter(adZone,ref parameter);
     return (SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "dt_ADZone_Add", parameter)>0);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 实例化
 /// </summary>
 /// <param name="rdr"></param>
 /// <returns></returns>
 private M_Adzone GetInfoFromReader(SqlDataReader rdr)
 {
     M_Adzone info = new M_Adzone();
     info.ZoneID = DataConverter.CLng(rdr["ZoneID"]);
     info.ZoneName = rdr["ZoneName"].ToString();
     info.ZoneJSName = rdr["ZoneJSName"].ToString();
     info.ZoneIntro = rdr["ZoneIntro"].ToString();
     info.ZoneType = DataConverter.CLng(rdr["ZoneType"]);
     info.DefaultSetting = DataConverter.CBool(rdr["DefaultSetting"].ToString());
     info.ZoneSetting = rdr["ZoneSetting"].ToString();
     info.ZoneHeight = DataConverter.CLng(rdr["ZoneHeight"]);
     info.ZoneWidth = DataConverter.CLng(rdr["ZoneWidth"]);
     info.Active = DataConverter.CBool(rdr["Active"].ToString());
     info.ShowType = DataConverter.CLng(rdr["ShowType"]);
     info.UpdateTime = DataConverter.CDate(rdr["UpdateTime"]);
     return info;
 }
Exemplo n.º 7
0
 private void GetAdzoneParameter(M_Adzone adzone, ref SqlParameter[] parameter)
 {
     parameter = new SqlParameter[] {
         new SqlParameter("@ZoneId", SqlDbType.Int),
         new SqlParameter("@ZoneName", SqlDbType.NVarChar, 100),
         new SqlParameter("@ZoneJSName", SqlDbType.NVarChar, 100),
         new SqlParameter("@ZoneIntro", SqlDbType.NVarChar, 255),
         new SqlParameter("@ZoneType", SqlDbType.Int ,4),
         new SqlParameter("@DefaultSetting", SqlDbType.Bit),
         new SqlParameter("@ZoneSetting", SqlDbType.NVarChar, 255),
         new SqlParameter("@ZoneWidth", SqlDbType.Int),
         new SqlParameter("@ZoneHeight", SqlDbType.Int),
         new SqlParameter("@Active", SqlDbType.Bit),
         new SqlParameter("@ShowType", SqlDbType.Int),
         new SqlParameter("@UpdateTime", SqlDbType.DateTime)
     };
     parameter[0].Value = adzone.ZoneID;
     parameter[1].Value = adzone.ZoneName;
     parameter[2].Value = adzone.ZoneJSName;
     parameter[3].Value = adzone.ZoneIntro;
     parameter[4].Value = adzone.ZoneType;
     parameter[5].Value = adzone.DefaultSetting;
     parameter[6].Value = adzone.ZoneSetting;
     parameter[7].Value = adzone.ZoneWidth;
     parameter[8].Value = adzone.ZoneHeight;
     parameter[9].Value = adzone.Active;
     parameter[10].Value = adzone.ShowType;
     parameter[11].Value = adzone.UpdateTime;
 }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         B_Admin badmin = new B_Admin();
         badmin.CheckMulitLogin();
         if (!badmin.ChkPermissions("ADManage"))
         {
             function.WriteErrMsg("没有权限进行此项操作");
         }
         this.DropFixedPosition.Attributes.Add("onchange", "ChangePositonShow(this)");
         this.DropFloatPosition.Attributes.Add("onchange", "ChangePositonShow(this)");
         this.DropMovePosition.Attributes.Add("onchange", "ChangePositonShow(this)");
         this.DropPopPosition.Attributes.Add("onchange", "ChangePositonShow(this)");
         foreach (ListItem lit in this.radlZonetype.Items)
         {
             lit.Attributes.Add("onclick", "ShowZoenTypePanel()");
         }
         foreach (ListItem li2 in this.RBLDefaultSetting.Items)
         {
             li2.Attributes.Add("onclick", "ShowZoenTypePanel()");
         }
         this.DropAdZoneSize.Attributes.Add("onchange", "Zone_SelectSize(this)");
         string zoneid = base.Request.QueryString["ZoneId"];
         if (string.IsNullOrEmpty(zoneid))
         {
             this.TxtZoneJSName.Text = this.GetJSFileName();
             zoneid = "0";
             this.HdnZoneId.Value = zoneid;
             this.Label1.Text = "添加广告版位";
         }
         else
         {
             this.HdnZoneId.Value = zoneid;
             this.Label1.Text = "修改广告版位";
             adzone = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(zoneid));
             this.TxtZoneName.Text = adzone.ZoneName;
             this.TxtZoneJSName.Text = adzone.ZoneJSName;
             this.TxtZoneIntro.Text = adzone.ZoneIntro;
             this.TxtZoneHeight.Text = adzone.ZoneHeight.ToString();
             this.TxtZoneWidth.Text = adzone.ZoneWidth.ToString();
             this.radlZonetype.SelectedValue = adzone.ZoneType.ToString();
             if (!adzone.DefaultSetting)
             {
                 this.RBLDefaultSetting.SelectedValue = "0";
             }
             else
             {
                 this.RBLDefaultSetting.SelectedValue = "1";
             }
             InitShowPanel(adzone.ZoneType);
             InitSetting(adzone.ZoneSetting, adzone.ZoneType);
             this.RadlShowType.SelectedValue = adzone.ShowType.ToString();
             if (adzone.Active)
                 this.ChkActive.Checked = true;
             else
                 this.ChkActive.Checked = false;
         }
     }
 }