UserAdd.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:2k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Configuration;
  5. using System.Text;
  6. using System.Collections;
  7. using System.Web;
  8. using System.Web.Security;
  9. using System.Web.UI;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Web.UI.HtmlControls;
  13. using System.Net;
  14. using com.etong.BusinessRule.Zwf;
  15. public partial class SysManage_UserAdd : System.Web.UI.Page
  16. {
  17.     
  18.     protected void Page_Load(object sender, EventArgs e)
  19.     {
  20.         BT_Cancel.Attributes.Add("onclick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
  21.     }
  22.     protected void BT_Confirm_Click(object sender, EventArgs e)
  23.     {
  24.         //string strHostIP = "";
  25.         //IPHostEntry iphost = Dns.Resolve(Environment.MachineName);
  26.         //if (iphost.AddressList.Length > 0)
  27.         //    strHostIP = iphost.AddressList[0].ToString();
  28.         
  29.       string account= this.TB_Account.Text;
  30.       string decs = this.TB_Decs.Text;
  31.       string strHostIP = this.TB_address.Text;
  32.       HtmlInputHidden txt_employeid = ((HtmlInputHidden)this.FindControl("txt_employeid"));
  33.       
  34.       string employeid = txt_employeid.Value;
  35.       int islock = 0;
  36.       if (this.CB_isLock.Checked == true)
  37.           islock = 1;
  38.       int ipbound = 0;
  39.       if (this.CB_isIPbound.Checked == true)
  40.           ipbound = 1;
  41.       EtongZwf etongzwf = new EtongZwf();
  42.        DataView dvsearch=etongzwf.UserSearch(account, "1",false);
  43.        if (dvsearch.Count > 0)
  44.        {
  45.            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:此帐户已存在!');</script>");
  46.            return;
  47.        }
  48.        bool returnvalue =false;
  49.       returnvalue = etongzwf.UserAdd(Convert.ToInt16(employeid), account, account, decs, 2, "111111", islock, strHostIP, ipbound, DateTime.Now, DateTime.Now, DateTime.Now);
  50.       if(returnvalue)
  51.           Response.Write("<script>alert('系统提示:添加记录成功!');</script>");
  52.       else
  53.          Response.Write("<script>alert('系统提示:添加记录不成功!');window.close();</script>");
  54.     
  55.        this.TB_Account.Text="";
  56.        this.TB_Decs.Text="";
  57.        this.TB_address.Text = "";
  58.        this.CB_isIPbound.Checked = false;
  59.        this.CB_isLock.Checked = false;
  60.     }
  61.    
  62.   
  63. }