您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->小区物业管理系统源码>>admin/codetable.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:小区物业管理系统源码
当前文件:文件类型 SmallHouse/admin/codetable.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 System.Data.SqlClient; 12 13public partial class admin_Default2 : System.Web.UI.Page 14{ 15 BaseClass bc = new BaseClass(); 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 19 //if (Convert.ToString(Session["UID"]) == "") 20 //{ 21 // Response.Redirect("login.aspx"); 22 23 //} 24 if (!IsPostBack) 25 { 26 bc.ExecDropDownList(para,"select * from type where type='title'","name","typecode"); 27 } 28 } 29 protected void bind() 30 { 31 string type=para.SelectedItem.Value; 32 33 string sqlcount="select count(*) from type where type='"+type+"'"; 34 int count=(int)bc.ExecCscalar(sqlcount); 35 Label1.Text="合计共有记录数:"+count.ToString(); 36 string sql="select id,code,name,(select name from type where type='title' and typecode=a.type) as typename from type a where type='"+type+"' order by code"; 37 //Response.Write(sql); 38 //Response.End(); 39 bc.ExecGridView(GridView1,sql); 40 41 42 43 } 44 45 46 47 48 49 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 50 { 51 this.bind(); 52 } 53 54 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) 55 { 56 this.GridView1.EditIndex = e.NewEditIndex; 57 this.bind(); 58 } 59 protected void GridView1_RowCanceling(object sender, GridViewCancelEditEventArgs e) 60 { 61 this.GridView1.EditIndex = -1; 62 this.bind(); 63 } 64 65 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) 66 { 67 string name = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.Trim(); 68 string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); 69 string sql = "update type set name='" + name + "' where id=" + id; 70 // Response.Write(sql); 71 // Response.End(); 72 bc.ExecSql(sql); 73 this.GridView1.EditIndex = -1; 74 this.bind(); 75 76 77 } 78 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) 79 { 80 string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); 81 string sql = "delete type where id=" + id; 82 83 if (!bc.ExecSql(sql)) 84 { 85 Response.Write("<script>alert('删除失败,请重试!');</script>"); 86 return; 87 } 88 this.bind(); 89 90 } 91 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 92 { 93 if (e.Row.RowType == DataControlRowType.DataRow) 94 { 95 96 97 98 // ((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗,删除将不能恢复?')"); 99 // e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#22dd22';this.Style.color='buttontext';this.Style.cursor='default';"); 100 // e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';"); 101 } 102 } 103 protected void Button1_Click(object sender, EventArgs e) 104 { 105 string type = para.SelectedItem.Value; 106 string code = txtcode.Text.Trim(); 107 string name = txtname.Text.Trim(); 108 string valsql = "select count(*) from type where code='" + code + "' and type='" + type + "'"; 109 // Response.Write(valsql); 110 //Response.End(); 111 int count = (int)bc.ExecCscalar(valsql); 112 if (count > 0) 113 { 114 Label2.Visible = true; 115 Label2.Text = "代码重复"; 116 117 } 118 else 119 { 120 string sql = "insert into type (code,name,type) values('" + code + "','" + name + "','" + type + "')"; 121 if (bc.ExecSql(sql)) 122 { 123 Response.Write("<script>alert('添加成功');</script>"); 124 this.bind(); 125 126 } 127 } 128 129 } 130} 131 132 133
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:小区物业管理系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号