Ejemplo n.º 1
0
        DpRow AddNewRow(string name, string new_message_count)
        {
            DpRow row = new DpRow();

            row.Add(new DpCell());
            row.Add(new DpCell {
                Text = name
            });
            row.Add(new DpCell {
                Text = new_message_count
            });
            this.dpTable_groups.Rows.Add(row);
            return(row);
        }
Ejemplo n.º 2
0
        internal void FillList()
        {
            this.dpTable1.Rows.Clear();

            if (this.PatronSummaries == null)
            {
                return;
            }


            foreach (PatronSummary summary in this.PatronSummaries)
            {
                DpRow row = new DpRow();
                row.BackColor = SystemColors.Window;
                row.ForeColor = SystemColors.WindowText;

                DpCell cell = new DpCell();
                cell.Text      = summary.Barcode + " " + summary.Name;
                cell.OwnerDraw = true;
                row.Add(cell);

                this.dpTable1.Rows.Add(row);
            }

            // 放最后一行可见
            if (this.dpTable1.Rows.Count > 0)
            {
                this.dpTable1.EnsureVisible(this.dpTable1.Rows[dpTable1.Rows.Count - 1]);
            }
        }
Ejemplo n.º 3
0
        void AddNextCmdLine()
        {
            DpRow row = new DpRow();

            DpCell cell = new DpCell();

            cell.Text = "";
            row.Add(cell);

            cell      = new DpCell();
            cell.Text = "";
            row.Add(cell);

            cell      = new DpCell();
            cell.Text = "共命中 " + _search.HitCount.ToString() + " 条。双击调入下一批命中记录 ...";
            row.Add(cell);

            this.dpTable_items.Rows.Add(row);
        }
Ejemplo n.º 4
0
        // TODO: 可否通过一个事件,在事件中让 EntityForm 通过 FloatingMessage 显示报错信息
        // 或者用 WebBrowser 控件显示报错信息
        public void DisplayError(string strError)
        {
            this.ActionTable.Rows.Clear();
            this.ActionTable.MaxTextHeight = 500;

            DpRow item = new DpRow();

            DpCell cell = new DpCell("");

            item.Add(cell);

            // 快捷键
            cell = new DpCell();
            item.Add(cell);

            // 说明
            cell = new DpCell(strError);
            // cell.Font = new Font(this.ActionTable.Font.FontFamily, this.ActionTable.Font.SizeInPoints * 2, FontStyle.Bold, GraphicsUnit.Point);
            item.Add(cell);

            item.Tag = new ScriptAction();
            this.ActionTable.Rows.Add(item);
        }
Ejemplo n.º 5
0
        void FillList()
        {
            this.ActionTable.Rows.Clear();
            if (Actions == null)
                return;

            DpRow first_item = null;

            for (int i = 0; i < Actions.Count; i++)
            {
                ScriptAction action = (ScriptAction)Actions[i];

                DpRow item = new DpRow();
                if (action.Name == "-")
                    item.Style = DpRowStyle.Seperator;
                else
                {
                    DpCell cell = new DpCell(action.Name);
                    cell.Font = new Font(this.ActionTable.Font.FontFamily, 10, FontStyle.Bold, GraphicsUnit.Point);
                    item.Add(cell);

                    // 快捷键
                    cell = new DpCell();
                    if (action.ShortcutKey != (char)0)
                    {
                        cell.Text = new string(action.ShortcutKey, 1);
                        cell.Text = cell.Text.ToUpper();
                    }
                    item.Add(cell);

                    // 说明

                    item.Add(new DpCell(action.Comment));


                    // 入口函数
                    cell = new DpCell(action.ScriptEntry);
                    cell.ForeColor = SystemColors.GrayText;
                    cell.Font = new Font(this.ActionTable.Font.FontFamily, 8, GraphicsUnit.Point);
                    item.Add(cell);
                }

                if (action.Active == true)
                {
                    item.Selected = true;

                    // 2009/2/24
                    if (first_item == null)
                        first_item = item;
                }

                this.ActionTable.Rows.Add(item);
            }

            if (first_item != null)
            {
                this.ActionTable.FocusedItem = first_item;
                first_item.EnsureVisible();
            }
        }
Ejemplo n.º 6
0
        private void button_dpTable_fill_Click(object sender, EventArgs e)
        {
            if (this.dpTable1.Columns.Count == 0)
            {
                for (int i = 0; i < 10; i++)
                {
                    DpColumn cell = new DpColumn();
                    cell.Text = "column " + i.ToString();
                    cell.Width = 100;
                    this.dpTable1.Columns.Add(cell);
                }
            }

            string strImageFileName = Path.Combine(this.MainForm.DataDir, "ajax-loader.gif");
            Image image = Image.FromFile(strImageFileName);

            for (int i = 0; i < 10; i++)
            {
                DpRow line = new DpRow();
                line.ForeColor = System.Drawing.Color.Yellow;
                for (int j = 0; j < 10; j++)
                {
                    DpCell cell = new DpCell();
                    if (j == 0)
                        cell.Image = image;
                    cell.Text = "asdf asd fa sdfa sdf asd fa sdf" + i.ToString() + " " + j.ToString();
                    if (j == 5)
                    {
                        cell.BackColor = System.Drawing.Color.Green;
                        cell.ForeColor = System.Drawing.Color.White;
                        cell.Font = new System.Drawing.Font(this.dpTable1.Font, FontStyle.Bold);

                    }
                        if (i == 2)
                            cell.Alignment = DpTextAlignment.InheritLine;
                    line.Add(cell);
                }

                if (i == 2)
                {
                    line.BackColor = System.Drawing.Color.Red;
                    line.Font = new System.Drawing.Font(this.dpTable1.Font, FontStyle.Italic);
                    line.Alignment = StringAlignment.Center;
                }

                this.dpTable1.Rows.Add(line);
            }

            /*
            {
                DpRow line = new DpRow();
                line.Style = DpRowStyle.Seperator;
                line.BackColor = Color.Blue;
                line.ForeColor = Color.White;
                this.dpTable1.Rows.Add(line);

            }
             * */
        }
Ejemplo n.º 7
0
        internal void FillList()
        {
            this.dpTable1.Rows.Clear();

            if (this.PatronSummaries == null)
                return;

            
            foreach(PatronSummary summary in this.PatronSummaries)
            {
                DpRow row = new DpRow();
                row.BackColor = SystemColors.Window;
                row.ForeColor = SystemColors.WindowText;

                DpCell cell = new DpCell();
                cell.Text = summary.Barcode + " " + summary.Name;
                cell.OwnerDraw = true;
                row.Add(cell);

                this.dpTable1.Rows.Add(row);
            }

            // 放最后一行可见
            if (this.dpTable1.Rows.Count > 0)
                this.dpTable1.EnsureVisible(this.dpTable1.Rows[dpTable1.Rows.Count - 1]);

        }
