您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->小区物业管理系统源码>>admin/editemployee.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:小区物业管理系统源码
当前文件:文件类型 SmallHouse/admin/editemployee.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; 12using System.IO; 13 14public partial class admin_Default2 : System.Web.UI.Page 15{ 16 BaseClass bc = new BaseClass(); 17 public static string picpath;//存放照片的地址 18 19 protected void Page_Load(object sender, EventArgs e) 20 { 21 if (Convert.ToString(Session["UID"]) == "") 22 { 23 Response.Redirect("login.aspx"); 24 25 } 26 27 if (!IsPostBack) 28 { 29 this.bind(); 30 } 31 } 32 protected void bind() 33 { 34 string id = Request.QueryString["ID"].ToString(); 35 string sqlstr = "select * from employee where ID='" + id + "'"; 36 try 37 { 38 SqlDataReader sda = bc.ExecRead(sqlstr); 39 if (sda.Read()) 40 { 41 ID.Text = id; 42 Name.Text = sda["Name"].ToString(); 43 SEX.Text = sda["sex"].ToString(); 44 Job.Text = sda["job"].ToString(); 45 Arrage.Text = sda["arrage"].ToString(); 46 Address.Text = sda["address"].ToString(); 47 TEL.Text = sda["tel"].ToString(); 48 Mobile.Text = sda["mobile"].ToString(); 49 CardID.Text = sda["cardID"].ToString(); 50 Image1.ImageUrl = sda["photoPath"].ToString(); 51 picpath = sda["photoPath"].ToString(); 52 //Response.Write(sda["photoPath"].ToString()); 53 //Response.End(); 54 } 55 else 56 { 57 Response.Write("<script>alert('数据读取错误,请重试!');</script>"); 58 return; 59 } 60 } 61 catch (Exception ex) 62 { 63 Response.Write("系统出错,出错原因:"+ex.Message); 64 return; 65 } 66 } 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 //上传图片文件 84 protected void Button3_Click(object sender, EventArgs e) 85 { 86 string str= this.FileUpload1.PostedFile.FileName; 87 if (str == "") 88 { 89 Response.Write("<script>alert('请选择图片!');</script>"); 90 return; 91 } 92 93 string name=str.Substring(str.LastIndexOf("\\")+1); 94 string path=Server.MapPath("..\\photo\\")+name;//获得图片上传到系统之后的物理路径 95 picpath = "..\\photo\\" + name;//存放到数据库的图片路径 96 97 //Response.Write(path); 98 //Response.End(); 99 if(File.Exists(path)) 100 { 101 Response.Write("<script>alert('图片已存在,请选择其它图片!');</script>"); 102 return; 103 } 104 this.FileUpload1.SaveAs(path); 105 Image1.Visible = true; 106 Image1.ImageUrl = picpath; 107 108 } 109 protected void Button1_Click(object sender, EventArgs e) 110 { 111 112 113 string id = ID.Text; 114 string name = Name.Text; 115 string sex = SEX.SelectedValue.ToString(); 116 string job = Job.Text; 117 string arrage=Arrage .Text; 118 string cardid = CardID.Text; 119 string address = Address.Text; 120 string mobile = Mobile.Text; 121 string tel = TEL.Text; 122 123 124 string sql = "update employee set ID='" + id + ",Name='" + name + "',sex=" + sex + ",job='" + job + "',arrage='" + arrage + "',cardID='" + cardid + "',address='"; 125 sql = sql + address + "',mobile='" + mobile + "',tel='" + tel + "',photoPath='" + picpath+"'"+" where ID="+id+""; 126 //Response.Write(sql); 127 //Response.End(); 128 129 if (bc.ExecSql(sql)) 130 { 131 Response.Write("<script language=javascript>alert('更新物业管理人员成功!');location='employee.aspx'</script>"); 132 } 133 else 134 { 135 Response.Write("<script>alert('编辑失败,请重试!');</script>"); 136 } 137 138 139 140 } 141 142} 143
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:小区物业管理系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号