/// <summary> /// 查询管理员信息 /// </summary> /// <param name="adminNo">管理员编号</param> /// <returns>管理员信息</returns> public AdminList FindAdminByNo(string adminNo) { AdminList admin = null; string sql = "SELECT adminUserName,adminName FROM usta_AdminList WHERE adminUserName=@adminUserName"; SqlParameter[] parameters ={ new SqlParameter("@adminUserName", SqlDbType.NChar,10) }; parameters[0].Value = adminNo; SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql, parameters); while (dr.Read()) { admin = new AdminList(); admin.adminUserName = dr[0].ToString(); admin.adminName = dr[1].ToString(); } dr.Close(); conn.Close(); return admin; }
/// <summary> /// 更新管理员信息 /// </summary> /// <param name="admin">管理员信息</param> public void UpdateAdminByAdminList(AdminList admin) { try { string sql = "UPDATE usta_AdminList SET adminUserPwd=@adminUserPwd,adminName=@adminName WHERE adminUserName=@adminUserName"; SqlParameter[] parameters = { new SqlParameter("@adminUserName", SqlDbType.NChar,10), new SqlParameter("@adminUserPwd", SqlDbType.NChar,32), new SqlParameter("@adminName", SqlDbType.NChar,10)}; parameters[0].Value = admin.adminUserName; parameters[1].Value = admin.adminUserPwd; parameters[2].Value = admin.adminName; SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, parameters); } catch (Exception ex) { MongoDBLog.LogRecord(ex); CommonUtility.RedirectUrl(); } finally { conn.Close(); } }