Ejemplo n.º 8
0
        // 加入一个浏览行
        public void AddBiblioBrowseLine(
            string strBiblioRecPath,
            string strBrowseText,
            AmazonBiblioInfo info)
        {
            if (this.dpTable_items.InvokeRequired)
            {
                // 事件是在多线程上下文中触发的,需要 Invoke 显示信息
                this.BeginInvoke(new Action<string, string, AmazonBiblioInfo>(AddBiblioBrowseLine),
                    strBiblioRecPath,
                    strBrowseText,
                    info);
                return;
            }

            // 检查已经存在的最后一行是否为命令行
            if (this.dpTable_items.Rows.Count > 0)
            {
                DpRow tail = this.dpTable_items.Rows[this.dpTable_items.Rows.Count - 1];
                if (string.IsNullOrEmpty(tail[0].Text) == true)
                    this.dpTable_items.Rows.RemoveAt(this.dpTable_items.Rows.Count - 1);
            }

            List<string> columns = StringUtil.SplitList(strBrowseText, '\t');
            DpRow row = new DpRow();
            row.LineAlignment = StringAlignment.Center;

            DpCell cell = new DpCell();
            cell.Text = (this.dpTable_items.Rows.Count + 1).ToString();
            cell.Font = this._idFont;
            cell.ForeColor = SystemColors.GrayText;
            row.Add(cell);

#if NO
            cell = new DpCell();
            cell.Text = strBiblioRecPath;
            row.Add(cell);
#endif

            cell = new DpCell();
            // cell.Text = info.ImageUrl;
            // cell.Text = "正在加载图片 ...";
            row.Add(cell);

            int i = 0;
            foreach (string s in columns)
            {
                cell = new DpCell();
                cell.Text = s;
                if (i == 0)
                    cell.Font = this._titleFont;

                row.Add(cell);
                i++;
            }

            row.Tag = info;
            // row[COLUMN_IMAGE].OwnerDraw = true;

            this.dpTable_items.Rows.Add(row);

#if NO
            if (string.IsNullOrEmpty(info.ImageUrl) == false)
            {
                TraceImage trace = new TraceImage();
                trace.ImageUrl = info.ImageUrl;
                trace.Row = row;
                lock (_trace_images)
                {
                    _trace_images.Add(trace);
                }
            }
#endif
            AddTraceItem(row);
        }
Ejemplo n.º 9
0
        // 准备 dpTable Rows 事项。但不急于填充
        static int PrepareRows(RelationControl control,
            List<ResultItem> items,
            out List<DpRow> rows,
            out string strError)
        {
            strError = "";
            rows = new List<DpRow>();

            ControlInfo info = (ControlInfo)control.Tag;

            // List<ResultItem> items = info.ResultItems;
            if (items == null || items.Count == 0)
                return 0;

            string strControlKey = control.SourceText;

            foreach (ResultItem item in items)
            {
                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(item.Xml);
                }
                catch (Exception ex)
                {
                    strError = "XML 装入 DOM 时出错: " + ex.Message;
                    return -1;
                }

                XmlElement node = dom.DocumentElement.SelectSingleNode("key") as XmlElement;

                string strKey = node.GetAttribute("name");
                // string strKeyCaption = DomUtil.GetCaption(this.Lang, node);

                if (info.Relation.DbName.StartsWith("DDC") == true)
                    strKey = strKey.Replace("/", "");

                XmlNodeList nodes = dom.DocumentElement.SelectNodes("rel");
                foreach (XmlElement rel_node in nodes)
                {
                    string strRel = rel_node.GetAttribute("name");
                    // string strRelCaption = DomUtil.GetCaption(this.Lang, rel_node);
                    string strWeight = rel_node.GetAttribute("weight");

                    DpRow row = new DpRow();
                    // key
                    {
                        DpCell cell = new DpCell();
                        cell.Text = strKey;
                        cell.OwnerDraw = true;
                        row.Add(cell);
                    }
                    // rel
                    {
                        DpCell cell = new DpCell();
                        cell.Text = strRel;
                        row.Add(cell);
                    }
                    // weight
                    {
                        DpCell cell = new DpCell();
                        cell.Text = strWeight;
                        row.Add(cell);
                    }
                    // level
                    {
                        DpCell cell = new DpCell();
                        int nLevel = GetLevel(strControlKey, strKey);
                        Debug.Assert(nLevel <= strControlKey.Length && nLevel <= strKey.Length, "");
                        cell.Text = nLevel.ToString();
                        row.Add(cell);
                    }

                    rows.Add(row);
                }
            }

            rows.Sort(CompareEntrys);

            // 如果 control 还没有初始化过 hitcounts,则初始化一次
            if (control.HitCounts.Count == 0)
                control.HitCounts = BuildHitCountList(rows, strControlKey);

#if NO
            // 选定特定行
            if (info.SelectedLines != null && info.SelectedLines.Count > 0)
            {
                foreach (string line in info.SelectedLines)
                {
                    SelectRowByKey(line);
                }
            }
#endif
            return 0;
        }
Ejemplo n.º 10
0
        void FillList()
        {
            this.ActionTable.Rows.Clear();
            if (Actions == null)
            {
                return;
            }

            DpRow first_item = null;

            for (int i = 0; i < Actions.Count; i++)
            {
                ScriptAction action = (ScriptAction)Actions[i];

                DpRow item = new DpRow();
                if (action.Name == "-")
                {
                    item.Style = DpRowStyle.Seperator;
                }
                else
                {
                    DpCell cell = new DpCell(action.Name);
                    cell.Font = new Font(this.ActionTable.Font.FontFamily, 10, FontStyle.Bold, GraphicsUnit.Point);
                    item.Add(cell);

                    // 快捷键
                    cell = new DpCell();
                    if (action.ShortcutKey != (char)0)
                    {
                        cell.Text = new string(action.ShortcutKey, 1);
                        cell.Text = cell.Text.ToUpper();
                    }
                    item.Add(cell);

                    // 说明

                    item.Add(new DpCell(action.Comment));


                    // 入口函数
                    cell           = new DpCell(action.ScriptEntry);
                    cell.ForeColor = SystemColors.GrayText;
                    cell.Font      = new Font(this.ActionTable.Font.FontFamily, 8, GraphicsUnit.Point);
                    item.Add(cell);
                }

                if (action.Active == true)
                {
                    item.Selected = true;

                    // 2009/2/24
                    if (first_item == null)
                    {
                        first_item = item;
                    }
                }

                this.ActionTable.Rows.Add(item);
            }

            if (first_item != null)
            {
                this.ActionTable.FocusedItem = first_item;
                first_item.EnsureVisible();
            }
        }
