/// <summary> /// Constructor /// </summary> /// <param name="onPath">Role path in case that the attribute is from another class</param> /// <param name="facet">Name of the class that has the attribute to be fixed in SQL sentence</param> /// <param name="attribute">Name of the attribute that is needed to the sort</param> /// <param name="type">Direction of the order. Could be ascending o descending</param> public ONOrderCriteriaItem(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type) { OnPath = onPath; Facet = facet; Attribute = attribute; Type = type; }
/// <summary> /// Constructor /// </summary> /// <param name="onPath">Role path in case that the attribute is from another class</param> /// <param name="facet">Name of the class that has the attribute to be fixed in SQL sentence</param> /// <param name="attribute">Name of the attribute that is needed to the sort</param> /// <param name="type">Direction of the order. Could be ascending o descending</param> public ONOrderCriteriaItem(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type) { OnPath = onPath; Facet = facet; Attribute = attribute; Type = type; }
/// <summary> /// Add OrderBy fields /// </summary> /// <param name="alias">Table alias name</param> /// <param name="field">Field name</param> /// <param name="orderByType">Asc/Des order type</param> /// <param name="val">Bound value</param> public void AddOrderBy(string alias, string field, OrderByTypeEnumerator orderByType, ONSimpleType val) { // Compose alias StringBuilder lFieldBuilder = new StringBuilder(); if (alias != "") { lFieldBuilder.Append(alias); lFieldBuilder.Append("."); lFieldBuilder.Append(field); } else { lFieldBuilder.Append(field); } // Add OrderBy if (orderByType == OrderByTypeEnumerator.Des) { mOrderBy.Add(lFieldBuilder.ToString() + " DESC"); } else { mOrderBy.Add(lFieldBuilder.ToString()); } // Without StartRow if (val == null) { return; } // Extract previous OrderBy StringBuilder lDisjuntionBuilder = new StringBuilder(); if (mOrderByDisjuntion.Count > 0) // Not first StartRow { lDisjuntionBuilder.Append(mOrderByDisjuntion[mOrderByDisjuntion.Count - 1]); lDisjuntionBuilder.Append(" AND "); mOrderByDisjuntion.RemoveAt(mOrderByDisjuntion.Count - 1); } // Add Field lDisjuntionBuilder.Append(lFieldBuilder); // Add StartRow if (orderByType == OrderByTypeEnumerator.Des) { mOrderByDisjuntion.Add(lDisjuntionBuilder.ToString() + " < ?"); AddOrderByParameter(val); } else { mOrderByDisjuntion.Add(lDisjuntionBuilder.ToString() + " > ?"); AddOrderByParameter(val); } mOrderByDisjuntion.Add(lDisjuntionBuilder.ToString() + " = ?"); }
public ONOrderCriteriaItem(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type, string domainArgument) { OnPath = onPath; Facet = facet; Attribute = attribute; Type = type; DomainArgument = domainArgument; }
public void AddSqlAttribute(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type, string domainArgument) { foreach (ONOrderCriteriaItem lOCItem in OrderCriteriaSqlItem) if ((lOCItem.OnPath == onPath) && (lOCItem.Attribute == attribute)) return; OrderCriteriaSqlItem.Add(new ONOrderCriteriaItem(onPath, facet, attribute, type, domainArgument)); }
public ONOrderCriteriaItem(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type, string domainArgument) { OnPath = onPath; Facet = facet; Attribute = attribute; Type = type; DomainArgument = domainArgument; }
public void AddSqlAttribute(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type, string domainArgument) { foreach (ONOrderCriteriaItem lOCItem in OrderCriteriaSqlItem) { if ((lOCItem.OnPath == onPath) && (lOCItem.Attribute == attribute)) { return; } } OrderCriteriaSqlItem.Add(new ONOrderCriteriaItem(onPath, facet, attribute, type, domainArgument)); }
/// <summary> /// Construction the part of SQL sentence that is Oder By /// </summary> /// <param name="onPath">Role path in case that the attribute is from another class</param> /// <param name="facet">Name of the class that has the attribute to be fixed in SQL sentence</param> /// <param name="attribute">Name of the attribute that is needed to the sort</param> /// <param name="type">Direction of the order. Could be ascending o descending</param> public void AddSqlAttribute(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type) { AddSqlAttribute(onPath, facet, attribute, type, ""); }
/// <summary> /// Add OrderBy fields /// </summary> /// <param name="alias">Table alias name</param> /// <param name="field">Field name</param> /// <param name="orderByType">Asc/Des order type</param> /// <param name="val">Bound value</param> public void AddOrderBy(string alias, string field, OrderByTypeEnumerator orderByType, ONSimpleType val) { // Compose alias StringBuilder lFieldBuilder = new StringBuilder(); if (alias != "") { lFieldBuilder.Append(alias); lFieldBuilder.Append("."); lFieldBuilder.Append(field); } else lFieldBuilder.Append(field); // Add OrderBy if (orderByType == OrderByTypeEnumerator.Des) mOrderBy.Add(lFieldBuilder.ToString() + " DESC"); else mOrderBy.Add(lFieldBuilder.ToString()); // Without StartRow if (val == null) return; // Extract previous OrderBy StringBuilder lDisjuntionBuilder = new StringBuilder(); if (mOrderByDisjuntion.Count > 0) // Not first StartRow { lDisjuntionBuilder.Append(mOrderByDisjuntion[mOrderByDisjuntion.Count - 1]); lDisjuntionBuilder.Append(" AND "); mOrderByDisjuntion.RemoveAt(mOrderByDisjuntion.Count - 1); } // Add Field lDisjuntionBuilder.Append(lFieldBuilder); // Add StartRow if (orderByType == OrderByTypeEnumerator.Des) { mOrderByDisjuntion.Add(lDisjuntionBuilder.ToString() + " < ?"); AddOrderByParameter(val); } else { mOrderByDisjuntion.Add(lDisjuntionBuilder.ToString() + " > ?"); AddOrderByParameter(val); } mOrderByDisjuntion.Add(lDisjuntionBuilder.ToString() + " = ?"); }
/// <summary> /// Construction the part of SQL sentence that is Oder By /// </summary> /// <param name="onPath">Role path in case that the attribute is from another class</param> /// <param name="facet">Name of the class that has the attribute to be fixed in SQL sentence</param> /// <param name="attribute">Name of the attribute that is needed to the sort</param> /// <param name="type">Direction of the order. Could be ascending o descending</param> public void AddSqlAttribute(ONPath onPath, string facet, string attribute, OrderByTypeEnumerator type) { AddSqlAttribute(onPath, facet, attribute, type, ""); }