Esempio n. 1
0
        /// <summary>
        /// 按 No 查询。
        /// </summary>
        /// <returns></returns>
        public int RetrieveByNo()
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhere(EntityNoAttr.No, this.No);
            return(qo.DoQuery());
        }
Esempio n. 2
0
        /// <summary>
        /// 按语言查询。
        /// </summary>
        public void RetrieveByLanguageNo(string LanguageNo)
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhere("LanguageNo", LanguageNo);
            qo.DoQuery();
        }
Esempio n. 3
0
        /// <summary>
        /// 按照名称查询。
        /// </summary>
        /// <returns>返回查询出来的个数</returns>
        public int RetrieveByName()
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhere("Name", this.Name);
            return(qo.DoQuery());
        }
Esempio n. 4
0
        /// <summary>
        /// 按照名称模糊查询
        /// </summary>
        /// <param name="likeName">likeName</param>
        /// <returns>返回查询的Num</returns>
        public int RetrieveByLikeName(string likeName)
        {
            QueryObject qo = new QueryObject(this);

            qo.AddWhere("Name", "like", " %" + likeName + "% ");
            return(qo.DoQuery());
        }
Esempio n. 5
0
        /// <summary>
        /// 提供通过一个实体的 val 查询另外的实体集合。
        /// </summary>
        /// <param name="attr">属性</param>
        /// <param name="val">植</param>
        /// <param name="refEns">关联的集合</param>
        /// <returns>关联的集合</returns>
        protected Entities throwOneKeyValGetRefEntities(string attr, string val, Entities refEns)
        {
            QueryObject qo = new QueryObject(refEns);

            qo.AddWhere(attr, val);
            return(refEns);
        }
Esempio n. 6
0
        /// <summary>
        /// 根据MID构造实体
        /// </summary>
        /// <param name="MID">MID</param>
        protected EntityMID(int mid)
        {
            this.SetValByKey(EntityMIDAttr.MID, MID);
            QueryObject qo = new QueryObject(this);

            qo.AddWhere(EntityMIDAttr.MID, mid);
            if (qo.DoQuery() == 0)
            {
                throw new Exception("没有查询到MID=" + mid + "的实例。");
            }
            //this.Retrieve();
        }
Esempio n. 7
0
 public override int Retrieve()
 {
     if (this.MID == 0)
     {
         return(base.Retrieve());
     }
     else
     {
         QueryObject qo = new QueryObject(this);
         qo.AddWhere("MID", this.MID);
         if (qo.DoQuery() == 0)
         {
             throw new Exception("没有此记录:MID=" + this.MID);
         }
         else
         {
             return(1);
         }
     }
 }