Exemple #1
0
        /// <summary>
        ///		“=”比较指定值与指定属性
        /// </summary>
        /// <param name="attributeName">比较的属性</param>
        /// <param name="attributeValue">指定值</param>
        public void AddEqualTo(string attributeName, object attributeValue)
        {
            SelectionCriteria criteria;

            criteria = new SelectionCriteria(SelectionTypes.EqualTo,
                                             this._classMap.GetAttributeMap(attributeName, true), attributeValue, this._classMap);
            this.parameters.Add(criteria);
        }
Exemple #2
0
 //Return select sql statment for association
 public IDbCommand GetSelectSqlFor(SelectionCriteria aSelectionCriteria)
 {
     if (select == null)
     {
         this.select = new SelectCommander(this);
     }
     return(this.select.BuildForSelectionCriteria(aSelectionCriteria));
 }
Exemple #3
0
        /// <summary>
        ///		与给定的列表list里的值不匹配
        /// </summary>
        /// <param name="attributeName">属性</param>
        /// <param name="list">值列表</param>
        public void AddNotIn(string attributeName, object[] list)
        {
            if (list == null || list.Length == 0)
            {
                throw new PlException("传入的list长度不能为0!");
            }
            SelectionCriteria selection = new SelectionCriteria(SelectionTypes.NotIn,
                                                                this._classMap.GetAttributeMap(attributeName, true), list, _classMap);

            this.parameters.Add(selection);
        }
Exemple #4
0
        /// <summary>
        /// ">"比较第一个字段是否大于第二个字段
        /// </summary>
        /// <param name="attributeName">第一个字段名称</param>
        /// <param name="attributeName2">第二个字段名称</param>
        public void AddGreaterThanField(string attributeName, string attributeName2)
        {
            if (attributeName2 == null)
            {
                throw new PlException(NO_FIELD);
            }
            SelectionCriteria criteria;

            criteria = new SelectionCriteria(SelectionTypes.GreaterThan,
                                             this._classMap.GetAttributeMap(attributeName, true), this._classMap.GetAttributeMap(attributeName2, true), _classMap);
            this.parameters.Add(criteria);
        }
Exemple #5
0
        /// <summary>
        ///		“>”比较指定值与指定属性
        /// </summary>
        /// <param name="attributeName">比较的属性</param>
        /// <param name="attributeValue">指定值</param>
        public void AddGreaterThan(string attributeName, object attributeValue)
        {
            if (attributeValue == null)
            {
                throw new PlException(NO_NULLl);
            }
            SelectionCriteria criteria;

            criteria = new SelectionCriteria(SelectionTypes.GreaterThan,
                                             this._classMap.GetAttributeMap(attributeName, true), attributeValue, _classMap);
            this.parameters.Add(criteria);
        }
Exemple #6
0
        /// <summary>
        ///		指定子字符串与指定属匹配
        /// </summary>
        /// <param name="attributeName">属性</param>
        /// <param name="attributeValue">指定字符串</param>
        public void AddMatch(string attributeName, string attributeValue)
        {
            if (attributeValue == null)
            {
                throw new PlException(NO_NULLl);
            }
            SelectionCriteria criteria;

            attributeValue = "%" + attributeValue + "%";
            criteria       = new SelectionCriteria(SelectionTypes.Match,
                                                   this._classMap.GetAttributeMap(attributeName, true), attributeValue, _classMap);
            this.parameters.Add(criteria);
        }
Exemple #7
0
        public IDbCommand BuildForSelectionCriteria(SelectionCriteria aSelectionCriteria)
        {
            string partOfCriteria = " WHERE 1=1 ";

            if (this.clsMap.SuperClass != null)
            {
                partOfCriteria += " AND " + _stringForInherit;
            }
            partOfCriteria += " AND " + aSelectionCriteria.AsSqlClause();
            IDbCommand cmd = clsMap.RelationalDatabase.GetCommand();

            cmd.CommandText = this._selecFromClause + partOfCriteria;
            return(cmd);
        }