public GenerateData(MyForm myform, IBiblioItemsWindow detailWindow) { this._myForm = myform; this.MainForm = myform.MainForm; this.DetailWindow = detailWindow; }
static void Main() { if (IsDevelopMode() == false) PrepareCatchException(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); _mainForm = new MainForm(); Application.Run(_mainForm); }
public void Initial( MainForm mainform, string strRecPath, string strExistingXml, byte [] baExistingTimestamp, string strUnsavedXml, byte [] baUnsaveTimestamp, string strMessage) { this.MainForm = mainform; this.RecPath = strRecPath; this.ExistingXml = strExistingXml; this.ExistingTimestamp = baExistingTimestamp; this.UnsavedXml = strUnsavedXml; this.UnsavedTimestamp = baUnsaveTimestamp; this.textBox_message.Text = strMessage; }
// 初始化数据成员 public int Initial( MainForm mainform, string[] aPaths, string strMessage, LibraryChannel channel, Stop stop, out string strError) { strError = ""; this.MainForm = mainform; this.Channel = channel; this.stop = stop; this.aPaths = aPaths; this.textBox_message.Text = strMessage; this.InfoColor = InfoColor.LightRed; // 红色表示警告 return 0; }
public void Initial(MainForm main_form, bool bDoEvents = false) { this._doEvents = bDoEvents; this.MainForm = main_form; this.Channel.Url = this.MainForm.LibraryServerUrl; this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin); this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin); this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin); this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin); this.Channel.Idle -= new IdleEventHandler(Channel_Idle); this.Channel.Idle += new IdleEventHandler(Channel_Idle); stop = new DigitalPlatform.Stop(); stop.Register(MainForm.stopManager, true); // 和容器关联 return; }
public void Initial(MainForm main_form, WebBrowser webBrowser) { this.MainForm = main_form; this.webBrowser1 = webBrowser; ClearHtml(); this._channelPool.BeforeLogin += new BeforeLoginEventHandle(_channelPool_BeforeLogin); #if NO if (string.IsNullOrEmpty(this.dp2MServerUrl) == false) { this.MainForm.BeginInvoke(new Action<string>(ConnectAsync), this.dp2MServerUrl); } _timer.Interval = 1000 * 30; _timer.Elapsed += _timer_Elapsed; #endif this.RefreshUserName(); base.Initial(); }
internal void Borrow( IChargingForm charging_form, bool bRenew, string strReaderBarcode, string strItemBarcode, string strConfirmItemRecPath, string strReaderSummary, string strItemXml, // 2008/5/9 BorrowInfo borrow_info, DateTime start_time, DateTime end_time) { TimeSpan delta = end_time - start_time; // 未包括GetSummary()的时间 string strText = ""; int nRet = 0; string strOperName = "借"; if (bRenew == true) strOperName = "续借"; string strError = ""; string strSummary = ""; nRet = this.GetBiblioSummary(strItemBarcode, strConfirmItemRecPath, out strSummary, out strError); if (nRet == -1) strSummary = "获取书目摘要时出错: " + strError; string strOperClass = "even"; if ((this.m_nCount % 2) == 1) strOperClass = "odd"; string strItemLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strItemBarcode) + "</a>"; string strReaderLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strReaderBarcode) + "</a>"; strText = "<div class='item " + strOperClass + " borrow'>" + "<div class='time_line'>" + " <div class='time'>" + DateTime.Now.ToLongTimeString() + "</div>" + " <div class='time_span'>耗时 " + DoubleToString(delta.TotalSeconds) + "秒</div>" + " <div class='clear'></div>" + "</div>" + "<div class='reader_line'>" + " <div class='reader_prefix_text'>读者</div>" + " <div class='reader_barcode'>" + strReaderLink + "</div>" + " <div class='reader_summary'>" + HttpUtility.HtmlEncode(strReaderSummary) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='opername_line'>" + " <div class='opername'>" + HttpUtility.HtmlEncode(strOperName) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='item_line'>" + " <div class='item_prefix_text'>册</div>" + " <div class='item_barcode'>" + strItemLink + "</div> " + " <div class='item_summary'>" + HttpUtility.HtmlEncode(strSummary) + "</div>" + " <div class='clear'></div>" + "</div>" + " <div class='clear'></div>" + "</div>"; /* strText = "<div class='" + strOperClass + "'>" + "<div class='time_line'><span class='time'>" + DateTime.Now.ToLongTimeString() + "</span> <span class='time_span'>耗时 " + delta.TotalSeconds.ToString() + "秒</span></div>" + "<div class='reader_line'><span class='reader_prefix_text'>读者</span> <span class='reader_barcode'>[" + strReaderBarcode + "]</span>" + " <span class='reader_summary'>" + strReaderSummary + "<span></div>" + "<div class='opername_line'><span class='opername'>" + strOperName + "<span></div>" + "<div class='item_line'><span class='item_prefix_text'>册</span> <span class='item_barcode'>[" + strItemBarcode + "]</span> " + "<span class='item_summary' id='" + m_nCount.ToString() + "' onreadystatechange='GetOneSummary(\"" + m_nCount.ToString() + "\");'>" + strItemBarcode + "</span></div>" + "</div>"; * */ AppendHtml(strText); m_nCount++; // 运行Script代码 if (this.PrintAssembly != null) { BorrowedEventArgs e = new BorrowedEventArgs(); e.OperName = strOperName; e.BiblioSummary = strSummary; e.ItemBarcode = strItemBarcode; e.ReaderBarcode = strReaderBarcode; e.TimeSpan = delta; e.ReaderSummary = strReaderSummary; e.ItemXml = strItemXml; e.ChargingForm = charging_form; if (borrow_info != null) { if (String.IsNullOrEmpty(borrow_info.LatestReturnTime) == true) e.LatestReturnDate = new DateTime(0); else e.LatestReturnDate = DateTimeUtil.FromRfc1123DateTimeString(borrow_info.LatestReturnTime).ToLocalTime(); e.Period = borrow_info.Period; e.BorrowCount = borrow_info.BorrowCount; e.BorrowOperator = borrow_info.BorrowOperator; } this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnBorrowed(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } /* if (nRet == -1) { strText = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(strError); AppendHtml(strText); }*/ } // 用tips飞出显示读者和册的摘要信息?或者明确显示在条码后面? // 读者证和册条码号本身就是锚点? // 读者摘要要么做在前端,通过XML发生,要么做在服务器,用固定规则发生。 }
/// <summary> /// 要测试打印的时候被触发 /// </summary> public void TestPrint() { // 运行Script代码 if (this.PrintAssembly != null) { PrintEventArgs e = new PrintEventArgs(); e.PrintInfo = this.PrintHostObj.PrintInfo; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnTestPrint(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } } }
// 创建打印内容 /// <summary> /// 要创建打印内容时被触发 /// </summary> /// <param name="info">打印信息</param> /// <param name="strResultString">结果字符串</param> /// <param name="strResultFormat">结果字符串的格式</param> public void GetPrintContent(PrintInfo info, out string strResultString, out string strResultFormat) { strResultString = ""; strResultFormat = ""; // 运行Script代码 if (this.PrintAssembly != null) { PrintEventArgs e = new PrintEventArgs(); e.PrintInfo = info; e.Action = "create"; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnPrint(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } strResultString = e.ResultString; strResultFormat = e.ResultFormat; } }
/// <summary> /// 当读者证条码号扫入时被触发 /// </summary> /// <param name="strReaderBarcode">读者证条码号</param> public void ReaderBarcodeScaned(string strReaderBarcode) { // 运行Script代码 if (this.PrintAssembly != null) { ReaderBarcodeScanedEventArgs e = new ReaderBarcodeScanedEventArgs(); e.ReaderBarcode = strReaderBarcode; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnReaderBarcodeScaned(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } } }
/// <summary> /// 调用出纳打印脚本中的 OnInitial() 函数,初始化对象状态 /// </summary> public void Initial() { // 运行Script代码 if (this.PrintAssembly != null) { EventArgs e = new EventArgs(); this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnInitial(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>OnInitial()时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } } }
/// <summary> /// 初始化 OperHistory 对象 /// 初始化过程中,要编译出纳打印方案脚本代码,使它处于就绪状态 /// </summary> /// <param name="main_form">框架窗口</param> /// <param name="webbrowser">用于显示操作历史信息的 IE 浏览器控件</param> /// <param name="strError">出错信息</param> /// <returns>-1: 出错,错误信息在 strError中;0: 成功</returns> public int Initial(MainForm main_form, WebBrowser webbrowser, out string strError) { int nRet = 0; strError = ""; this.MainForm = main_form; #if USE_LOCAL_CHANNEL this.Channel.Url = this.MainForm.LibraryServerUrl; this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin); this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin); #endif /* string strLibraryServerUrl = this.MainForm.AppInfo.GetString( "config", "circulation_server_url", ""); int pos = strLibraryServerUrl.LastIndexOf("/"); if (pos != -1) strLibraryServerUrl = strLibraryServerUrl.Substring(0, pos); * */ this.WebBrowser = webbrowser; // webbrowser this.m_webExternalHost.Initial(this.MainForm, this.WebBrowser); this.WebBrowser.ObjectForScripting = this.m_webExternalHost; this.ClearHtml(); #if USE_THREAD this.BeginThread(); #endif /* Global.WriteHtml(this.WebBrowser, "<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>"); * */ /* // 准备script代码 string strCsFileName = this.MainForm.DataDir + "\\charging_print.cs"; string strRefFileName = this.MainForm.DataDir + "\\charging_print.cs.ref"; if (File.Exists(strCsFileName) == true) { Encoding encoding = FileUtil.DetectTextFileEncoding(strCsFileName); StreamReader sr = null; try { // TODO: 这里的自动探索文件编码方式功能不正确, // 需要专门编写一个函数来探测文本文件的编码方式 // 目前只能用UTF-8编码方式 sr = new StreamReader(strCsFileName, encoding); } catch (Exception ex) { strError = ex.Message; return -1; } string strCode = sr.ReadToEnd(); sr.Close(); sr = null; // .ref文件可以缺省 string strRef = ""; if (File.Exists(strRefFileName) == true) { try { sr = new StreamReader(strRefFileName, true); } catch (Exception ex) { strError = ex.Message; return -1; } strRef = sr.ReadToEnd(); sr.Close(); sr = null; // 提前检查 string[] saRef = null; nRet = ScriptManager.GetRefsFromXml(strRef, out saRef, out strError); if (nRet == -1) { strError = strRefFileName + " 文件内容(应为XML格式)格式错误: " + strError; return -1; } } nRet = PrepareScript(strCode, strRef, out strError); if (nRet == -1) { strError = "C#脚本文件 " + strCsFileName + " 准备过程发生错误(出纳单据打印功能因此暂时失效):\r\n\r\n" + strError; return -1; } } * */ ScriptManager.applicationInfo = this.MainForm.AppInfo; #if NO ScriptManager.CfgFilePath = Path.Combine(this.MainForm.DataDir, "charging_print_projects.xml"); ScriptManager.DataDir = this.MainForm.DataDir; #endif ScriptManager.CfgFilePath = Path.Combine(Program.MainForm.UserDir, "charging_print_projects.xml"); ScriptManager.DataDir = Program.MainForm.UserDir; ScriptManager.CreateDefaultContent -= new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent); ScriptManager.CreateDefaultContent += new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent); try { ScriptManager.Load(); } catch (FileNotFoundException ex) { strError = "file not found : " + ex.Message; return 0; // 当作正常处理 } catch (Exception ex) { strError = "ScriptManager.Load() 出现异常: " + ExceptionUtil.GetDebugText(ex); return -1; } // 获得方案名 string strProjectName = CurrentProjectName; if (String.IsNullOrEmpty(strProjectName) == false) { string strProjectLocate = ""; // 获得方案参数 // strProjectNamePath 方案名,或者路径 // return: // -1 error // 0 not found project // 1 found nRet = this.ScriptManager.GetProjectData( strProjectName, out strProjectLocate); if (nRet == 0) { strError = "凭条打印方案 " + strProjectName + " 没有找到..."; return -1; } if (nRet == -1) { strError = "scriptManager.GetProjectData() error ..."; return -1; } // nRet = PrepareScript(strProjectName, strProjectLocate, out strError); if (nRet == -1) return -1; // 2008/5/9 this.Initial(); } return 0; }
internal void Amerce( string strReaderBarcode, string strReaderSummary, List<OverdueItemInfo> overdue_infos, string strAmerceOperator, DateTime start_time, DateTime end_time) { string strOperName = "交费"; TimeSpan delta = end_time - start_time; string strText = ""; int nRet = 0; foreach (OverdueItemInfo info in overdue_infos) { string strOperClass = "even"; if ((this.m_nCount % 2) == 1) strOperClass = "odd"; string strSummary = ""; string strItemLink = ""; if (string.IsNullOrEmpty(info.ItemBarcode) == false) { strItemLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(info.ItemBarcode) + "</a>"; string strError = ""; nRet = this.GetBiblioSummary(info.ItemBarcode, info.RecPath, out strSummary, out strError); if (nRet == -1) strSummary = "获取书目摘要时出错: " + strError; strItemLink += " <div class='item_summary'>" + HttpUtility.HtmlEncode(strSummary) + "</div>"; } string strReaderLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strReaderBarcode) + "</a>"; string strTimePrefix = ""; if (overdue_infos.Count > 1) strTimePrefix = overdue_infos.Count.ToString() + "笔交费共"; strText = "<div class='item " + strOperClass + " amerce'>" + "<div class='time_line'>" + " <div class='time'>" + DateTime.Now.ToLongTimeString() + "</div>" + " <div class='time_span'>" + strTimePrefix + "耗时 " + DoubleToString(delta.TotalSeconds) + "秒</div>" + " <div class='clear'></div>" + "</div>" + "<div class='reader_line'>" + " <div class='reader_prefix_text'>读者</div>" + " <div class='reader_barcode'>" + strReaderLink + "</div>" + " <div class='reader_summary'>" + HttpUtility.HtmlEncode(strReaderSummary) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='opername_line'>" + " <div class='opername'>" + HttpUtility.HtmlEncode(strOperName) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='item_line'>" + info.ToHtmlString(strItemLink) + "</div>" + " <div class='clear'></div>" + "</div>"; AppendHtml(strText); m_nCount++; } // 运行Script代码 if (this.PrintAssembly != null) { AmercedEventArgs e = new AmercedEventArgs(); e.OperName = strOperName; e.ReaderBarcode = strReaderBarcode; e.ReaderSummary = strReaderSummary; e.TimeSpan = delta; e.OverdueInfos = overdue_infos; e.AmerceOperator = strAmerceOperator; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnAmerced(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } /* if (nRet == -1) { strText = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(strError); AppendHtml(strText); }*/ } }
// 初始化数据成员 public int Initial( MainForm mainform, //LibraryChannel channel, //Stop stop, List<string> paths, string strMessage, out string strError) { strError = ""; this.MainForm = mainform; //this.Channel = channel; //this._stop = stop; this.RecPaths = paths; this.textBox_message.Text = strMessage; return 0; }
// AppDomain m_scriptDomain = null; private void EntityForm_Load(object sender, EventArgs e) { if (this.MainForm != null) { MainForm.SetControlFont(this, this.MainForm.DefaultFont); } // 2015/5/27 this._genData = new GenerateData(this, null); this._genData.SynchronizeMarcEvent += _genData_SynchronizeMarcEvent; // m_scriptDomain = AppDomain.CreateDomain("script"); this.m_webExternalHost_biblio.Initial(this.MainForm, this.webBrowser_biblioRecord); this.webBrowser_biblioRecord.ObjectForScripting = this.m_webExternalHost_biblio; // this.m_webExternalHost_comment.Initial(this.MainForm); this.MainForm.AppInfo.LoadMdiSize += new EventHandler(AppInfo_LoadMdiSize); this.MainForm.AppInfo.SaveMdiSize += new EventHandler(AppInfo_SaveMdiSize); // LoadLayout0(); if (this.AcceptMode == false) { #if NO // 设置窗口尺寸状态 MainForm.AppInfo.LoadMdiChildFormStates(this, "mdi_form_state"); #endif } else { Form form = this; FormWindowState savestate = form.WindowState; bool bStateChanged = false; if (form.WindowState != FormWindowState.Normal) { form.WindowState = FormWindowState.Normal; bStateChanged = true; } AppInfo_LoadMdiSize(this, null); if (bStateChanged == true) form.WindowState = savestate; } if (this.AcceptMode == true) { #if ACCEPT_MODE if (this.WindowState == FormWindowState.Maximized) { this.WindowState = FormWindowState.Normal; } #endif } // 如果为禁止编目功能 if (this.Cataloging == false) { this.tabControl_biblioInfo.TabPages.Remove(this.tabPage_marc); this.AddFreeControl(this.tabPage_marc); // 2015/11/7 this.toolStrip_marcEditor.Enabled = false; // 对象管理功能也被禁止 this.tabControl_itemAndIssue.TabPages.Remove(this.tabPage_object); this.AddFreeControl(this.tabPage_object); // 2015/11/7 this.binaryResControl1.Enabled = false; } this.MainForm.FillBiblioFromList(this.comboBox_from); // 恢复上次退出时保留的检索途径 string strFrom = this.MainForm.AppInfo.GetString( "entityform", "search_from", ""); if (String.IsNullOrEmpty(strFrom) == false) this.comboBox_from.Text = strFrom; this.checkedComboBox_biblioDbNames.Text = this.MainForm.AppInfo.GetString( "entityform", "search_dbnames", "<全部>"); this.comboBox_matchStyle.Text = this.MainForm.AppInfo.GetString( "entityform", "search_matchstyle", "前方一致"); /* // 2008/6/25 this.checkBox_autoDetectQueryBarcode.Checked = this.MainForm.AppInfo.GetBoolean( "entityform", "auto_detect_query_barcode", true); * */ this.checkBox_autoSavePrev.Checked = this.MainForm.AppInfo.GetBoolean( "entityform", "auto_save_prev", true); this.BiblioChanged = false; // 保存当前活动的属性页名字,因为后面可能要清除有关page this.m_strUsedActiveItemPage = GetActiveItemPageName(); // 初始化册控件 this.entityControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue); this.entityControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue); this.entityControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged); this.entityControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged); this.entityControl1.GetParameterValue -= new GetParameterValueHandler(entityControl1_GetParameterValue); this.entityControl1.GetParameterValue += new GetParameterValueHandler(entityControl1_GetParameterValue); this.entityControl1.VerifyBarcode -= new VerifyBarcodeHandler(entityControl1_VerifyBarcode); this.entityControl1.VerifyBarcode += new VerifyBarcodeHandler(entityControl1_VerifyBarcode); this.entityControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls); this.entityControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls); this.entityControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111); this.entityControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111); // 2009/2/24 this.entityControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData); this.entityControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData); /* // 2009/2/24 this.entityControl1.GenerateAccessNo -= new GenerateDataEventHandler(entityControl1_GenerateAccessNo); this.entityControl1.GenerateAccessNo += new GenerateDataEventHandler(entityControl1_GenerateAccessNo); * */ this.entityControl1.ShowMessage -= entityControl1_ShowMessage; this.entityControl1.ShowMessage += entityControl1_ShowMessage; ////this.entityControl1.Channel = this.Channel; this.entityControl1.Stop = this.Progress; this.entityControl1.MainForm = this.MainForm; this.EnableItemsPage(false); // 初始化期控件 // 2008/12/27 this.issueControl1.GenerateEntity -= new GenerateEntityEventHandler(issueControl1_GenerateEntity); this.issueControl1.GenerateEntity += new GenerateEntityEventHandler(issueControl1_GenerateEntity); // 2008/12/24 this.issueControl1.GetOrderInfo -= new GetOrderInfoEventHandler(issueControl1_GetOrderInfo); this.issueControl1.GetOrderInfo += new GetOrderInfoEventHandler(issueControl1_GetOrderInfo); this.issueControl1.GetItemInfo -= new GetItemInfoEventHandler(issueControl1_GetItemInfo); this.issueControl1.GetItemInfo += new GetItemInfoEventHandler(issueControl1_GetItemInfo); this.issueControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue); this.issueControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue); this.issueControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged); this.issueControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged); this.issueControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls); this.issueControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls); this.issueControl1.ChangeItem -= new ChangeItemEventHandler(issueControl1_ChangeItem); this.issueControl1.ChangeItem += new ChangeItemEventHandler(issueControl1_ChangeItem); // 2010/4/27 this.issueControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111); this.issueControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111); // 2012/9/22 this.issueControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData); this.issueControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData); this.issueControl1.GetBiblio -= issueControl1_GetBiblio; this.issueControl1.GetBiblio += issueControl1_GetBiblio; ////this.issueControl1.Channel = this.Channel; this.issueControl1.Stop = this.Progress; this.issueControl1.MainForm = this.MainForm; this.EnableIssuesPage(false); // 2010/4/27 this.issueControl1.InputItemsBarcode = this.MainForm.AppInfo.GetBoolean( "entity_form", "issueControl_input_item_barcode", true); // 2011/9/8 this.issueControl1.SetProcessingState = this.MainForm.AppInfo.GetBoolean( "entity_form", "issueControl_set_processing_state", true); // 2012/5/7 this.issueControl1.CreateCallNumber = this.MainForm.AppInfo.GetBoolean( "entity_form", "create_callnumber", false); // 初始化采购控件 this.orderControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue); this.orderControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue); this.orderControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged); this.orderControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged); this.orderControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls); this.orderControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls); this.orderControl1.GenerateEntity -= new GenerateEntityEventHandler(orderControl1_GenerateEntity); this.orderControl1.GenerateEntity += new GenerateEntityEventHandler(orderControl1_GenerateEntity); // 2008/11/4 this.orderControl1.OpenTargetRecord -= new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord); this.orderControl1.OpenTargetRecord += new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord); this.orderControl1.HilightTargetItem -= new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem); this.orderControl1.HilightTargetItem += new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem); // 2009/11/8 this.orderControl1.SetTargetRecPath -= new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath); this.orderControl1.SetTargetRecPath += new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath); // 2009/11/23 this.orderControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111); this.orderControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111); this.orderControl1.VerifyLibraryCode -= new VerifyLibraryCodeEventHandler(orderControl1_VerifyLibraryCode); this.orderControl1.VerifyLibraryCode += new VerifyLibraryCodeEventHandler(orderControl1_VerifyLibraryCode); ////this.orderControl1.Channel = this.Channel; this.orderControl1.Stop = this.Progress; this.orderControl1.MainForm = this.MainForm; this.EnableOrdersPage(false); // 初始化评注控件 this.commentControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue); this.commentControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue); this.commentControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged); this.commentControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged); this.commentControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls); this.commentControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls); /* this.commentControl1.GenerateEntity -= new GenerateEntityEventHandler(orderControl1_GenerateEntity); this.commentControl1.GenerateEntity += new GenerateEntityEventHandler(orderControl1_GenerateEntity); this.commentControl1.OpenTargetRecord -= new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord); this.commentControl1.OpenTargetRecord += new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord); this.commentControl1.HilightTargetItem -= new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem); this.commentControl1.HilightTargetItem += new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem); this.commentControl1.SetTargetRecPath -= new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath); this.commentControl1.SetTargetRecPath += new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath); */ this.commentControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111); this.commentControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111); this.CommentControl.AddSubject -= new AddSubjectEventHandler(CommentControl_AddSubject); this.CommentControl.AddSubject += new AddSubjectEventHandler(CommentControl_AddSubject); ////this.commentControl1.Channel = this.Channel; this.commentControl1.Stop = this.Progress; this.commentControl1.MainForm = this.MainForm; // this.commentControl1.WebExternalHost = this.m_webExternalHost_comment; this.EnableCommentsPage(false); // 初始化对象控件 if (this.Cataloging == true) { Program.MainForm.StreamProgressChanged += MainForm_StreamProgressChanged; this.binaryResControl1.ContentChanged -= new ContentChangedEventHandler(binaryResControl1_ContentChanged); this.binaryResControl1.ContentChanged += new ContentChangedEventHandler(binaryResControl1_ContentChanged); this.binaryResControl1.GetChannel -= binaryResControl1_GetChannel; this.binaryResControl1.GetChannel += binaryResControl1_GetChannel; this.binaryResControl1.ReturnChannel -= binaryResControl1_ReturnChannel; this.binaryResControl1.ReturnChannel += binaryResControl1_ReturnChannel; //this.binaryResControl1.Channel = this.Channel; this.binaryResControl1.Stop = this.Progress; this.binaryResControl1.RightsCfgFileName = Path.Combine(this.MainForm.UserDir, "objectrights.xml"); this.m_macroutil.ParseOneMacro -= new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro); this.m_macroutil.ParseOneMacro += new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro); // 2009/2/24 this.binaryResControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData); this.binaryResControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData); this.binaryResControl1.TempDir = this.MainForm.UserTempDir; LoadFontToMarcEditor(); this.m_marcEditor.AppInfo = this.MainForm.AppInfo; // 2009/9/18 } if (this.AcceptMode == true) { this.flowLayoutPanel_query.Visible = false; } else { this.flowLayoutPanel_query.Visible = this.MainForm.AppInfo.GetBoolean( "entityform", "queryPanel_visibie", true); } this.panel_itemQuickInput.Visible = this.MainForm.AppInfo.GetBoolean( "entityform", "itemQuickInputPanel_visibie", true); // this.EnableControls(true); // 促使“保存”按钮状态被设置 // API.PostMessage(this.Handle, WM_LOADLAYOUT, 0, 0); // 2008/11/2 // RegisterType { string strRegisterType = this.MainForm.AppInfo.GetString("entity_form", "register_type", ""); if (String.IsNullOrEmpty(strRegisterType) == false) { try { this.RegisterType = (RegisterType)Enum.Parse(typeof(RegisterType), strRegisterType, true); } catch { } } } string strSelectedTemplates = this.MainForm.AppInfo.GetString( "entity_form", "selected_templates", ""); if (String.IsNullOrEmpty(strSelectedTemplates) == false) { selected_templates.Build(strSelectedTemplates); } }
private void checkBox_topmost_CheckedChanged(object sender, EventArgs e) { if (this.checkBox_topmost.Checked == true) { Debug.Assert(this.MainForm != null || this.MdiParent != null, ""); if (this.MdiParent != null) this.MainForm = (MainForm)this.MdiParent; this.MdiParent = null; Debug.Assert(this.MainForm != null, ""); this.Owner = this.MainForm; // this.TopMost = true; } else { Debug.Assert(this.MainForm != null, ""); this.MdiParent = this.MainForm; // this.TopMost = false; } }
// 2015/9/15 public static void EnvironmentReport(MainForm mainForm) { #if NO MessageBar _messageBar = null; _messageBar = new MessageBar(); _messageBar.TopMost = false; //_messageBar.BackColor = SystemColors.Info; //_messageBar.ForeColor = SystemColors.InfoText; _messageBar.Text = "dp2Circulation 出现异常"; _messageBar.MessageText = "正在向 dp2003.com 发送异常报告 ..."; _messageBar.StartPosition = FormStartPosition.CenterScreen; _messageBar.Show(_mainForm); _messageBar.Update(); #endif int nRet = 0; string strError = ""; try { string strSender = ""; if (mainForm != null) strSender = mainForm.GetCurrentUserName() + "@" + mainForm.ServerUID; // 崩溃报告 nRet = LibraryChannel.CrashReport( strSender, "dp2circulation 环境报告", GetEnvironmentDescription().Replace("\t", " "), out strError); } catch (Exception ex) { strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex); nRet = -1; } finally { #if NO _messageBar.Close(); _messageBar = null; #endif } #if NO if (nRet == -1) { strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError; MessageBox.Show(_mainForm, strError); // 写入错误日志 if (_mainForm != null) _mainForm.WriteErrorLog(strError); else WriteWindowsLog(strError, EventLogEntryType.Error); } #endif }
public static int SearchOneLocationItems( MainForm main_form, LibraryChannel channel, Stop stop, string strLocation, string strOutputStyle, out List<string> results, out string strError) { strError = ""; results = new List<string>(); long lRet = channel.SearchItem(stop, "<all>", strLocation, // -1, "馆藏地点", "left", // this.textBox_queryWord.Text == "" ? "left" : "exact", // 原来为left 2007/10/18 changed "zh", null, // strResultSetName "", // strSearchStyle "", //strOutputStyle, // (bOutputKeyCount == true ? "keycount" : ""), out strError); if (lRet == -1) return -1; long lHitCount = lRet; long lStart = 0; long lCount = lHitCount; DigitalPlatform.LibraryClient.localhost.Record[] searchresults = null; bool bOutputBiblioRecPath = false; bool bOutputItemRecPath = false; string strStyle = ""; if (strOutputStyle == "bibliorecpath") { bOutputBiblioRecPath = true; strStyle = "id,cols,format:@coldef:*/parent"; } else { bOutputItemRecPath = true; strStyle = "id"; } // 实体库名 --> 书目库名 Hashtable dbname_table = new Hashtable(); // 书目库记录路径,用于去重 Hashtable bilio_recpath_table = new Hashtable(); // 装入浏览格式 for (; ; ) { Application.DoEvents(); // 出让界面控制权 if (stop != null && stop.State != 0) { strError = "检索共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条,用户中断..."; return -1; } lRet = channel.GetSearchResult( stop, null, // strResultSetName lStart, lCount, strStyle, // bOutputKeyCount == true ? "keycount" : "id,cols", "zh", out searchresults, out strError); if (lRet == -1) { strError = "检索共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条," + strError; return -1; } if (lRet == 0) { return 0; } // 处理浏览结果 for (int i = 0; i < searchresults.Length; i++) { DigitalPlatform.LibraryClient.localhost.Record searchresult = searchresults[i]; if (bOutputBiblioRecPath == true) { string strItemDbName = Global.GetDbName(searchresult.Path); string strBiblioDbName = (string)dbname_table[strItemDbName]; if (string.IsNullOrEmpty(strBiblioDbName) == true) { strBiblioDbName = main_form.GetBiblioDbNameFromItemDbName(strItemDbName); dbname_table[strItemDbName] = strBiblioDbName; } string strBiblioRecPath = strBiblioDbName + "/" + searchresult.Cols[0]; if (bilio_recpath_table.ContainsKey(strBiblioRecPath) == false) { results.Add(strBiblioRecPath); bilio_recpath_table[strBiblioRecPath] = true; } } else if (bOutputItemRecPath == true) results.Add(searchresult.Path); } lStart += searchresults.Length; lCount -= searchresults.Length; stop.SetMessage("共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条"); if (lStart >= lHitCount || lCount <= 0) break; } return 0; }
void ActivateBrowseWindow(bool bShow) { if (this.browseWindow == null || (this.browseWindow != null && this.browseWindow.IsDisposed == true)) { this.browseWindow = new BrowseSearchResultForm(); MainForm.SetControlFont(this.browseWindow, this.MainForm.DefaultFont); this.browseWindow.MainForm = this.MainForm; // 2009/2/17 this.browseWindow.Text = "命中多条种记录。请从中选择一条"; this.browseWindow.FormClosing -= browseWindow_FormClosing; this.browseWindow.FormClosing += browseWindow_FormClosing; this.browseWindow.FormClosed -= new FormClosedEventHandler(browseWindow_FormClosed); this.browseWindow.FormClosed += new FormClosedEventHandler(browseWindow_FormClosed); // this.browseWindow.MdiParent = this.MainForm; if (bShow == true) { this.MainForm.AppInfo.LinkFormState(this.browseWindow, "browseWindow_state"); this.browseWindow.Show(); } this.browseWindow.OpenDetail -= new OpenDetailEventHandler(browseWindow_OpenDetail); this.browseWindow.OpenDetail += new OpenDetailEventHandler(browseWindow_OpenDetail); } else { if (this.browseWindow.Visible == false && bShow == true) { /* this.MainForm.AppInfo.LinkFormState(this.browseWindow, "browseWindow_state"); this.browseWindow.Visible = true; * */ ShowBrowseWindow(-1); } this.browseWindow.BringToFront(); this.browseWindow.RecordsList.Items.Clear(); } }
internal void Return( IChargingForm charging_form, // bool bLost, string strAction, string strReaderBarcode, string strItemBarcode, string strConfirmItemRecPath, string strReaderSummary, string strItemXml, // 2008/5/9 ReturnInfo return_info, DateTime start_time, DateTime end_time) { TimeSpan delta = end_time - start_time; // 未包括GetSummary()的时间 string strText = ""; int nRet = 0; string strOperName = "还"; #if NO if (bLost == true) strOperName = "丢失"; #endif if (strAction == "lost") strOperName = "丢失"; else if (strAction == "inventory") strOperName = "盘点"; else if (strAction == "read") strOperName = "读过"; string strError = ""; string strSummary = ""; nRet = this.GetBiblioSummary(strItemBarcode, strConfirmItemRecPath, out strSummary, out strError); if (nRet == -1) strSummary = "获取书目摘要时出错: " + strError; string strOperClass = "even"; if ((this.m_nCount % 2) == 1) strOperClass = "odd"; string strLocation = ""; if (return_info != null) strLocation = return_info.Location; string strItemLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strItemBarcode) + "</a>"; string strReaderLink = ""; if (string.IsNullOrEmpty(strReaderBarcode) == false) strReaderLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strReaderBarcode) + "</a>"; strText = "<div class='item " + strOperClass + " return'>" + "<div class='time_line'>" + " <div class='time'>" + DateTime.Now.ToLongTimeString() + "</div>" + " <div class='time_span'>耗时 " + DoubleToString(delta.TotalSeconds) + "秒</div>" + " <div class='clear'></div>" + "</div>" + ( string.IsNullOrEmpty(strReaderLink) == false ? ("<div class='reader_line'>" + " <div class='reader_prefix_text'>读者</div>" + " <div class='reader_barcode'>" + strReaderLink + "</div>" + " <div class='reader_summary'>" + HttpUtility.HtmlEncode(strReaderSummary) + "</div>" + " <div class='clear'></div>") : "" ) + "</div>" + "<div class='opername_line'>" + " <div class='opername'>" + HttpUtility.HtmlEncode(strOperName) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='item_line'>" + " <div class='item_prefix_text'>册</div>" + " <div class='item_barcode'>" + strItemLink + "</div> " + " <div class='item_summary'>" + HttpUtility.HtmlEncode(strSummary) + "</div>" + (string.IsNullOrEmpty(strLocation) == false ? " <div class='item_location'>" + HttpUtility.HtmlEncode(strLocation) + "</div>" : "") + " <div class='clear'></div>" + "</div>" + " <div class='clear'></div>" + "</div>"; /* strText = "<div class='" + strOperClass + "'>" + "<div class='time_line'><span class='time'>" + DateTime.Now.ToLongTimeString() + "</span> <span class='time_span'>耗时 " + delta.TotalSeconds.ToString() + "秒</span></div>" + "<div class='reader_line'><span class='reader_prefix_text'>读者</span> <span class='reader_barcode'>[" + strReaderBarcode + "]</span>" + " <span class='reader_summary'>" + strReaderSummary + "<span></div>" + "<div class='opername_line'><span class='opername'>" + strOperName + "<span></div>" + "<div class='item_line'><span class='item_prefix_text'>册</span> <span class='item_barcode'>[" + strItemBarcode + "]</span> " + "<span class='item_summary' id='" + m_nCount.ToString() + "' onreadystatechange='GetOneSummary(\"" + m_nCount.ToString() + "\");'>" + strItemBarcode + "</span></div>" + "</div>"; * */ AppendHtml(strText); m_nCount++; // 运行Script代码 if (this.PrintAssembly != null) { ReturnedEventArgs e = new ReturnedEventArgs(); e.OperName = strOperName; e.BiblioSummary = strSummary; e.ItemBarcode = strItemBarcode; e.ReaderBarcode = strReaderBarcode; e.TimeSpan = delta; e.ReaderSummary = strReaderSummary; e.ItemXml = strItemXml; e.ChargingForm = charging_form; if (return_info != null) { if (String.IsNullOrEmpty(return_info.BorrowTime) == true) e.BorrowDate = new DateTime(0); else e.BorrowDate = DateTimeUtil.FromRfc1123DateTimeString(return_info.BorrowTime).ToLocalTime(); if (String.IsNullOrEmpty(return_info.LatestReturnTime) == true) e.LatestReturnDate = new DateTime(0); else e.LatestReturnDate = DateTimeUtil.FromRfc1123DateTimeString(return_info.LatestReturnTime).ToLocalTime(); e.Period = return_info.Period; e.BorrowCount = return_info.BorrowCount; e.OverdueString = return_info.OverdueString; e.BorrowOperator = return_info.BorrowOperator; e.ReturnOperator = return_info.ReturnOperator; // 2013/4/2 e.Location = return_info.Location; e.BookType = return_info.BookType; } this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnReturned(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } } }