Skip to content

Commit

Permalink
GetReaderInfo() API 返回的读者记录中自动增加 libraryCode 元素
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalPlatform committed Apr 17, 2016
1 parent 21cde56 commit 3cb2dc9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion DigitalPlatform.LibraryServer/AppCirculation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5897,7 +5897,8 @@ public LibraryServerResult Return(
}

// 从读者记录中删除 password 元素
static int RemovePassword(ref string strReaderXml, out string strError)
static int RemovePassword(ref string strReaderXml,
out string strError)
{
strError = "";
XmlDocument readerdom = new XmlDocument();
Expand All @@ -5912,6 +5913,7 @@ static int RemovePassword(ref string strReaderXml, out string strError)
}

DomUtil.DeleteElement(readerdom.DocumentElement, "password");
strReaderXml = readerdom.DocumentElement.OuterXml;
return 0;
}

Expand Down
17 changes: 14 additions & 3 deletions DigitalPlatform.LibraryServer/AppReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3810,15 +3810,26 @@ public LibraryServerResult GetReaderInfo(

{
if (readerdom != null)
{
DomUtil.DeleteElement(readerdom.DocumentElement, "password");
DomUtil.SetElementText(readerdom.DocumentElement, "libraryCode", strLibraryCode);
}
if (string.IsNullOrEmpty(strXml) == false)
{
nRet = RemovePassword(ref strXml, out strError);
if (nRet == -1)
XmlDocument temp = new XmlDocument();
try
{
strError = "从读者记录中去除 password 阶段出错: " + strError;
temp.LoadXml(strXml);
}
catch (Exception ex)
{
strError = "读者记录 XML 装入 DOM 时出错:" + ex.Message;
goto ERROR1;
}

DomUtil.DeleteElement(temp.DocumentElement, "password");
DomUtil.SetElementText(temp.DocumentElement, "libraryCode", strLibraryCode);
strXml = temp.DocumentElement.OuterXml;
}
}

Expand Down

0 comments on commit 3cb2dc9

Please sign in to comment.