コード例 #1
0
ファイル: PageInventory.xaml.cs プロジェクト: zgren/dp2
        // 首次初始化 Entity 列表
        async Task <NormalResult> InitialEntitiesAsync()
        {
            App.Invoke(new Action(() =>
            {
                _entities.Clear();  // 2019/9/4
            }));

            foreach (var tag in NewTagList.Tags)
            {
                ProcessTag(null, tag);
            }

            return(new NormalResult());
        }
コード例 #2
0
        // SetBorrowed("") 可以清除列表
        public void SetBorrowed(string patron_xml)
        {
            _borrowedEntities.Clear();

            if (string.IsNullOrEmpty(patron_xml) == false)
            {
                XmlDocument dom = new XmlDocument();
                dom.LoadXml(patron_xml);

                // 用 hashtable 保存一下每个 entity 的原始序
                // Hashtable originIndexTable = new Hashtable();
                int i = 0;  // 插入位置

                // List<Entity> entities = new List<Entity>();
                XmlNodeList borrows = dom.DocumentElement.SelectNodes("borrows/borrow");
                foreach (XmlElement borrow in borrows)
                {
                    string barcode  = borrow.GetAttribute("barcode");
                    string oi       = borrow.GetAttribute("oi");
                    string overflow = borrow.GetAttribute("overflow");

                    // 2020/7/26
                    string borrowInfo = null;
                    {
                        string borrowDate    = borrow.GetAttribute("borrowDate");
                        string returningDate = borrow.GetAttribute("returningDate");
                        string period        = borrow.GetAttribute("borrowPeriod");
                        if (string.IsNullOrEmpty(borrowDate))
                        {
                            borrowInfo = null;
                        }
                        else
                        {
                            borrowInfo = $"借书日期:\t{Entity.ToDate(borrowDate)}\n期限:\t\t{period}\n应还日期:\t{Entity.ToDate(returningDate)}";
                        }
                    }

                    var new_entity = new Entity
                    {
                        PII        = barcode,
                        OI         = oi, // 2020/9/8
                        Container  = _borrowedEntities,
                        BorrowInfo = borrowInfo
                    };
                    // 2020/4/17 不用排序,在添加时临时决定是插入到前部还是追加
                    if (IsState(new_entity, "overflow") == true ||
                        string.IsNullOrEmpty(overflow) == false)
                    {
                        SetState(new_entity, "overflow");
                        _borrowedEntities.Insert(i++, new_entity);
                    }
                    else
                    {
                        _borrowedEntities.Add(new_entity);
                    }
                }
            }
        }
コード例 #3
0
        public void SetBorrowed(string patron_xml)
        {
            _borrowedEntities.Clear();

            XmlDocument dom = new XmlDocument();

            dom.LoadXml(patron_xml);

            XmlNodeList borrows = dom.DocumentElement.SelectNodes("borrows/borrow");

            foreach (XmlElement borrow in borrows)
            {
                string barcode = borrow.GetAttribute("barcode");
                _borrowedEntities.Add(new Entity {
                    PII = barcode, Container = _borrowedEntities
                });
            }
        }
コード例 #4
0
        // SetBorrowed("") 可以清除列表
        public void SetBorrowed(string patron_xml)
        {
            _borrowedEntities.Clear();

            if (string.IsNullOrEmpty(patron_xml) == false)
            {
                XmlDocument dom = new XmlDocument();
                dom.LoadXml(patron_xml);

                // 用 hashtable 保存一下每个 entity 的原始序
                // Hashtable originIndexTable = new Hashtable();
                int i = 0;  // 插入位置

                // List<Entity> entities = new List<Entity>();
                XmlNodeList borrows = dom.DocumentElement.SelectNodes("borrows/borrow");
                foreach (XmlElement borrow in borrows)
                {
                    string barcode  = borrow.GetAttribute("barcode");
                    string overflow = borrow.GetAttribute("overflow");

                    var new_entity = new Entity {
                        PII = barcode, Container = _borrowedEntities
                    };
                    // 2020/4/17 不用排序,在添加时临时决定是插入到前部还是追加
                    if (IsState(new_entity, "overflow") == true ||
                        string.IsNullOrEmpty(overflow) == false)
                    {
                        SetState(new_entity, "overflow");
                        _borrowedEntities.Insert(i++, new_entity);
                    }
                    else
                    {
                        _borrowedEntities.Add(new_entity);
                    }
                }
            }
        }