Ejemplo n.º 11
0
        public void RefreshDisplay(DpRow row)
        {
            // 初始化列
            if (row.Count == 0)
            {
                // 色条
                DpCell cell = new DpCell();
                row.Add(cell);

                // 状态
                cell = new DpCell();
                cell.ImageIndex = -1;
                row.Add(cell);

                // 内容
                cell = new DpCell();
                row.Add(cell);
            }

            bool bStateText = false;

            // 状态
            // row[0].Text = this.State;
            DpCell state_cell = row[1];
            if (this.State == "begin")
            {
                if (bStateText == true)
                    state_cell.Text = "请求中";
                state_cell.ImageIndex = IMAGEINDEX_WAITING;
            }
            else if (this.State == "error")
            {
                if (bStateText == true)
                    state_cell.Text = "出错";
                state_cell.ImageIndex = IMAGEINDEX_ERROR;
            }
            else if (this.State == "finish")
            {
                if (bStateText == true)
                    state_cell.Text = "完成";
                state_cell.ImageIndex = IMAGEINDEX_FINISH;
            }
            else
            {
                if (bStateText == true)
                    state_cell.Text = "未处理";
                state_cell.ImageIndex = -1;
            }

            string strText = "";
            // 内容
            if (this.Action == "load_reader_info")
                strText = "装载读者信息 " + this.ReaderBarcode;
            else if (this.Action == "borrow")
            {
                strText = GetOperText("借");
            }
            else if (this.Action == "return")
            {
                strText = GetOperText("还");
            }
            else if (this.Action == "verify_return")
            {
                strText = GetOperText("(验证)还");
            }
            else if (this.Action == "lost")
            {
                strText = GetOperText("丢失");
            }
            else if (this.Action == "verify_lost")
            {
                strText = GetOperText("(验证)丢失");
            }
            else if (this.Action == "renew")
            {
                strText = GetOperText("续借");
            }
            else if (this.Action == "verify_renew")
            {
                strText = GetOperText("(验证)续借");
            }
            else if (this.Action == "inventory")
            {
                strText = GetOperText("盘点");
            }

            if (string.IsNullOrEmpty(this.ErrorInfo) == false)
                strText += "\r\n===\r\n" + this.ErrorInfo;

            row[2].Text = strText;

            row.BackColor = SystemColors.Window;
            row.ForeColor = SystemColors.WindowText;

            DpCell color_cell = row[0];
            // row.BackColor = System.Drawing.Color.Transparent;
            if (this.Color == "red")
            {
                color_cell.BackColor = System.Drawing.Color.Red;
                // row.ForeColor = System.Drawing.Color.White;
            }
            else if (this.Color == "green")
            {
                color_cell.BackColor = System.Drawing.Color.Green;
                // row.ForeColor = System.Drawing.Color.White;
            }
            else if (this.Color == "yellow")
            {
                row.BackColor = System.Drawing.Color.Yellow;
                color_cell.BackColor = System.Drawing.Color.Transparent;
                // row.ForeColor = System.Drawing.Color.Black;
            }
            else if (this.Color == "light")
            {
                color_cell.BackColor = System.Drawing.Color.LightGray;
            }
            else if (this.Color == "purple")
            {
                color_cell.BackColor = System.Drawing.Color.Purple;
            }
            else if (this.Color == "black")
            {
                color_cell.BackColor = System.Drawing.Color.Purple;
                row.BackColor = System.Drawing.Color.Black;
                row.ForeColor = System.Drawing.Color.LightGray;
            }
            else
            {
                // color_cell.BackColor = System.Drawing.Color.Transparent;
                color_cell.BackColor = System.Drawing.Color.White;
            }
        }
Ejemplo n.º 12
0
        // 加入一个浏览行
        public void AddBiblioBrowseLine(
            int nType,
            string strBiblioRecPath,
            string strBrowseText,
            RegisterBiblioInfo info,
            bool bAutoSetFocus)
        {
            if (this.dpTable_browseLines.InvokeRequired)
            {
                // 事件是在多线程上下文中触发的,需要 Invoke 显示信息
                this.BeginInvoke(new Action<int, string, string, RegisterBiblioInfo, bool>(AddBiblioBrowseLine),
                    nType,
                    strBiblioRecPath,
                    strBrowseText,
                    info,
                    bAutoSetFocus);
                return;
            }

            List<string> columns = StringUtil.SplitList(strBrowseText, '\t');
            DpRow row = new DpRow();

            // 序号
            DpCell cell = new DpCell();
            cell.Alignment = DpTextAlignment.Far;
            cell.Font = new Font(this.Font.FontFamily, this.Font.Size * 2);
            cell.Text = (this.dpTable_browseLines.Rows.Count + 1).ToString();
            {
                cell.ImageIndex = nType;
                if (nType == TYPE_ERROR)
                    cell.BackColor = Color.Red;
                else if (nType == TYPE_INFO)
                    cell.BackColor = Color.Yellow;
            }
            row.Add(cell);

            // 记录路径
            cell = new DpCell();
            cell.Text = strBiblioRecPath;
            row.Add(cell);

            // 封面
            cell = new DpCell();
            cell.Text = "";
            row.Add(cell);

            foreach (string s in columns)
            {
                cell = new DpCell();
                cell.Text = s;
                row.Add(cell);
            }

            row.Tag = info;
            this.dpTable_browseLines.Rows.Add(row);

            // 当插入第一行的时候,顺便选中它
            if (this.dpTable_browseLines.Rows.Count == 1)
            {
                if (bAutoSetFocus)
                    this.dpTable_browseLines.Focus();
                row.Selected = true;
                this.dpTable_browseLines.FocusedItem = row;
            }

            PrepareCoverImage(row);
        }
