資源簡介
\XML同學錄系\XML同學錄系統\XML同學錄系統\XML同學錄系統統

代碼片段和文件信息
using?System;
using?System.Data;
using?System.Configuration;
using?System.Collections;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.UI.HtmlControls;
using?xmlOp;
public?partial?class?setAdmin?:?System.Web.UI.Page
{
????string?xmlFile=?ConfigurationManager.AppSettings[“xmlFile“];
????Logic?lg?=?new?Logic();???//創建Logic類對象?
????DataSet?ds?=?new?DataSet();
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????if?(!IsPostBack)
????????{
????????????//驗證是否管理員
????????????if?(Convert.ToString(Session[“NormalAdmin“])?!=?“yes“)
????????????{
????????????????Response.Write(“你沒有權限查看!“);
????????????????Response.End();
????????????}
????????????BindToDataGrid();?//數據綁定到DataGrid控件
????????}
????}
????//數據綁定到DataGrid,顯示班級所有成員
????private?void?BindToDataGrid()
????{
????????try
????????{
????????????xmlOp?op?=?new?xmlOp(xmlFile);
????????????ds?=?op.GetDs(“//Root“);
????????????this.DataGrid1.DataKeyField?=?“Name“;
????????????this.DataGrid1.DataSource?=?ds;
????????????this.DataGrid1.DataBind();
????????}
????????catch
????????{
????????????Response.Write(“出現不明錯誤?!“);
????????????Response.End();
????????}
????}
????//每項數據綁定時事件
????protected?void?DataGrid1_ItemDataBound(object?sender?DataGridItemEventArgs?e)
????{
????????if?(e.Item.ItemType?==?ListItemType.AlternatingItem?||?e.Item.ItemType?==?ListItemType.Item)
????????{
????????????((linkButton)(e.Item.Cells[6].Controls[0])).Attributes.Add(“onclick“?“return?confirm(‘你確定要刪除嗎?‘);“);
????????????if?(Convert.ToString(Session[“SuperAdmin“])?==?“yes“)?//若為超級管理員
????????????{
????????????????((Button)(e.Item.Cells[7].FindControl(“btnSetAdmin“))).Visible?=?true;??//顯示設置管理員按鈕
????????????????((Button)(e.Item.Cells[7].FindControl(“btnNoAdmin“))).Visible?=?true;???//顯示取消管理員按鈕
????????????}
????????}
????}
????//刪除某個同學
????protected?void?DataGrid1_DeleteCommand(object?source?DataGridCommandEventArgs?e)
????{
????????xmlOp?op?=?new?xmlOp(xmlFile);
????????string?_delName?=?this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString();?//取得關鍵字段
????????string?_delNode?=?“//Root/Student[Name=‘“?+?_delName?+?“‘]“;
????????string?_photo?=?op.SelectNodeText(“//Root/Student[Name=‘“?+?_delName?+?“‘]/Photo“);
????????if?(op.DeleteNode(_delNode))????//刪除操作
????????{
????????????op.Save(xmlFile);?//保存xml文檔
????????????if?(System.IO.File.Exists(HttpContext.Current.Server.MapPath(_photo)))
????????????{
????????????????try
????????????????{
????????????????????//刪除相應圖片
????????????????????System.IO.File.Delete(HttpContext.Current.Server.MapPath(_photo));
????????????????}
????????????????catch?(Exception?ex)
????????????????{
????????????????????throw?ex;
????????????????}
????????????}
????????????Response.AddHeader(“refresh“?“0“);?//刷新整個頁面
????????}
????}
????//一般管理員的設置
????protected?void?DataGrid1_ItemC
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????957??2008-03-26?11:49??xm
?????文件???????1408??2008-03-18?10:28??xm
?????目錄??????????0??2008-03-18?16:38??xm
?????文件???????1003??2008-03-26?13:53??源碼必讀.txt
?????文件???????2657??2008-03-18?18:27??admin.aspx
?????文件???????4215??2008-03-18?18:40??admin.aspx.cs
?????文件???????2287??2008-03-18?15:59??Default.aspx
?????文件???????1550??2008-03-18?15:54??Default.aspx.cs
?????文件???????4945??2007-07-18?09:38??from.gif
?????文件???????8447??2008-03-26?11:52??index.aspx
?????文件???????8368??2008-03-18?19:07??index.aspx.cs
?????文件????????961??2008-03-17?13:29??login.aspx
?????文件????????858??2008-03-18?19:10??login.aspx.cs
?????文件???????6153??2008-03-18?16:11??reg.aspx
?????文件???????4479??2008-03-18?16:29??reg.aspx.cs
?????文件????????449??2008-03-16?18:29??stuInfo.aspx
?????文件???????2821??2008-03-18?18:09??stuInfo.aspx.cs
?????文件???????1920??2008-03-26?11:47??Web.Config
?????文件????????125??2007-03-27?14:33??最新Asp.Net源碼下載.url
?????文件???????3247??2008-03-26?11:46??App_Code\Logic.cs
?????文件???????9928??2008-03-26?11:48??App_Code\xm
?????目錄??????????0??2008-03-18?15:29??App_Code
?????目錄??????????0??2008-03-09?10:50??App_Data
?????文件???????4945??2007-07-18?09:38??images\from.gif
?????文件???????6181??2008-03-18?10:15??images\rock.gif
?????目錄??????????0??2008-03-26?11:51??images
?????文件???????6181??2006-04-30?09:32??img\boy.gif
?????文件???????4945??2007-07-18?09:38??img\from.gif
?????文件???????6562??2006-04-30?09:32??img\girl.gif
?????目錄??????????0??2008-03-26?11:51??img
............此處省略5個文件信息
- 上一篇:校園二手商品交易需求分析
- 下一篇:往年卷子.zip
評論
共有 條評論