Skip to content

Commit

Permalink
Merge pull request #13 from DigitalPlatform/master
Browse files Browse the repository at this point in the history
同步源
  • Loading branch information
renyh1013 committed Apr 18, 2016
2 parents 079e128 + a8046f3 commit aea4b97
Show file tree
Hide file tree
Showing 18 changed files with 254 additions and 76 deletions.
66 changes: 50 additions & 16 deletions DigitalPlatform.LibraryServer/AppReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4039,6 +4039,20 @@ public LibraryServerResult GetReaderInfo(
return result;
}

// 在字符串数组中指定下标位置设置一个元素值
static void SetResult(List<string> results_list,
int index,
string strValue)
{
while (results_list.Count <= index)
{
results_list.Add("");
}

results_list[index] = strValue;
}


// 创建读者记录返回格式
// 注:出于安全需要,readerdom 和 strXml 在调用前就应该把里面的 barcode 元素删除
// parameters:
Expand All @@ -4056,24 +4070,26 @@ int BuildReaderResults(
OperType operType, // html 时需要
string[] saBorrowedItemBarcode,
string strCurrentItemBarcode,
ref string[] results,
ref string[] results_param,
out string strError)
{
strError = "";
int nRet = 0;

if (string.IsNullOrEmpty(strResultTypeList) == true)
{
results = new string[0];
results_param = new string[0];
return 0;
}

string[] result_types = strResultTypeList.Split(new char[] { ',' });
results = new string[result_types.Length];
//results = new string[result_types.Length];
List<string> results_list = new List<string>();

for (int i = 0; i < result_types.Length; i++)
int i = 0;
foreach (string strResultType in result_types)
{
string strResultType = result_types[i];
// string strResultType = result_types[i];

// 2008/4/3
// if (String.Compare(strResultType, "calendar", true) == 0)
Expand Down Expand Up @@ -4113,7 +4129,8 @@ int BuildReaderResults(
if (calendar != null)
strCalendarName = calendar.Name;

results[i] = strCalendarName;
// results[i] = strCalendarName;
SetResult(results_list, i, strCalendarName);
}
// else if (String.Compare(strResultType, "xml", true) == 0)
else if (IsResultType(strResultType, "xml") == true)
Expand All @@ -4129,20 +4146,28 @@ int BuildReaderResults(
strError = "获取 " + strResultType + " 格式的 XML 字符串时出错: " + strError;
goto ERROR1;
}
results[i] = strResultXml;
// results[i] = strResultXml;
SetResult(results_list, i, strResultXml);
}
else if (String.Compare(strResultType, "timestamp", true) == 0)
{
// 2011/1/27
results[i] = ByteArray.GetHexTimeStampString(baTimestamp);
// results[i] = ByteArray.GetHexTimeStampString(baTimestamp);
SetResult(results_list, i, ByteArray.GetHexTimeStampString(baTimestamp));
}
else if (String.Compare(strResultType, "recpaths", true) == 0)
{
// 2013/5/21
if (recpaths != null)
results[i] = StringUtil.MakePathList(recpaths);
{
// results[i] = StringUtil.MakePathList(recpaths);
SetResult(results_list, i, StringUtil.MakePathList(recpaths));
}
else
results[i] = strOutputPath;
{
// results[i] = strOutputPath;
SetResult(results_list, i, strOutputPath);
}
}
else if (String.Compare(strResultType, "advancexml_borrow_bibliosummary", true) == 0
|| String.Compare(strResultType, "advancexml_overdue_bibliosummary", true) == 0
Expand Down Expand Up @@ -4178,12 +4203,14 @@ int BuildReaderResults(
if (nRet == -1)
{
strSummary = "读者 XML 装入 DOM 出错: " + strError;
results[i] = strSummary;
continue;
// results[i] = strSummary;
SetResult(results_list, i, strSummary);
goto CONTINUE;
}
}
strSummary = DomUtil.GetElementText(readerdom.DocumentElement, "name");
results[i] = strSummary;
// results[i] = strSummary;
SetResult(results_list, i, strSummary);
}
// else if (String.Compare(strResultType, "advancexml", true) == 0)
else if (IsResultType(strResultType, "advancexml") == true)
Expand All @@ -4202,7 +4229,8 @@ int BuildReaderResults(
strError = "GetAdvanceReaderXml()出错: " + strError;
goto ERROR1;
}
results[i] = strOutputXml;
// results[i] = strOutputXml;
SetResult(results_list, i, strOutputXml);
}
// else if (String.Compare(strResultType, "html", true) == 0)
else if (IsResultType(strResultType, "html") == true)
Expand All @@ -4228,7 +4256,8 @@ int BuildReaderResults(
goto ERROR1;
}
// test strReaderRecord = "<html><body><p>test</p></body></html>";
results[i] = strReaderRecord;
// results[i] = strReaderRecord;
SetResult(results_list, i, strReaderRecord);
}
// else if (String.Compare(strResultType, "text", true) == 0)
else if (IsResultType(strResultType, "text") == true)
Expand All @@ -4253,15 +4282,20 @@ int BuildReaderResults(
strError = "ConvertReaderXmlToHtml()出错(脚本程序为" + this.CfgDir + "\\readerxml2html.cs" + "): " + strError;
goto ERROR1;
}
results[i] = strReaderRecord;
// results[i] = strReaderRecord;
SetResult(results_list, i, strReaderRecord);
}
else
{
strError = "未知的结果类型 '" + strResultType + "'";
goto ERROR1;
}