Ejemplo n.º 13
0
        // 将一条书目记录下属的若干册记录装入列表
        // return:
        //      -2  用户中断
        //      -1  出错
        //      >=0 装入的册记录条数
        int LoadBiblioSubItems(string strBiblioRecPath,
            out string strError)
        {
            strError = "";

            Progress.SetMessage("正在装入书目记录 '"+strBiblioRecPath+"' 下属的册记录 ...");

            int nCount = 0;

            long lPerCount = 100; // 每批获得多少个
            long lStart = 0;
            long lResultCount = 0;
            long lCount = -1;
            for (; ; )
            {
                if (Progress.State != 0)
                {
                    strError = "用户中断";
                    return -2;
                }

                EntityInfo[] entities = null;

                long lRet = Channel.GetEntities(
         Progress,
         strBiblioRecPath,
         lStart,
         lCount,
         "",  // bDisplayOtherLibraryItem == true ? "getotherlibraryitem" : "",
         "zh",
         out entities,
         out strError);
                if (lRet == -1)
                    return -1;

                lResultCount = lRet;

                if (lRet == 0)
                    return nCount;

                Debug.Assert(entities != null, "");

                foreach (EntityInfo entity in entities)
                {
                    string strXml = entity.OldRecord;

                    XmlDocument dom = new XmlDocument();
                    {
                        try
                        {
                            if (string.IsNullOrEmpty(strXml) == false)
                                dom.LoadXml(strXml);
                            else
                                dom.LoadXml("<root />");
                        }
                        catch (Exception ex)
                        {
                            strError = "XML 装入 DOM 出错: " + ex.Message;
                            return -1;
                        }
                    }

                    DpRow row = new DpRow();

                    string strState = DomUtil.GetElementText(dom.DocumentElement, "state");
                    string strBorrower = DomUtil.GetElementText(dom.DocumentElement, "borrower");
                    if (this.FunctionType == "borrow")
                    {
                        // 在借的册、或者状态有值的需要显示为灰色
                        if (string.IsNullOrEmpty(strBorrower) == false
                            || string.IsNullOrEmpty(strState) == false)
                            SetGrayText(row);
                    }
                    else if (this.FunctionType == "return")
                    {
                        // 没有在借的册需要显示为灰色
                        if (string.IsNullOrEmpty(strBorrower) == true)
                            SetGrayText(row);
                        if (string.IsNullOrEmpty(this.VerifyBorrower) == false)
                        {
                            // 验证还书时,不是要求的读者所借阅的册,显示为灰色
                            if (strBorrower != this.VerifyBorrower)
                                SetGrayText(row);
                        }
                    }
                    else if (this.FunctionType == "renew")
                    {
                        // 没有在借的册需要显示为灰色
                        if (string.IsNullOrEmpty(strBorrower) == true)
                            SetGrayText(row);
                    }

                    string strBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode");
                    string strRefID = DomUtil.GetElementText(dom.DocumentElement, "refID");

                    // 状态
                    DpCell cell = new DpCell();
                    cell.Text = strState;
                    row.Add(cell);

                    // 册条码号
                    cell = new DpCell();
                    if (string.IsNullOrEmpty(strBarcode) == false)
                        cell.Text = strBarcode;
                    else
                        cell.Text = "@refID:" + strRefID;
                    row.Add(cell);

                    // 在借情况
                    cell = new DpCell();
                    if (string.IsNullOrEmpty(strBorrower) == false)
                    {
                        string strReaderSummary = this.MainForm.GetReaderSummary(strBorrower, false);
                        bool bError = (string.IsNullOrEmpty(strReaderSummary) == false && strReaderSummary[0] == '!');

                        if (bError == true)
                            cell.BackColor = Color.FromArgb(180, 0, 0);
                        else
                        {
                            if (IsGray(row) == true)
                                cell.BackColor = Color.FromArgb(220, 220, 0);
                            else
                                cell.BackColor = Color.FromArgb(180, 180, 0);
                        }

                        if (bError == false)
                            cell.Font = new System.Drawing.Font(this.dpTable_items.Font.FontFamily.Name, this.dpTable_items.Font.Size * 2, FontStyle.Bold);

                        cell.ForeColor = Color.FromArgb(255, 255, 255);
                        cell.Alignment = DpTextAlignment.Center;
                        cell.Text = strReaderSummary;
                        // TODO: 后面还可加上借阅时间,应还时间
                    }
                    row.Add(cell);

                    // 书目摘要
                    string strSummary = "";
                    if (entity.ErrorCode != ErrorCodeValue.NoError)
                    {
                        strSummary = entity.ErrorInfo;
                    }
                    else
                    {
                        int nRet = this.MainForm.GetBiblioSummary("@bibliorecpath:" + strBiblioRecPath,
                            "",
                            false,
                            out strSummary,
                            out strError);
                        if (nRet == -1)
                            strSummary = strError;
                    }
                    cell = new DpCell();
                    cell.Text = strSummary;
                    row.Add(cell);

                    // 卷册
                    string strVolumn = DomUtil.GetElementText(dom.DocumentElement, "volumn");
                    cell = new DpCell();
                    cell.Text = strVolumn;
                    row.Add(cell);

                    // 地点
                    string strLocation = DomUtil.GetElementText(dom.DocumentElement, "location");
                    cell = new DpCell();
                    cell.Text = strLocation;
                    row.Add(cell);

                    // 价格
                    string strPrice = DomUtil.GetElementText(dom.DocumentElement, "price");
                    cell = new DpCell();
                    cell.Text = strPrice;
                    row.Add(cell);

                    // 册记录路径
                    cell = new DpCell();
                    cell.Text = entity.OldRecPath;
                    row.Add(cell);

                    this.dpTable_items.Rows.Add(row);
                    nCount++;
                }

                lStart += entities.Length;
                if (lStart >= lResultCount)
                    break;

                if (lCount == -1)
                    lCount = lPerCount;

                if (lStart + lCount > lResultCount)
                    lCount = lResultCount - lStart;
            }

            if (lStart > 0)
            {
                DpRow row = new DpRow();
                row.Style = DpRowStyle.Seperator;
                this.dpTable_items.Rows.Add(row);
            }

            return nCount;
        }
Ejemplo n.º 14
0
        public void RefreshDisplay(DpRow row)
        {
            // 初始化列
            if (row.Count == 0)
            {
                // 色条
                DpCell cell = new DpCell();
                row.Add(cell);

                // 状态
                cell            = new DpCell();
                cell.ImageIndex = -1;
                row.Add(cell);

                // 内容
                cell = new DpCell();
                row.Add(cell);
            }

            bool bStateText = false;

            // 状态
            // row[0].Text = this.State;
            DpCell state_cell = row[1];

            if (this.State == "begin")
            {
                if (bStateText == true)
                {
                    state_cell.Text = "请求中";
                }
                state_cell.ImageIndex = IMAGEINDEX_WAITING;
            }
            else if (this.State == "error")
            {
                if (bStateText == true)
                {
                    state_cell.Text = "出错";
                }
                state_cell.ImageIndex = IMAGEINDEX_ERROR;
            }
            else if (this.State == "finish")
            {
                if (bStateText == true)
                {
                    state_cell.Text = "完成";
                }
                state_cell.ImageIndex = IMAGEINDEX_FINISH;
            }
            else
            {
                if (bStateText == true)
                {
                    state_cell.Text = "未处理";
                }
                state_cell.ImageIndex = -1;
            }

            string strText = "";

            // 内容
            if (this.Action == "load_reader_info")
            {
                strText = "装载读者信息 " + this.ReaderBarcode;
            }
            else if (this.Action == "borrow")
            {
                strText = GetOperText("借");
            }
            else if (this.Action == "return")
            {
                strText = GetOperText("还");
            }
            else if (this.Action == "verify_return")
            {
                strText = GetOperText("(验证)还");
            }
            else if (this.Action == "lost")
            {
                strText = GetOperText("丢失");
            }
            else if (this.Action == "verify_lost")
            {
                strText = GetOperText("(验证)丢失");
            }
            else if (this.Action == "renew")
            {
                strText = GetOperText("续借");
            }
            else if (this.Action == "verify_renew")
            {
                strText = GetOperText("(验证)续借");
            }
            else if (this.Action == "inventory")
            {
                strText = GetOperText("盘点");
            }
            else if (this.Action == "read")
            {
                strText = GetOperText("读过");
            }
            else if (this.Action == "boxing")
            {
                strText = GetOperText("配书");
            }

            if (string.IsNullOrEmpty(this.ErrorInfo) == false)
            {
                strText += "\r\n===\r\n" + this.ErrorInfo;
            }

            row[2].Text = strText;

            // 缺省为透明色,即使用 row 的前景背景色 2015/10/18
            ////row.BackColor = SystemColors.Window;
            ////row.ForeColor = SystemColors.WindowText;

            DpCell color_cell = row[0];

            // row.BackColor = System.Drawing.Color.Transparent;
            if (this.Color == "red")
            {
                color_cell.BackColor = System.Drawing.Color.Red;
                // row.ForeColor = System.Drawing.Color.White;
            }
            else if (this.Color == "green")
            {
                color_cell.BackColor = System.Drawing.Color.Green;
                // row.ForeColor = System.Drawing.Color.White;
            }
            else if (this.Color == "yellow")
            {
                row.BackColor        = System.Drawing.Color.Yellow;
                color_cell.BackColor = System.Drawing.Color.Transparent;
                // row.ForeColor = System.Drawing.Color.Black;
            }
            else if (this.Color == "light")
            {
                color_cell.BackColor = System.Drawing.Color.LightGray;
            }
            else if (this.Color == "purple")
            {
                color_cell.BackColor = System.Drawing.Color.Purple;
            }
            else if (this.Color == "black")
            {
                color_cell.BackColor = System.Drawing.Color.Purple;
#if NO
                row.BackColor = System.Drawing.Color.Black;
                row.ForeColor = System.Drawing.Color.LightGray;
#endif
            }
            else
            {
                // color_cell.BackColor = System.Drawing.Color.Transparent;
                color_cell.BackColor = System.Drawing.Color.White;
            }
        }
