Asp.net源码专业站
首页->新闻文章->某大学211工程办公室网站源码(生成静态页)>>AdminDown.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:某大学211工程办公室网站源码(生成静态页)
当前文件:文件类型 211HtmNewsAccess/AdminDown.aspx.cs[4K,2009-6-12 11:30:48]打开代码结构图
普通视图
		            
1using System; 2using System.IO; 3using System.Collections; 4using System.ComponentModel; 5using System.Data; 6using System.Drawing; 7using System.Web; 8using System.Web.SessionState; 9using System.Web.UI; 10using System.Web.UI.WebControls; 11using System.Web.UI.HtmlControls; 12 13namespace _211 14{ 15 /// <summary> 16 /// AdminDown 的摘要说明。 17 /// </summary> 18 public partial class AdminDown : System.Web.UI.Page 19 { 20 21 protected void Page_Load(object sender, System.EventArgs e) 22 { 23 if(Session["name"]==null) 24 { 25 Response.Write("<script>top.location='AdminLogin.aspx'</script>"); 26 return; 27 } 28 29 if(!Page.IsPostBack) 30 { 31 BindDown(); 32 BindDownType(); 33 DownList2Text(); 34 } 35 36 Button3.Attributes["onclick"]="return confirm('确定要删除么?')"; 37 } 38 39 private void BindDown() 40 { 41 d.DataSource=TableQuery.DownQuery(); 42 d.DataTextField="DownName"; 43 d.DataValueField="DownId"; 44 d.DataBind(); 45 } 46 47 private void BindDownType() 48 { 49 DataTable dt=TableQuery.DownTypeQuery(); 50 ty.Text=""; 51 for(int i=0;i<dt.Rows.Count;i++) 52 { 53 ty.Text+=dt.Rows[i][1].ToString()+" "; 54 } 55 } 56 57 private void DownList2Text() 58 { 59 if(d.SelectedItem!=null) 60 { 61 ename.Text=d.SelectedItem.Text; 62 intro.Text="<a href=\""+TableQuery.DownUrlQuery(d.SelectedValue)+"\">下载地址</a> <font color=red>下载文件如不需要修改文件浏览框请留空</font>"; 63 } 64 } 65 66 private void CreateStaticWeb() 67 { 68 using(CreateDown cd=new CreateDown()) 69 { 70 cd.Add(); 71 } 72 } 73 74 Web 窗体设计器生成的代码 93 94 protected void Button2_Click(object sender, System.EventArgs e) 95 { 96 if(name.Text==""||upfile.Value=="") 97 { 98 Response.Write("<script>alert('添加未成功');</script>"); 99 return; 100 } 101 102 using(Down dw=new Down()) 103 { 104 try 105 { 106 dw.setDownName(name.Text); 107 dw.setDownUrl(FileOperate.UpLoadFile(upfile)); 108 dw.Add(); 109 //upfile.Value=""; 110 name.Text=""; 111 112 Response.Write("<script>alert('添加成功');</script>"); 113 } 114 catch(Exception ex) 115 { 116 Response.Write("<script>alert('"+ex.Message.ToString()+"');</script>"); 117 } 118 } 119 120 CreateStaticWeb(); 121 BindDown(); 122 DownList2Text(); 123 } 124 125 protected void Button1_Click(object sender, System.EventArgs e) 126 { 127 128 if(ename.Text==""||d.SelectedItem==null) 129 { 130 return; 131 } 132 133 using(Down dw=new Down(Convert.ToUInt32(d.SelectedValue))) 134 { 135 try 136 { 137 dw.setDownName(ename.Text); 138 if(up.Value!="") 139 { 140 FileOperate.DelFile(dw.getDownUrl()); 141 dw.setDownUrl(FileOperate.UpLoadFile(up)); 142 } 143 dw.Update(); 144 //up.Value=""; 145 146 Response.Write("<script>alert('修改成功');</script>"); 147 } 148 catch(Exception ex) 149 { 150 Response.Write("<script>alert('"+ex.Message.ToString()+"');</script>"); 151 } 152 } 153 154 CreateStaticWeb(); 155 BindDown(); 156 DownList2Text(); 157 } 158 159 protected void Button3_Click(object sender, System.EventArgs e) 160 { 161 if(d.SelectedItem==null) 162 { 163 return; 164 } 165 166 using(Down dw=new Down(Convert.ToUInt32(d.SelectedValue))) 167 { 168 try 169 { 170 FileOperate.DelFile(dw.getDownUrl()); 171 172 dw.Del(); 173 Response.Write("<script>alert('删除成功');</script>"); 174 } 175 catch(Exception ex) 176 { 177 Response.Write("<script>alert('"+ex.Message.ToString()+"');</script>"); 178 } 179 } 180 181 CreateStaticWeb(); 182 BindDown(); 183 DownList2Text(); 184 185 int temp=(int)DBQuery.ExecuteScalar("select count(*) from down"); 186 if(temp%10==0) 187 { 188 FileInfo fi=new FileInfo(Request.ServerVariables["APPL_PHYSICAL_PATH"].ToString()+"Down_"+(temp/10)+".htm"); 189 if(fi.Exists)fi.Delete(); 190 } 191 } 192 193 protected void d_SelectedIndexChanged(object sender, System.EventArgs e) 194 { 195 DownList2Text(); 196 } 197 } 198} 199
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:某大学211工程办公室网站源码(生成静态页)
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146