您目前尚未登陆,请选择【登陆】或【注册
首页->新闻文章->破竹CMS4.0免安装版源码>>admin/Categories/Rates.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:破竹CMS4.0免安装版源码
当前文件:文件类型 PozhuCMS/admin/Categories/Rates.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using Pozhu.CMS.Rates; 12using Pozhu.CMS.Categories; 13using Pozhu.Sites; 14using Pozhu.UI.Utilities; 15using Pozhu.CMS.Web; 16 17public partial class admin_Categories_Rates : AdminPageBase 18{ 19 protected void Page_Load(object sender, EventArgs e) 20 { 21 if (!Page.IsPostBack) 22 { 23 this.BindRates(); 24 } 25 } 26 27 void BindRates() 28 { 29 string path = CategoryPath.CheckRepairPath(Request.QueryString["path"]); 30 int siteID = SiteController.GetCurrentSite().SiteID; 31 32 Category c = CategoryController.GetCategory(siteID, path); 33 34 this.rptRates.DataSource = RateController.GetRateItems(c.CategoryID); 35 this.rptRates.DataBind(); 36 } 37 38 protected void rptRates_ItemCommand(object source, RepeaterCommandEventArgs e) 39 { 40 string path = CategoryPath.CheckRepairPath(Request.QueryString["path"]); 41 int siteID = SiteController.GetCurrentSite().SiteID; 42 Category category = CategoryController.GetCategory(siteID, path); 43 44 string commandName = e.CommandName; 45 if (e.Item.ItemType == ListItemType.Header) 46 { 47 if (commandName == "add") 48 { 49 RateItem rate = new RateItem(); 50 rate.CategoryID = category.CategoryID; 51 rate.Name = ((TextBox)e.Item.FindControl("tbName")).Text; 52 rate.Value = Convert.ToInt32(((TextBox)e.Item.FindControl("tbValue")).Text); 53 RateController.CreateRateItem(rate); 54 BindRates(); 55 } 56 } 57 else if ((e.Item.ItemType == ListItemType.Item) || e.Item.ItemType == ListItemType.AlternatingItem) 58 { 59 if (commandName == "cancel") 60 { 61 Response.Redirect(Request.RawUrl); 62 } 63 else if (commandName == "delete") 64 { 65 RateController.DeleteRateItem(Convert.ToInt32(e.CommandArgument.ToString())); 66 BindRates(); 67 } 68 else if (commandName == "edit") 69 { 70 e.Item.FindControl("lbtnEdit").Visible = false; 71 e.Item.FindControl("lbtnUpdate").Visible = true; 72 e.Item.FindControl("lbtnDelete").Visible = false; 73 e.Item.FindControl("lbtnCancel").Visible = true; 74 e.Item.FindControl("lblName").Visible = false; 75 e.Item.FindControl("tbName").Visible = true; 76 e.Item.FindControl("lblValue").Visible = false; 77 e.Item.FindControl("tbValue").Visible = true; 78 } 79 else if (commandName == "update") 80 { 81 RateItem rate = RateController.GetRateItem(Convert.ToInt32(e.CommandArgument.ToString())); 82 rate.Name = ((TextBox)e.Item.FindControl("tbName")).Text; 83 rate.Value = Convert.ToInt32(((TextBox)e.Item.FindControl("tbValue")).Text); 84 RateController.UpdateRateItem(rate); 85 86 Response.Redirect(Request.RawUrl); 87 } 88 } 89 } 90 protected void rptRates_ItemDataBound(object sender, RepeaterItemEventArgs e) 91 { 92 if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) 93 { 94 Label lblPath = (Label)e.Item.FindControl("lblPath"); 95 LinkButton lbtnDelete = ((LinkButton)e.Item.FindControl("lbtnDelete")); 96 97 lblPath.Text = CategoryController.GetCategory(((RateItem)e.Item.DataItem).CategoryID).Path; 98 99 100 ClientAPI.AddButtonConfirm(lbtnDelete, string.Format("确定删除此关联吗?")); 101 } 102 } 103} 104
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:破竹CMS4.0免安装版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号