Ejemplo n.º 15
0
        private void button_load_loadFromBarcodeFile_Click(object sender, EventArgs e)
        {
            string strError = "";
            //int nRet = 0;

            bool bClearBefore = true;

            if (Control.ModifierKeys == Keys.Control)
            {
                bClearBefore = false;
            }

            if (bClearBefore == true)
            {
                ClearBefore();
            }

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "请指定要打开的条码号文件名";
            // dlg.FileName = this.BarcodeFilePath;
            // dlg.InitialDirectory =
            dlg.Filter           = "条码号文件 (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            EnableControls(false);
            // MainForm.ShowProgress(true);

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在将册条码号转换为记录路径 ...");
            stop.BeginLoop();

            try
            {
                Hashtable     barcode_table = new Hashtable();
                int           nDupCount     = 0;
                List <string> lines         = new List <string>();

                using (StreamReader sr = new StreamReader(dlg.FileName))
                {
                    for (; ;)
                    {
                        Application.DoEvents();

                        if (stop != null && stop.State != 0)
                        {
                            strError = "用户中断";
                            goto ERROR1;
                        }

                        string strLine = "";
                        strLine = sr.ReadLine();

                        if (strLine == null)
                        {
                            break;
                        }

                        strLine = strLine.Trim();
                        if (String.IsNullOrEmpty(strLine) == true)
                        {
                            continue;
                        }

                        if (strLine[0] == '#')
                        {
                            continue;   // 注释行
                        }
                        if (barcode_table[strLine] != null)
                        {
                            nDupCount++;
                            continue;
                        }

                        barcode_table[strLine] = true;
                        lines.Add(strLine);
                    }
                }

                if (lines.Count == 0)
                {
                    strError = "条码号文件为空";
                    goto ERROR1;
                }

                stop.SetProgressRange(0, lines.Count);

                ItemBarcodeLoader loader = new ItemBarcodeLoader();
                loader.Channel  = this.Channel;
                loader.Stop     = this.stop;
                loader.Barcodes = lines;

                int i = 0;
                foreach (EntityItem item in loader)
                {
                    Application.DoEvents();

                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        goto ERROR1;
                    }

                    DpRow row = new DpRow();
                    // icon1
                    DpCell cell = new DpCell();
                    row.Add(cell);

                    // icon2
                    cell = new DpCell();
                    row.Add(cell);

                    // barcode
                    cell      = new DpCell();
                    cell.Text = item.Barcode;
                    row.Add(cell);

                    // summary
                    cell = new DpCell();
                    // 如果出错
                    if (string.IsNullOrEmpty(item.ErrorInfo) == false)
                    {
                        cell.Text = item.ErrorInfo;
                    }
                    row.Add(cell);

                    // recpath
                    cell      = new DpCell();
                    cell.Text = item.RecPath;
                    row.Add(cell);

                    this.dpTable1.Rows.Add(row);

                    i++;
                    stop.SetProgressValue(i);
                }


                // BrowseLoader
            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
                stop.HideProgress();

                EnableControls(true);
                // MainForm.ShowProgress(false);
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Ejemplo n.º 16
0
        // 加入一个浏览行
        public void AddBiblioBrowseLine(
            int nType,
            string strBiblioRecPath,
            string strBrowseText,
            RegisterBiblioInfo info)
        {
            if (this.dpTable_browseLines.InvokeRequired)
            {
                // 事件是在多线程上下文中触发的,需要 Invoke 显示信息
                this.BeginInvoke(new Action<int, string, string, RegisterBiblioInfo>(AddBiblioBrowseLine),
                    nType,
                    strBiblioRecPath,
                    strBrowseText,
                    info);
                return;
            }

            List<string> columns = StringUtil.SplitList(strBrowseText, '\t');
            DpRow row = new DpRow();

            DpCell cell = new DpCell();
            cell.Text = (this.dpTable_browseLines.Rows.Count + 1).ToString();
            {
                cell.ImageIndex = nType;
                if (nType == TYPE_ERROR)
                    cell.BackColor = Color.Red;
                else if (nType == TYPE_INFO)
                    cell.BackColor = Color.Yellow;
            }
            row.Add(cell);

            cell = new DpCell();
            cell.Text = strBiblioRecPath;
            row.Add(cell);

            foreach (string s in columns)
            {
                cell = new DpCell();
                cell.Text = s;
                row.Add(cell);
            }

            row.Tag = info;
            this.dpTable_browseLines.Rows.Add(row);

            PrepareCoverImage(row);
        }
Ejemplo n.º 17
0
        // 加入一个浏览行
        public void AddBiblioBrowseLine(string strText,
            int nType)
        {
            if (this.dpTable_browseLines.InvokeRequired)
            {
                // 事件是在多线程上下文中触发的,需要 Invoke 显示信息
                this.BeginInvoke(new Action<string, int>(AddBiblioBrowseLine),
                    strText,
                    nType);
                return;
            }

            DpRow row = new DpRow();

            DpCell cell = new DpCell();
            cell.Text = (this.dpTable_browseLines.Rows.Count + 1).ToString();

            {
                cell.ImageIndex = nType;
                if (nType == TYPE_ERROR)
                    cell.BackColor = Color.Red;
                else if (nType == TYPE_INFO)
                    cell.BackColor = Color.Yellow;
            }
            row.Add(cell);

            cell = new DpCell();
            cell.Text = strText;
            row.Add(cell);

            row.Tag = null;
            this.dpTable_browseLines.Rows.Add(row);
        }
Ejemplo n.º 18
0
        public void DisplayError(string strError)
        {
            this.ActionTable.Rows.Clear();

            DpRow item = new DpRow();
            DpCell cell = new DpCell("");
            item.Add(cell);

            // 快捷键
            cell = new DpCell();
            item.Add(cell);

            // 说明
            cell = new DpCell(strError);
            // cell.Font = new Font(this.ActionTable.Font.FontFamily, this.ActionTable.Font.SizeInPoints * 2, FontStyle.Bold, GraphicsUnit.Point);
            item.Add(cell);

            item.Tag = new ScriptAction();
            this.ActionTable.Rows.Add(item);
        }
Ejemplo n.º 19
0
        // 将一条书目记录下属的若干册记录装入列表
        // return:
        //      -2  用户中断
        //      -1  出错
        //      >=0 装入的册记录条数
        int LoadBiblioSubItems(
            LibraryChannel channel,
            string strBiblioRecPath,
            out string strError)
        {
            strError = "";

            Progress.SetMessage("正在装入书目记录 '" + strBiblioRecPath + "' 下属的册记录 ...");

            if (this.FunctionType == "read")
            {
                AddBiblioLine(strBiblioRecPath);
            }

            int nCount = 0;

            long lPerCount    = 100; // 每批获得多少个
            long lStart       = 0;
            long lResultCount = 0;
            long lCount       = -1;

            for (; ;)
            {
                if (Progress.State != 0)
                {
                    strError = "用户中断";
                    return(-2);
                }

                EntityInfo[] entities = null;

                long lRet = channel.GetEntities(
                    Progress,
                    strBiblioRecPath,
                    lStart,
                    lCount,
                    "", // bDisplayOtherLibraryItem == true ? "getotherlibraryitem" : "",
                    "zh",
                    out entities,
                    out strError);
                if (lRet == -1)
                {
                    return(-1);
                }

                lResultCount = lRet;

                if (lRet == 0)
                {
                    return(nCount);
                }

                Debug.Assert(entities != null, "");

                foreach (EntityInfo entity in entities)
                {
                    string strXml = entity.OldRecord;

                    XmlDocument dom = new XmlDocument();
                    {
                        try
                        {
                            if (string.IsNullOrEmpty(strXml) == false)
                            {
                                dom.LoadXml(strXml);
                            }
                            else
                            {
                                dom.LoadXml("<root />");
                            }
                        }
                        catch (Exception ex)
                        {
                            strError = "XML 装入 DOM 出错: " + ex.Message;
                            return(-1);
                        }
                    }

                    DpRow row = new DpRow();

                    string strState    = DomUtil.GetElementText(dom.DocumentElement, "state");
                    string strBorrower = DomUtil.GetElementText(dom.DocumentElement, "borrower");
                    if (this.FunctionType == "borrow")
                    {
                        // 在借的册、或者状态有值的需要显示为灰色
                        if (string.IsNullOrEmpty(strBorrower) == false ||
                            string.IsNullOrEmpty(strState) == false)
                        {
                            SetGrayText(row);
                        }
                    }
                    else if (this.FunctionType == "return")
                    {
                        // 没有在借的册需要显示为灰色
                        if (string.IsNullOrEmpty(strBorrower) == true)
                        {
                            SetGrayText(row);
                        }
                        if (string.IsNullOrEmpty(this.VerifyBorrower) == false)
                        {
                            // 验证还书时,不是要求的读者所借阅的册,显示为灰色
                            if (strBorrower != this.VerifyBorrower)
                            {
                                SetGrayText(row);
                            }
                        }
                    }
                    else if (this.FunctionType == "renew")
                    {
                        // 没有在借的册需要显示为灰色
                        if (string.IsNullOrEmpty(strBorrower) == true)
                        {
                            SetGrayText(row);
                        }
                    }

                    string strBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode");
                    string strRefID   = DomUtil.GetElementText(dom.DocumentElement, "refID");

                    // 状态
                    DpCell cell = new DpCell();
                    cell.Text = strState;
                    row.Add(cell);

                    // 册条码号
                    cell = new DpCell();
                    if (string.IsNullOrEmpty(strBarcode) == false)
                    {
                        cell.Text = strBarcode;
                    }
                    else
                    {
                        cell.Text = "@refID:" + strRefID;
                    }
                    row.Add(cell);

                    // 在借情况
                    cell = new DpCell();
                    if (string.IsNullOrEmpty(strBorrower) == false)
                    {
                        string strReaderSummary = Program.MainForm.GetReaderSummary(strBorrower, false);
                        bool   bError           = (string.IsNullOrEmpty(strReaderSummary) == false && strReaderSummary[0] == '!');

                        if (bError == true)
                        {
                            cell.BackColor = Color.FromArgb(180, 0, 0);
                        }
                        else
                        {
                            if (IsGray(row) == true)
                            {
                                cell.BackColor = Color.FromArgb(220, 220, 0);
                            }
                            else
                            {
                                cell.BackColor = Color.FromArgb(180, 180, 0);
                            }
                        }

                        if (bError == false)
                        {
                            cell.Font = new System.Drawing.Font(this.dpTable_items.Font.FontFamily.Name, this.dpTable_items.Font.Size * 2, FontStyle.Bold);
                        }

                        cell.ForeColor = Color.FromArgb(255, 255, 255);
                        cell.Alignment = DpTextAlignment.Center;
                        cell.Text      = strReaderSummary;
                        // TODO: 后面还可加上借阅时间,应还时间
                    }
                    row.Add(cell);

                    // 书目摘要
                    string strSummary = "";
                    if (entity.ErrorCode != ErrorCodeValue.NoError)
                    {
                        strSummary = entity.ErrorInfo;
                    }
                    else
                    {
                        int nRet = Program.MainForm.GetBiblioSummary("@bibliorecpath:" + strBiblioRecPath,
                                                                     "",
                                                                     false,
                                                                     out strSummary,
                                                                     out strError);
                        if (nRet == -1)
                        {
                            strSummary = strError;
                        }
                    }
                    cell      = new DpCell();
                    cell.Text = strSummary;
                    row.Add(cell);

                    // 卷册
                    string strVolume = DomUtil.GetElementText(dom.DocumentElement, "volume");
                    cell      = new DpCell();
                    cell.Text = strVolume;
                    row.Add(cell);

                    // 地点
                    string strLocation = DomUtil.GetElementText(dom.DocumentElement, "location");
                    cell      = new DpCell();
                    cell.Text = strLocation;
                    row.Add(cell);

                    // 价格
                    string strPrice = DomUtil.GetElementText(dom.DocumentElement, "price");
                    cell      = new DpCell();
                    cell.Text = strPrice;
                    row.Add(cell);

                    // 册记录路径
                    cell      = new DpCell();
                    cell.Text = entity.OldRecPath;
                    row.Add(cell);

                    this.dpTable_items.Rows.Add(row);
                    nCount++;
                }

                lStart += entities.Length;
                if (lStart >= lResultCount)
                {
                    break;
                }

                if (lCount == -1)
                {
                    lCount = lPerCount;
                }

                if (lStart + lCount > lResultCount)
                {
                    lCount = lResultCount - lStart;
                }
            }

            // 分割行
            if (lStart > 0)
            {
                DpRow row = new DpRow();
                row.Style = DpRowStyle.Seperator;
                this.dpTable_items.Rows.Add(row);
            }

            return(nCount);
        }
Ejemplo n.º 20
0
        // 加入书目行
        void AddBiblioLine(string strBiblioRecPath)
        {
            string strError = "";

            string strVolume = "";
            string strPrice = "";

            GetVolume(strBiblioRecPath,
            out strVolume,
            out strPrice);

            Color colorBack = Color.LightGreen;

            DpRow row = new DpRow();
#if NO
            // 设为灰色行
            SetGrayText(row);
#endif

            // 状态
            DpCell cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = "";
            row.Add(cell);

            // 册条码号
            cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = "@biblioRecPath:" + strBiblioRecPath;
            row.Add(cell);

            // 在借情况
            cell = new DpCell();
            cell.BackColor = colorBack;
#if NO
            {
                    if (IsGray(row) == true)
                        cell.BackColor = Color.FromArgb(220, 220, 0);
                    else
                        cell.BackColor = Color.FromArgb(180, 180, 0);

                cell.ForeColor = Color.FromArgb(255, 255, 255);
                cell.Alignment = DpTextAlignment.Center;
                cell.Text = "";
            }
#endif
            row.Add(cell);

            // 书目摘要
            string strSummary = "";
            {
                int nRet = this.MainForm.GetBiblioSummary("@bibliorecpath:" + strBiblioRecPath,
                    "",
                    false,
                    out strSummary,
                    out strError);
                if (nRet == -1)
                    strSummary = strError;
            }
            cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = strSummary;
            row.Add(cell);

            // 卷册
            cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = strVolume;
            row.Add(cell);

            // 地点
            cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = "";
            row.Add(cell);

            // 价格
            cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = strPrice;
            row.Add(cell);

            // 册记录路径
            cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text = strBiblioRecPath;
            row.Add(cell);

            this.dpTable_items.Rows.Add(row);
        }
Ejemplo n.º 21
0
        // 将控件加入到tablelayoutpanel中
        internal void AddToTable(DpTable table, int nInsertPos)
        {
            DpRow row = new DpRow();

            DpCell cell = new DpCell();
            cell.InnerControl = this.label_color;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.textBox_catalogNo;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.comboBox_seller;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.comboBox_source;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.dateRange_range;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.comboBox_issueCount;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.comboBox_copy;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.textBox_price;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.location;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.comboBox_class;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.label_sellerAddress;
            row.Add(cell);

            cell = new DpCell();
            cell.InnerControl = this.label_other;
            row.Add(cell);

            if (nInsertPos >= table.Rows.Count)
                table.Rows.Add(row);
            else
                table.Rows.Insert(nInsertPos, row);

            AddEvents();
        }
Ejemplo n.º 22
0
        // 加入一个浏览行
        public void AddBiblioBrowseLine(
            string strBiblioRecPath,
            string strBrowseText,
            AmazonBiblioInfo info)
        {
            if (this.dpTable_items.InvokeRequired)
            {
                // 事件是在多线程上下文中触发的,需要 Invoke 显示信息
                this.BeginInvoke(new Action <string, string, AmazonBiblioInfo>(AddBiblioBrowseLine),
                                 strBiblioRecPath,
                                 strBrowseText,
                                 info);
                return;
            }

            // 检查已经存在的最后一行是否为命令行
            if (this.dpTable_items.Rows.Count > 0)
            {
                DpRow tail = this.dpTable_items.Rows[this.dpTable_items.Rows.Count - 1];
                if (string.IsNullOrEmpty(tail[0].Text) == true)
                {
                    this.dpTable_items.Rows.RemoveAt(this.dpTable_items.Rows.Count - 1);
                }
            }

            List <string> columns = StringUtil.SplitList(strBrowseText, '\t');
            DpRow         row     = new DpRow();

            row.LineAlignment = StringAlignment.Center;

            DpCell cell = new DpCell();

            cell.Text      = (this.dpTable_items.Rows.Count + 1).ToString();
            cell.Font      = this._idFont;
            cell.ForeColor = SystemColors.GrayText;
            row.Add(cell);

#if NO
            cell      = new DpCell();
            cell.Text = strBiblioRecPath;
            row.Add(cell);
#endif

            cell = new DpCell();
            // cell.Text = info.ImageUrl;
            // cell.Text = "正在加载图片 ...";
            row.Add(cell);

            int i = 0;
            foreach (string s in columns)
            {
                cell      = new DpCell();
                cell.Text = s;
                if (i == 0)
                {
                    cell.Font = this._titleFont;
                }

                row.Add(cell);
                i++;
            }

            row.Tag = info;
            // row[COLUMN_IMAGE].OwnerDraw = true;

            this.dpTable_items.Rows.Add(row);

#if NO
            if (string.IsNullOrEmpty(info.ImageUrl) == false)
            {
                TraceImage trace = new TraceImage();
                trace.ImageUrl = info.ImageUrl;
                trace.Row      = row;
                lock (_trace_images)
                {
                    _trace_images.Add(trace);
                }
            }
#endif
            AddTraceItem(row);
        }
Ejemplo n.º 23
0
        // 加入书目行
        void AddBiblioLine(string strBiblioRecPath)
        {
            string strError = "";

            string strVolume = "";
            string strPrice  = "";

            GetVolume(strBiblioRecPath,
                      out strVolume,
                      out strPrice);

            Color colorBack = Color.LightGreen;

            DpRow row = new DpRow();

#if NO
            // 设为灰色行
            SetGrayText(row);
#endif

            // 状态
            DpCell cell = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = "";
            row.Add(cell);

            // 册条码号
            cell           = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = "@biblioRecPath:" + strBiblioRecPath;
            row.Add(cell);

            // 在借情况
            cell           = new DpCell();
            cell.BackColor = colorBack;
#if NO
            {
                if (IsGray(row) == true)
                {
                    cell.BackColor = Color.FromArgb(220, 220, 0);
                }
                else
                {
                    cell.BackColor = Color.FromArgb(180, 180, 0);
                }

                cell.ForeColor = Color.FromArgb(255, 255, 255);
                cell.Alignment = DpTextAlignment.Center;
                cell.Text      = "";
            }
#endif
            row.Add(cell);

            // 书目摘要
            string strSummary = "";
            {
                int nRet = Program.MainForm.GetBiblioSummary("@bibliorecpath:" + strBiblioRecPath,
                                                             "",
                                                             false,
                                                             out strSummary,
                                                             out strError);
                if (nRet == -1)
                {
                    strSummary = strError;
                }
            }
            cell           = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = strSummary;
            row.Add(cell);

            // 卷册
            cell           = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = strVolume;
            row.Add(cell);

            // 地点
            cell           = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = "";
            row.Add(cell);

            // 价格
            cell           = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = strPrice;
            row.Add(cell);

            // 册记录路径
            cell           = new DpCell();
            cell.BackColor = colorBack;
            cell.Text      = strBiblioRecPath;
            row.Add(cell);

            this.dpTable_items.Rows.Add(row);
        }
Ejemplo n.º 24
0
        void AddNextCmdLine()
        {
            DpRow row = new DpRow();

            DpCell cell = new DpCell();
            cell.Text = "";
            row.Add(cell);

            cell = new DpCell();
            cell.Text = "";
            row.Add(cell);

            cell = new DpCell();
            cell.Text = "共命中 "+_search.HitCount.ToString()+" 条。双击调入下一批命中记录 ...";
            row.Add(cell);

            this.dpTable_items.Rows.Add(row);
        }
Ejemplo n.º 25
0
        private void button_load_loadFromBarcodeFile_Click(object sender, EventArgs e)
        {
            string strError = "";
            int nRet = 0;

            bool bClearBefore = true;
            if (Control.ModifierKeys == Keys.Control)
                bClearBefore = false;

            if (bClearBefore == true)
                ClearBefore();

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "请指定要打开的条码号文件名";
            // dlg.FileName = this.BarcodeFilePath;
            // dlg.InitialDirectory = 
            dlg.Filter = "条码号文件 (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            EnableControls(false);
            // MainForm.ShowProgress(true);

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在将册条码号转换为记录路径 ...");
            stop.BeginLoop();

            try
            {
                Hashtable barcode_table = new Hashtable();
                int nDupCount = 0;
                List<string> lines = new List<string>();

                using (StreamReader sr = new StreamReader(dlg.FileName))
                {
                    for (; ; )
                    {
                        Application.DoEvents();

                        if (stop != null && stop.State != 0)
                        {
                            strError = "用户中断";
                            goto ERROR1;
                        }

                        string strLine = "";
                        strLine = sr.ReadLine();

                        if (strLine == null)
                            break;

                        strLine = strLine.Trim();
                        if (String.IsNullOrEmpty(strLine) == true)
                            continue;

                        if (strLine[0] == '#')
                            continue;   // 注释行

                        if (barcode_table[strLine] != null)
                        {
                            nDupCount++;
                            continue;
                        }

                        barcode_table[strLine] = true;
                        lines.Add(strLine);
                    }
                }

                if (lines.Count == 0)
                {
                    strError = "条码号文件为空";
                    goto ERROR1;
                }

                stop.SetProgressRange(0, lines.Count);

                ItemBarcodeLoader loader = new ItemBarcodeLoader();
                loader.Channel = this.Channel;
                loader.Stop = this.stop;
                loader.Barcodes = lines;

                int i = 0;
                foreach (EntityItem item in loader)
                {
                    Application.DoEvents();

                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        goto ERROR1;
                    }

                    DpRow row = new DpRow();
                    // icon1
                    DpCell cell = new DpCell();
                    row.Add(cell);

                    // icon2
                    cell = new DpCell();
                    row.Add(cell);

                    // barcode
                    cell = new DpCell();
                    cell.Text = item.Barcode;
                    row.Add(cell);

                    // summary
                    cell = new DpCell();
                    // 如果出错
                    if (string.IsNullOrEmpty(item.ErrorInfo) == false)
                        cell.Text = item.ErrorInfo;
                    row.Add(cell);

                    // recpath
                    cell = new DpCell();
                    cell.Text = item.RecPath;
                    row.Add(cell);

                    this.dpTable1.Rows.Add(row);

                    i++;
                    stop.SetProgressValue(i);
                }


                // BrowseLoader
            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
                stop.HideProgress();

                EnableControls(true);
                // MainForm.ShowProgress(false);
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Ejemplo n.º 26
0
        void FillEntryList(RelationControl control)
        {
            string strError = "";

            _disableSelectionChanged++; // 防止 control 的 TargetText 被清掉
            this.dpTable1.Rows.Clear();
            _disableSelectionChanged--;

            ControlInfo info = (ControlInfo)control.Tag;

            List<ResultItem> items = info.ResultItems;
            if (items == null || items.Count == 0)
                return;

            string strControlKey = control.SourceText;

            foreach (ResultItem item in items)
            {
                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(item.Xml);
                }
                catch (Exception ex)
                {
                    strError = "XML 装入 DOM 时出错: " + ex.Message;
                    goto ERROR1;
                }

                XmlElement node = dom.DocumentElement.SelectSingleNode("key") as XmlElement;

                string strKey = node.GetAttribute("name");
                // string strKeyCaption = DomUtil.GetCaption(this.Lang, node);

                XmlNodeList nodes = dom.DocumentElement.SelectNodes("rel");
                foreach (XmlElement rel_node in nodes)
                {
                    string strRel = rel_node.GetAttribute("name");
                    // string strRelCaption = DomUtil.GetCaption(this.Lang, rel_node);
                    string strWeight = rel_node.GetAttribute("weight");

                    DpRow row = new DpRow();
                    // key
                    {
                        DpCell cell = new DpCell();
                        cell.Text = strKey;
                        cell.OwnerDraw = true;
                        row.Add(cell);
                    }
                    // rel
                    {
                        DpCell cell = new DpCell();
                        cell.Text = strRel;
                        row.Add(cell);
                    }
                    // weight
                    {
                        DpCell cell = new DpCell();
                        cell.Text = strWeight;
                        row.Add(cell);
                    }
                    // level
                    {
                        DpCell cell = new DpCell();
                        int nLevel = GetLevel(strControlKey, strKey);
                        Debug.Assert(nLevel <= strControlKey.Length && nLevel <= strKey.Length, "");
                        cell.Text = nLevel.ToString();
                        row.Add(cell);
                    }

                    this.dpTable1.Rows.Add(row);
                }
            }

            this.dpTable1.Rows.Sort(CompareEntrys);

            // 如果 control 还没有初始化过 hitcounts,则初始化一次
            if (control.HitCounts.Count == 0)
                control.HitCounts = BuildHitCountList(strControlKey);

            // 选定特定行
            if (info.SelectedLines != null && info.SelectedLines.Count > 0)
            {
                foreach (string line in info.SelectedLines)
                {
                    SelectRowByKey(line);
                }
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }