protected void Page_Load(object sender, EventArgs e) { action = Request.QueryString["action"].ToString(); //if (action == "new") //{ // Id = Request.QueryString["Id"].ToString(); // Bz = Request.QueryString["Bz"].ToString(); // //TypeId = int.Parse(Session["TypeId"].ToString()); // AppUser = Ctrl_Approve.GetUserById(Id); //} //else if (action == "modify") //{ // id = long.Parse(Request.QueryString["id"].ToString()); // fid = long.Parse(Request.QueryString["fid"].ToString()); // txtTel1.Enabled = true; //} if (action == "new") { Id = Request.QueryString["Id"].ToString(); Bz = Request.QueryString["Bz"].ToString(); //TypeId = int.Parse(Session["TypeId"].ToString()); AppUser = Ctrl_Approve.GetUserById(Id); //获得申请表的基本信息 } else if (action == "modify") { id = long.Parse(Request.QueryString["id"].ToString()); fid = long.Parse(Request.QueryString["fid"].ToString()); txtTel1.Enabled = true; } //AppUser = Ctrl_Approve.GetUserById(Id); //获得申请表的基本信息 if (!IsPostBack) { Bind(action);//绑定申请人基本信息 txtHome.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { Id = Request.QueryString["Id"].ToString(); Bz = Request.QueryString["Bz"].ToString(); TypeId = int.Parse(Session["TypeId"].ToString()); AppUser = Ctrl_Approve.GetUserById(Id); if (!IsPostBack) { Bind();//绑定申请人基本信息 } }
/// <summary> /// 更新一条申请人信息 /// </summary> /// <param name="AppUser">申请人信息实体</param> /// <returns>成功返回true 否则返回false</returns> public static bool UpdateUser(Approve_User AppUser) { bool iExecute = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append(" update Approve_User set "); strSql.Append(" Name=@Name, "); strSql.Append(" IdCard=@IdCard, "); strSql.Append(" Tel=@Tel, "); strSql.Append(" StreetId=@StreetId, "); strSql.Append(" CommunityId=@CommunityId "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 30), new SqlParameter("@IdCard", SqlDbType.NVarChar, 100), new SqlParameter("@Tel", SqlDbType.NVarChar, 30), new SqlParameter("@StreetId", SqlDbType.Int), new SqlParameter("@CommunityId", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.Int) }; parameters[0].Value = AppUser.Name; parameters[1].Value = AppUser.IdCard; parameters[2].Value = AppUser.Tel; parameters[3].Value = AppUser.StreetId; parameters[4].Value = AppUser.CommunityId; parameters[5].Value = AppUser.Id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { iExecute = true; } } catch (Exception e) { Log4Net.LogWrite("err", "SysAccessData.SysManage.SysMenuManage\\DacMenuInfo\\Update" + e.Message); } return iExecute; }
/// <summary> /// 添加一行审批基本表数据 /// </summary> /// <param name="model">审批用户基本信息实体</param> /// <returns>成功添加返回非0值</returns> public static int AddUser(Approve_User AppUser) { int iExecute = 0; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Approve_User("); strSql.Append("Name,IdCard,Tel,StreetId,CommunityId,AppTime)"); strSql.Append(" values ("); strSql.Append("@Name,@IdCard,@Tel,@StreetId,@CommunityId,@AppTime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@IdCard", SqlDbType.NVarChar, 50), new SqlParameter("@Tel", SqlDbType.NVarChar, 50), new SqlParameter("@StreetId", SqlDbType.Int), new SqlParameter("@CommunityId", SqlDbType.Int), new SqlParameter("@AppTime", SqlDbType.NVarChar, 50) }; parameters[0].Value = AppUser.Name; parameters[1].Value = AppUser.IdCard; parameters[2].Value = AppUser.Tel; parameters[3].Value = AppUser.StreetId; parameters[4].Value = AppUser.CommunityId; parameters[5].Value = AppUser.AppTime; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj != null) { iExecute = Convert.ToInt32(obj); } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Ctrl_Approve.AddUser:" + e.Message); } return iExecute; }
/// <summary> /// 根据Id返回申请人信息 /// </summary> /// <param name="Id">基本申请信息表Id</param> /// <returns>用户基本申请信息实体</returns> public static Approve_User GetUserById(string Id) { Approve_User AppUser = new Approve_User(); DataSet ds = new DataSet(); StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Approve_User "); strSql.Append(" where Id=" + Id); ds = DbHelperSQL.Query(strSql.ToString()); AppUser.Id = int.Parse(Id); AppUser.IdCard = ds.Tables[0].Rows[0]["IdCard"].ToString(); AppUser.Name = ds.Tables[0].Rows[0]["Name"].ToString(); AppUser.Tel = ds.Tables[0].Rows[0]["Tel"].ToString(); AppUser.StreetId = int.Parse(ds.Tables[0].Rows[0]["StreetId"].ToString()); AppUser.CommunityId = int.Parse(ds.Tables[0].Rows[0]["CommunityId"].ToString()); return AppUser; }