コード例 #1
0
ファイル: BiblioSearchForm.cs プロジェクト: renyh1013/dp2
        int ExportToItemSearchForm(
    string strDbType,
    out string strError)
        {
            strError = "";
            string strTempFileName = Path.Combine(this.MainForm.DataDir, "~export_to_searchform.txt");
            int nRet = SaveToEntityRecordPathFile(strDbType,
                strTempFileName,
                out strError);
            if (nRet == -1)
                return -1;

#if NO
            // TODO: 最好为具体类型的 SearchForm 类。否则推出时保留的遗留出鞥口类型不对
            ItemSearchForm form = new ItemSearchForm();
            form.DbType = strDbType;
            form.MdiParent = this.MainForm;
            form.Show();
#endif
            ItemSearchForm form = this.MainForm.OpenItemSearchForm(strDbType);

            nRet = form.ImportFromRecPathFile(strTempFileName,
                "clear",
                out strError);
            if (nRet == -1)
                return -1;
            return 0;
        }
コード例 #2
0
ファイル: ReaderSearchForm.cs プロジェクト: renyh1013/dp2
        // 将一个读者的操作历史输出到实体查询窗
        // parameters:
        static int OutputBorrowHistory(
            ItemSearchForm form,
            XmlDocument reader_dom,
            ChargingHistoryLoader history_loader,
            ItemBarcodeLoader barcode_loader,
            out string strError)
        {
            strError = "";

            if (StringUtil.CompareVersion(Program.MainForm.ServerVersion, "2.67") < 0)
            {
                strError = "输出操作历史到实体查询窗要求 dp2library 为 2.67 或以上版本";
                return -1;
            }

            List<string> barcodes = new List<string>();
            foreach (ChargingItemWrapper wrapper in history_loader)
            {
                ChargingItem item = wrapper.Item;

                string strItemBarcode = item.ItemBarcode;
#if NO
                ChargingItem rel = wrapper.RelatedItem;
                string strBorrowDate = rel == null ? "" : rel.OperTime;
                string strBorrowPeriod = GetDisplayTimePeriodString(rel == null ? "" : rel.Period);
                string strReturnDate = item.OperTime;
#endif

                barcodes.Add(strItemBarcode);
            }

            string strTempFileName = Program.MainForm.GetTempFileName("exphis");
            try
            {
                int nCount = 0;
                using (StreamWriter sw = new StreamWriter(strTempFileName, false, Encoding.UTF8))
                {
                    barcode_loader.Barcodes = barcodes;
                    foreach (EntityItem info in barcode_loader)
                    {
                        string strRecPath = info.RecPath;
                        if (string.IsNullOrEmpty(strRecPath) == true)
                            continue;   // TODO: 是否要警告?
                        sw.WriteLine(strRecPath);
                        nCount++;
                    }
                }

                if (nCount > 0)
                {
                    int nRet = form.ImportFromRecPathFile(strTempFileName,
                        "",
                        out strError);
                    if (nRet == -1)
                        return -1;
                }

                return 0;
            }
            finally
            {
                File.Delete(strTempFileName);
            }
        }