Esempio n. 1
0
        private void dpTable1_PaintRegion(object sender, DigitalPlatform.CommonControl.PaintRegionArgs e)
        {
            if (e.Action == "query")
            {
                e.Height = BAR_HEIGHT + TOP_BLANK;
                DpCell cell = e.Item as DpCell;
                DpRow  row  = cell.Container;

                int index = this.dpTable1.Rows.IndexOf(row);
                if (index == -1)
                {
                    Debug.Assert(false, "");
                    return;
                }

                if (index >= this.PatronSummaries.Count)
                {
                    Debug.Assert(false, "");
                    return;
                }

                PatronSummary summary = this.PatronSummaries[index];
                if (summary != null)
                {
                    cell.Tag = summary;
                }
                return;
            }


            // paint
            {
                DpCell cell = e.Item as DpCell;
                if (cell == null)
                {
                    Debug.Assert(false, "");
                    return;
                }
                PatronSummary summary = cell.Tag as PatronSummary;
                if (summary == null)
                {
                    Debug.Assert(false, "");
                    return;
                }

                ColorSummaryControl.DoPaint(e.pe.Graphics,
                                            e.X,
                                            e.Y + TOP_BLANK,
                                            new Size(e.Width, e.Height - TOP_BLANK),
                                            summary.ColorList);
            }
        }
Esempio n. 2
0
        // 创建读者摘要
        internal List<PatronSummary> BuildPatronSummary(ChargingTask exclude_task)
        {
            List<PatronSummary> results = new List<PatronSummary>();
            PatronSummary current_summary = null;
            foreach (DpRow row in this.dpTable_tasks.Rows)
            {
                ChargingTask task = (ChargingTask)row.Tag;
                if (task == null)
                    continue;
                if (task == exclude_task)
                    continue;

                if (task.Action == "load_reader_info")
                {
                    // 为前一个读者
                    if (current_summary != null)
                        current_summary.RefreshColorList();

                    current_summary = new PatronSummary();
                    current_summary.Name = task.ReaderName;
                    current_summary.Barcode = task.ReaderBarcode;
                    current_summary.Tasks.Add(task);
                    results.Add(current_summary);

                    continue;
                }

                if (current_summary != null)
                    current_summary.Tasks.Add(task);
            }

            if (current_summary != null)
                current_summary.RefreshColorList();
            return results;
        }