您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->小区物业管理系统源码>>admin/addemployee.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:小区物业管理系统源码
当前文件:文件类型 SmallHouse/admin/addemployee.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 public static string picpath="..\\photo\\default.gif";//存放照片的地址 17 18 protected void Page_Load(object sender, EventArgs e) 19 { 20 if (Convert.ToString(Session["UID"]) == "") 21 { 22 Response.Redirect("login.aspx"); 23 24 } 25 26 } 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 //上传图片文件 46 protected void Button3_Click(object sender, EventArgs e) 47 { 48 string str= this.FileUpload1.PostedFile.FileName; 49 if (str == "") 50 { 51 Response.Write("<script>alert('请选择图片!');</script>"); 52 return; 53 } 54 55 string name=str.Substring(str.LastIndexOf("\\")+1);//获得文件名称 56 string path=Server.MapPath("..\\photo\\")+name;//获得图片上传到系统之后的物理路径 57 picpath = "..\\photo\\" + name;//存放到数据库的图片路径 58 59 //Response.Write(path); 60 //Response.End(); 61 if(File.Exists(path)) 62 { 63 Response.Write("<script>alert('图片已存在,请选择其它图片!');</script>"); 64 return; 65 } 66 this.FileUpload1.SaveAs(path); 67 Image1.Visible = true; 68 Image1.ImageUrl = picpath; 69 70 } 71 protected void Button1_Click(object sender, EventArgs e) 72 { 73 BaseClass bc = new BaseClass(); 74 string id = ID.Text; 75 string name = Name.Text; 76 string sex = SEX.SelectedValue.ToString(); 77 string job = Job.Text; 78 string arrage=Arrage .Text; 79 string cardid = CardID.Text; 80 string address = Address.Text; 81 string mobile = Mobile.Text; 82 string tel = TEL.Text; 83 string sql = "select count(*) from employee where ID='" + id + "'"; 84 int count = (int)bc.ExecCscalar(sql); 85 if (count > 0) 86 { 87 Response.Write("<script>alert('编号重复');</script>"); 88 return; 89 } 90 91 sql="insert into employee(ID,name,sex,job,arrage,address,tel,mobile,cardID,photoPath) values('"; 92 sql=sql+id+"','"+name+"',"+sex+",'"+job+"','"+arrage+"','"+address+"','"+tel+"','"+mobile+"','"+cardid+"','"+picpath+"')"; 93 94 // Response.Write(sql); 95 // Response.End(); 96 97 if (bc.ExecSql(sql)) 98 { 99 Response.Write("<script language=javascript>alert('添加物业管理人员成功!');location='employee.aspx'</script>"); 100 } 101 else 102 { 103 Response.Write("<script>alert('添加失败,请重试!');</script>"); 104 } 105 106 107 108 } 109} 110
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:小区物业管理系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号