Esempio n. 1
0
        /// <summary>
        /// 装载XML
        /// </summary>
        public virtual int RetrieveAll()
        {
            this.Clear(); // 清所有的信息。
            XmlEns ens = 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();
                en.Row.LoadDataTable(dt, dr);
                this.Add(en);
            }

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

            if (ens == null)
            {
                ens = this.GetNewEntities;
                ens.RetrieveAll();
                //Cash.SetConn(this.GetNewEntities.ToString(), Depositary.Application) as XmlEns;
            }

            int i = 0;

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

            if (i > 1)
            {
                // BP.Sys.SystemConfig.DoClearCash();
                throw new Exception("@XML=[" + this.ToString() + "]中PK=" + val + "不唯一...");
            }
            return(0);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 5
0
        public override void Do()
        {
            ArrayList al = BP.En.ClassFactory.GetObjects("BP.Sys.XML.XmlEns");

            foreach (object obj in al)
            {
                XmlEns en = (XmlEns)obj;
                if (en.RefEns == null)
                {
                    continue;
                }

                en.FillXmlDataIntoEntities(en.RefEns);
            }
        }