/// <summary> /// 新建金生金用户 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static int CreateAdminGssUser(UserBindEntity entity) { SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@UserID", entity.UserId), new SqlParameter("@UserBindId", entity.UserBindId), new SqlParameter("@JUserId", entity.JUserId), new SqlParameter("@Result", SqlDbType.Int) }; paras[3].Direction = ParameterDirection.Output; int result = 0; return DbHelper.RunProcedure("P_CreateAdminGssUser", paras, out result); }
/// <summary> /// 修改金生金用户 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static int UpdateGssUser(UserBindEntity entity) { Dictionary<string, object> parms = new Dictionary<string, object>(); parms.Add("@UserBindId", entity.UserBindId); parms.Add("@UserId", entity.UserId); parms.Add("@JUserId", entity.JUserId); parms.Add("@IsEnable", entity.IsEnable); parms.Add("@CreateDate", entity.CreateDate); StringBuilder strSql = new StringBuilder(); strSql.Append("update UserBind_BZJ set "); strSql.Append("UserId=@UserId,"); strSql.Append("JUserId=@JUserId,"); strSql.Append("IsEnable=@IsEnable,"); strSql.Append("CreateDate=@CreateDate"); strSql.AppendFormat(" where UserBindId=@UserBindId"); return DbHelper.ExecuteNonQuery(strSql.ToString(), parms); }
private static UserBindEntity CreateUserBindEntity(DataTable dt) { UserBindEntity entity = new UserBindEntity(); entity.UserBindId = dt.Rows[0]["UserBindId"].ToString(); entity.UserId = dt.Rows[0]["UserId"].ToString(); entity.JUserId = dt.Rows[0]["JUserId"].ToString(); entity.IsEnable = Convert.ToInt32(dt.Rows[0]["IsEnable"]); entity.CreateDate = dt.Rows[0]["CreateDate"].ToString(); return entity; }
/// <summary> /// 根据用户编号获取绑定信息 /// </summary> /// <param name="userId">用户ID</param> /// <returns></returns> public static UserBindEntity LoadByUserId(string userId) { UserBindEntity userBindEntity = new UserBindEntity(); StringBuilder strSql = new StringBuilder(); strSql.AppendFormat("select top 1 {0} from UserBind_BZJ where UserId='{1}' and IsEnable=1", Fields.UserBind_FIELD_LIST, userId); DataTable dt = DbHelper.ExecQuery(strSql.ToString()); if (dt.Rows.Count > 0) { userBindEntity = CreateUserBindEntity(dt); } return userBindEntity; }