Exemplo n.º 1
0
        /// <summary>
        /// 装载XML
        /// </summary>
        public virtual int RetrieveAll()
        {
            this.Clear();      // 清所有的信息。
            XmlEns ens = null; // BP.DA.Cash.GetObj(this.ToString(), Depositary.Application) as XmlEns;

            if (ens != null)
            {
                foreach (XmlEn en in ens)
                {
                    this.Add(en);
                }
                return(ens.Count);
            }

            // 从内存中找。
            DataTable dt = this.GetTable();

            foreach (DataRow dr in dt.Rows)
            {
                XmlEn en = this.GetNewEntity;
                en.Row = new Row(dt, dr);
                this.Add(en);
            }

            // BP.DA.Cash.AddObj(this.ToString(), Depositary.Application, this);
            return(dt.Rows.Count);
        }
Exemplo n.º 2
0
        public int RetrieveByPK(string key, string val)
        {
            XmlEns ens = null; // Cash.GetObj(this.GetNewEntities.ToString(), Depositary.Application) as XmlEns;

            if (ens == null)
            {
                ens = this.GetNewEntities;
                ens.RetrieveAll();
            }

            int i = 0;

            foreach (XmlEn en in ens)
            {
                if (en.GetValStringByKey(key) == val)
                {
                    this.Row = en.Row;
                    i++;
                }
            }
            if (i == 1)
            {
                return(1);
            }

            if (i > 1)
            {
                // BP.SystemConfig.DoClearCash();
                throw new Exception("@XML = " + this.ToString() + " 中 PK=" + val + "不唯一。。。。");
            }
            return(0);
        }
Exemplo n.º 3
0
        public int Retrieve(string key, string val, string key1, string val1)
        {
            XmlEns ens = Cash.GetObj(this.GetNewEntities.ToString(), Depositary.Application) as XmlEns;

            if (ens == null)
            {
                ens = this.GetNewEntities;
                ens.RetrieveAll();
            }

            int i = 0;

            foreach (XmlEn en in ens)
            {
                if (en.GetValStringByKey(key) == val && en.GetValStringByKey(key1) == val1)
                {
                    this.Row = en.Row;
                    i++;
                }
            }
            if (i == 1)
            {
                return(1);
            }

            return(0);
        }
Exemplo n.º 4
0
        public virtual int Add(XmlEns ens)
        {
            if (ens == null)
            {
                return(0);
            }

            foreach (XmlEn en in ens)
            {
                this.InnerList.Add(en);
            }
            return(ens.Count);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 指定属性查询
        /// </summary>
        /// <param name="key">属性值</param>
        /// <param name="val">属性</param>
        public int RetrieveBy_del(string key, string val)
        {
            XmlEns ens = this.GetNewEntities;

            ens.RetrieveAll();

            ens.RetrieveBy(key, val);
            if (ens.Count == 0)
            {
                return(0);
            }

            this.Row = ens[0].Row;
            return(ens.Count);
        }