public Join() { pagetitle = "代理加盟"; flg_nav = "join"; if (!IsPostBack) { if (HttpContext.Current.Request.HttpMethod.ToString() == "POST") { JmInfo info = new JmInfo(); info.uname = pform("uname"); info.age = pform("age"); info.address = pform("address"); info.telphone = pform("telphone"); info.fax = pform("fax"); info.company = pform("company"); info.comaddress = pform("comaddress"); info.zijin = pform("zijin"); info.content = pform("content"); JmDal j = new JmDal(); j.addnew(info); HttpContext.Current.Response.Write("<script type=\"text/javascript\">alert('提交成功');location.href='join.aspx';</script>"); HttpContext.Current.Response.End(); } } }
public bool addnew(JmInfo info) { add("jm", "uname", 2, 50, info.uname, "age", 2, 50, info.age, "address", 2, 50, info.address, "telphone", 2, 50, info.telphone, "fax", 2, 50, info.fax, "company", 2, 50, info.company, "comaddress", 2, 50, info.comaddress, "zijin", 2, 50, info.zijin, "content",2,info.content.Length,info.content ); return true; }
//ÐÞ¸Ä public void edit(JmInfo info) { edit("jm","id="+info.Id.ToString(), "uname", 2, 50, info.uname, "age", 2, 50, info.age, "address", 2, 50, info.address, "telphone", 2, 50, info.telphone, "fax", 2, 50, info.fax, "company", 2, 50, info.company, "comaddress", 2, 50, info.comaddress, "zijin", 2, 50, info.zijin, "content", 2, info.content.Length, info.content ); }
//¶ÁÈ¡ public JmInfo read(int id) { DataRow da = get_info("jm", id.ToString()); JmInfo info = new JmInfo(); info.Id = Int32.Parse(da["id"].ToString()); info.uname = da["uname"].ToString(); info.age = da["age"].ToString(); info.address = da["address"].ToString(); info.telphone = da["telphone"].ToString(); info.fax = da["fax"].ToString(); info.company = da["company"].ToString(); info.comaddress = da["comaddress"].ToString(); info.zijin = da["zijin"].ToString(); info.content = da["content"].ToString(); return info; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = 0; gnum(ref id, "id"); JmInfo info = new JmInfo(); JmDal jm = new JmDal(); info = jm.read(id); uname.Text = info.uname; sex.Text = info.sex; address.Text = info.address; age.Text = info.age; telphone.Text = info.telphone; fax.Text = info.fax; company.Text = info.company; comaddress.Text = info.comaddress; zijin.Text = info.zijin; content.Text = info.content; } }