// 保存册信息 // (如何删除册信息还是一个棘手的问题) int SaveItems(out string strError) { strError = ""; if (this.Items == null) { strError = "Items尚未初始化"; return(-1); } for (int i = 0; i < this.Items.Count; i++) { BookItem item = this.Items[i]; // 跳过没有修改过的事项 if (item.Changed == false) { continue; } // 新事项 if (item.RecPath == "") { item.RecPath = this.ItemDbName + "/?"; } if (item.Parent == "") { if (String.IsNullOrEmpty(this.BiblioRecPath) == true) { strError = "因BiblioRecPath成员为空,无法构造册信息。"; return(-1); } item.Parent = ResPath.GetRecordId(this.BiblioRecPath); } string strXml = ""; int nRet = item.BuildRecord( out strXml, out strError); if (nRet == -1) { strError = "第 " + Convert.ToString(i + 1) + " 行构造册记录时出错: " + strError; return(-1); } byte[] baOutputTimestamp = null; nRet = this.SearchPanel.SaveRecord( this.ServerUrl, item.RecPath, strXml, item.Timestamp, true, out baOutputTimestamp, out strError); if (nRet == -1) { strError = "第 " + Convert.ToString(i + 1) + " 行保存册记录时出错: " + strError; return(-1); } item.Timestamp = baOutputTimestamp; item.Changed = false; // 事项颜色会发生变化 item.RefreshItemColor(); } return(0); }