CONTINUE:
i++;
}

results_param = results_list.ToArray();
return 0;
ERROR1:
return -1;
Expand Down
4 changes: 2 additions & 2 deletions dp2Circulation/Charging/ChargingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ public void DoLoadReader()
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = VerifyBarcode(
this.Channel.LibraryCodeList,
this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
this.textBox_readerBarcode.Text,
out strError);
if (nRet == -1)
Expand Down Expand Up @@ -1988,7 +1988,7 @@ public int DoItemAction()
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = VerifyBarcode(
this.Channel.LibraryCodeList,
this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
this.textBox_itemBarcode.Text,
out strError);
if (nRet == -1)
Expand Down
1 change: 1 addition & 0 deletions dp2Circulation/Charging/QuickChargingForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions dp2Circulation/Charging/QuickChargingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ private void QuickChargingForm_Load(object sender, EventArgs e)
SetReaderHtmlString("(空)");
}

this.BeginInvoke(new Action(FillLibraryCodeListMenu));
// this.BeginInvoke(new Action(FillLibraryCodeListMenu));
}

#if NO
string _focusLibraryCode = "";

// 当前操作所针对的分馆 代码
Expand Down Expand Up @@ -225,6 +226,8 @@ void item_Click(object sender, EventArgs e)
FocusLibraryCode = item.Tag as string;
}

#endif

