Asp.net源码专业站
首页->博客空间->SpaceBuilderV1.0RC免安装版源码(51aspx调测)>>BasicWebControls/Manage/Advertising/EditAdvertisingPosition.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilderV1.0RC免安装版源码(51aspx调测)
当前文件:文件类型 SpaceBuilderV10RC/BasicWebControls/Manage/Advertising/EditAdvertisingPosition.cs[6K,2009-6-12 11:55:43]打开代码结构图
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System; 8using System.Collections; 9using System.Collections.Generic; 10using System.Text; 11using SpaceBuilder.Components; 12using SpaceBuilder.Security; 13using System.Web.UI.WebControls; 14using SpaceBuilder.Configuration; 15using TunyNet.Caching; 16using SpaceBuilder.Controls.Utils; 17using SpaceBuilder.Utils; 18using SpaceBuilder.Posts.Permissions; 19 20namespace SpaceBuilder.Web.Manage.Controls 21{ 22 public class EditAdvertisingPosition : ManageBaseControl 23 { 24 SBContext wlContext; 25 26 protected override void Authorize() 27 { 28 if (!SBContext.Current.User.IsAdministrator) 29 PermissionBase.RedirectOrExcpetion(SBExceptionType.AccessDenied); 30 } 31 32 protected override void OnInit(EventArgs e) 33 { 34 if (SkinName == null) 35 SkinName = "Skin-EditAdvertisingPosition.ascx"; 36 37 wlContext = SBContext.Current; 38 39 base.OnInit(e); 40 } 41 42 protected override void OnLoad(EventArgs e) 43 { 44 base.OnLoad(e); 45 46 if (!Page.IsPostBack) 47 { 48 DataBind(); 49 } 50 } 51 52 public override void DataBind() 53 { 54 base.DataBind(); 55 BindData(); 56 } 57 58 Child Controls 77 78 protected override void AttachChildControls() 79 { 80 pageTitle = FindControl("PageTitle") as Literal; 81 pageTitle.Text = "增加广告位置"; 82 83 statusMessage = FindControl("StatusMessage") as StatusMessage; 84 85 positionCode = FindControl("PositionCode") as TextBox; 86 width = FindControl("Width") as TextBox; 87 height = FindControl("Height") as TextBox; 88 description = FindControl("Description") as TextBox; 89 allowNumber = FindControl("AllowNumber") as TextBox; 90 allowSystem = FindControl("AllowSystem") as CheckBox; 91 allowClub = FindControl("AllowClub") as CheckBox; 92 allowUser = FindControl("AllowUser") as CheckBox; 93 94 usedAdvertisingRepeater = FindControl("UsedAdvertisingRepeater") as Repeater; 95 96 saveButton = FindControl("SaveButton") as Button; 97 cancelButton = FindControl("CancelButton") as Button; 98 saveButton.Click += new EventHandler(SaveButton_Click); 99 cancelButton.Click += new EventHandler(cancelButton_Click); 100 } 101 102 void BindData() 103 { 104 int positioncode = wlContext.GetIntFromQueryString("PositionCode", 0); 105 106 if (positioncode > 0) 107 { 108 AdvertisingPosition record = AdvertisingPositions.GetAdvertisingPosition(positioncode); 109 if (record != null) 110 { 111 pageTitle.Text = "修改广告位置"; 112 saveButton.Text = "修改"; 113 114 positionCode.Text = record.PositionCode.ToString(); 115 positionCode.Enabled = false; 116 117 width.Text = record.Width.ToString(); 118 height.Text = record.Height.ToString(); 119 description.Text = record.Description; 120 allowNumber.Text = record.AllowNumber.ToString(); 121 122 if (record.AllowSystem) 123 { 124 allowSystem.Checked = true; 125 } 126 else 127 { 128 allowSystem.Checked = false; 129 } 130 131 if (record.AllowClub) 132 { 133 allowClub.Checked = true; 134 } 135 else 136 { 137 allowClub.Checked = false; 138 } 139 140 if (record.AllowUser) 141 { 142 allowUser.Checked = true; 143 } 144 else 145 { 146 allowUser.Checked = false; 147 } 148 149 usedAdvertisingRepeater.DataSource = AdvertisingsManager.GetAdvertisings(AdvertisingOwnerType.System).GetAdvertisingsByPositionCodeOwnerID(positioncode, wlContext.UserID); 150 usedAdvertisingRepeater.DataBind(); 151 } 152 } 153 } 154 155 /// <summary> 156 /// 保存 157 /// </summary> 158 protected void SaveButton_Click(Object sender, EventArgs e) 159 { 160 int positioncode = wlContext.GetIntFromQueryString("PositionCode", 0); 161 AdvertisingPosition record = new AdvertisingPosition(); 162 record.Width = Convert.ToInt16(width.Text); 163 record.Height = Convert.ToInt16(height.Text); 164 record.Description = description.Text; 165 record.AllowNumber = Convert.ToInt32(allowNumber.Text); 166 record.AllowSystem = allowSystem.Checked; 167 record.AllowClub = allowClub.Checked; 168 record.AllowUser = allowUser.Checked; 169 170 //修改 171 if (positioncode > 0) 172 { 173 record.PositionCode = positioncode; 174 175 AdvertisingPositions.UpdateAdvertisingPosition(record); 176 } 177 else 178 { 179 record.PositionCode = Convert.ToInt32(positionCode.Text); 180 181 AdvertisingPositions.CreateAdvertisingPosition(record); 182 } 183 Context.Response.Redirect(ManagerUrls.Instance().ManageAdvertisingPositions(), true); 184 } 185 186 void cancelButton_Click(object sender, EventArgs e) 187 { 188 Context.Response.Redirect(ManagerUrls.Instance().ManageAdvertisingPositions(), true); 189 } 190 } 191} 192
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:SpaceBuilderV1.0RC免安装版源码(51aspx调测)
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146