void m_webExternalHost_readerInfo_OutputDebugInfo(object sender, OutputDebugInfoEventArgs e)
{
if (_floatingMessage != null)
Expand Down Expand Up @@ -1555,7 +1558,7 @@ void _doAction(FuncState func,
// 1 是合法的读者证条码号
// 2 是合法的册条码号
int nRet = VerifyBarcode(
this.FocusLibraryCode, // this.Channel.LibraryCodeList,
this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
strText,
out strError);
if (nRet == -2)
Expand Down
6 changes: 3 additions & 3 deletions dp2Circulation/Charging/QuickChargingForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4
CQAAAk1TRnQBSQFMAgEBAgEAAWQBAAFkAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CQAAAk1TRnQBSQFMAgEBAgEAAWwBAAFsAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -189,7 +189,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MT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ykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
10 changes: 9 additions & 1 deletion dp2Circulation/Entity/EntityControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public bool NeedVerifyItemBarcode
/// <summary>
/// 形式校验条码号
/// </summary>
/// <param name="strLibraryCode">册所在的图书馆代码</param>
/// <param name="strBarcode">册条码号</param>
/// <param name="strError">返回出错信息</param>
/// <returns>
Expand All @@ -82,7 +83,9 @@ public bool NeedVerifyItemBarcode
/// <para> 1 是合法的读者证条码号</para>
/// <para> 2 是合法的册条码号</para>
/// </returns>
public int DoVerifyBarcode(string strBarcode,
public int DoVerifyBarcode(
string strLibraryCode,
string strBarcode,
out string strError)
{
if (this.VerifyBarcode == null)
Expand All @@ -93,6 +96,7 @@ public int DoVerifyBarcode(string strBarcode,

VerifyBarcodeEventArgs e = new VerifyBarcodeEventArgs();
e.Barcode = strBarcode;
e.LibraryCode = strLibraryCode;
this.VerifyBarcode(this, e);
strError = e.ErrorInfo;
return e.Result;
Expand Down Expand Up @@ -3618,6 +3622,10 @@ public delegate void VerifyBarcodeHandler(object sender,
/// </summary>
public class VerifyBarcodeEventArgs : EventArgs
{
/// <summary>
/// 馆代码
/// </summary>
public string LibraryCode = "";
/// <summary>
/// 条码号
/// </summary>
Expand Down
8 changes: 6 additions & 2 deletions dp2Circulation/Entity/EntityEditForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ internal override int FinishVerify(out string strError)
strError = "";
int nRet = 0;

// TODO: 将来这里要允许使用整个 location 字符串,而不仅仅是馆代码,来发起条码号校验
string strLocation = this.entityEditControl_editing.LocationString;
string strLibraryCode = Global.GetLibraryCode(StringUtil.GetPureLocation(strLocation));

string strBarcode = this.entityEditControl_editing.Barcode;

// 检查册条码号形式是否合法
Expand All @@ -236,6 +240,7 @@ internal override int FinishVerify(out string strError)
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = this.EntityControl.DoVerifyBarcode(
strLibraryCode,
strBarcode,
out strError);
if (nRet == -1)
Expand All @@ -261,14 +266,13 @@ internal override int FinishVerify(out string strError)
}

// 馆藏地点字符串里面不能有星号
string strLocation = this.entityEditControl_editing.LocationString;
// string strLocation = this.entityEditControl_editing.LocationString;
if (strLocation.IndexOf("*") != -1)
{
strError = "馆藏地点字符串中不允许出现字符 '*'";
goto ERROR1;
}


// 价格字符串中不允许出现 @
string strPrice = this.entityEditControl_editing.Price;
if (strPrice.IndexOf("@") != -1)
Expand Down
6 changes: 3 additions & 3 deletions dp2Circulation/EntityForm/EntityForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@ void item_barcode_dlg_VerifyBarcode(object sender, VerifyBarcodeEventArgs e)
{
string strError = "";
e.Result = this.VerifyBarcode(
this.CurrentLibraryCodeList,
e.LibraryCode, // this.CurrentLibraryCodeList,
e.Barcode,
out strError);
e.ErrorInfo = strError;
Expand Down Expand Up @@ -2202,7 +2202,7 @@ void entityControl1_VerifyBarcode(object sender, VerifyBarcodeEventArgs e)
{
string strError = "";
e.Result = this.VerifyBarcode(
this.CurrentLibraryCodeList,
e.LibraryCode, // this.CurrentLibraryCodeList,
e.Barcode,
out strError);
e.ErrorInfo = strError;
Expand Down Expand Up @@ -9767,7 +9767,7 @@ public void DoRegisterEntity()
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = VerifyBarcode(
this.CurrentLibraryCodeList,
this.MainForm.FocusLibraryCode, // this.CurrentLibraryCodeList,
this.textBox_itemBarcode.Text,
out strError);
if (nRet == -1)
Expand Down
7 changes: 6 additions & 1 deletion dp2Circulation/EntityRegister/BiblioAndEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,7 @@ public int VerifyEntities(
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = this.DoVerifyBarcode(
Global.GetLibraryCode(StringUtil.GetPureLocation(edit.LocationString)),
edit.Barcode,
out strError);
if (nRet == -1)
Expand Down Expand Up @@ -1873,6 +1874,7 @@ public int VerifyEntities(
/// <summary>
/// 形式校验条码号
/// </summary>
/// <param name="strLibraryCode">馆代码</param>
/// <param name="strBarcode">册条码号</param>
/// <param name="strError">返回出错信息</param>
/// <returns>
Expand All @@ -1882,7 +1884,9 @@ public int VerifyEntities(
/// <para> 1 是合法的读者证条码号</para>
/// <para> 2 是合法的册条码号</para>
/// </returns>
public int DoVerifyBarcode(string strBarcode,
public int DoVerifyBarcode(
string strLibraryCode,
string strBarcode,
out string strError)
{
if (this.VerifyBarcode == null)
Expand All @@ -1893,6 +1897,7 @@ public int DoVerifyBarcode(string strBarcode,

VerifyBarcodeEventArgs e = new VerifyBarcodeEventArgs();
e.Barcode = strBarcode;
e.LibraryCode = strLibraryCode;
this.VerifyBarcode(this, e);
strError = e.ErrorInfo;
return e.Result;
Expand Down
2 changes: 1 addition & 1 deletion dp2Circulation/EntityRegister/EntityRegisterWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void _biblio_VerifyBarcode(object sender, VerifyBarcodeEventArgs e)
{
string strError = "";
e.Result = this.VerifyBarcode(
this.Channel.LibraryCodeList,
e.LibraryCode, //this.Channel.LibraryCodeList,
e.Barcode,
out strError);
e.ErrorInfo = strError;
Expand Down
Loading

0 comments on commit aea4b97

Please sign in to comment.