/// <summary> /// Create a new APRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Column Title.</param> protected APRptColumn(APSqlOperateExpr selectExpr, string id, string title) { _selectExpr = selectExpr; if (selectExpr is APSqlColumnExpr) { var column = (selectExpr as APSqlColumnExpr).ColumnDef; _id = String.IsNullOrEmpty(id) ? column.SelectExpr : id; _title = String.IsNullOrEmpty(title) ? column.Display : title; _dataName = column.ColumnName; _required = column.Required; _isNullable = column.IsNullable; } else { var paramName = (selectExpr as APSqlOperateExpr).ParamName; _id = String.IsNullOrEmpty(id) ? paramName : id; _title = String.IsNullOrEmpty(title) ? paramName : title; _dataName = paramName; _required = false; _isNullable = true; } }
/// <summary> /// Create a new DecimalAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="scale">Scale.</param> /// <param name="minValue">The min value.</param> /// <param name="maxValue">The max value.</param> public DecimalAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int scale, Decimal minValue = Decimal.MinValue, Decimal maxValue = Decimal.MaxValue) : base(selectExpr, id, title) { _minValue = minValue; _maxValue = maxValue; _scale = scale; }
/// <summary> /// Create a new condition phrase. /// </summary> /// <param name="expr">SQL Expression.</param> /// <param name="conditionOperator">Condition operator.</param> /// <param name="value">Value.</param> /// <param name="paramName">Parameter name.</param> public APSqlConditionPhrase(APSqlOperateExpr expr, APSqlConditionOperator conditionOperator, object value, string paramName) { if (Object.Equals(expr, null)) { throw new ArgumentNullException("columnDef"); } if (conditionOperator == APSqlConditionOperator.Exists || conditionOperator == APSqlConditionOperator.NotExists) { throw new ArgumentException(APResource.APDB_OperatorExists, "conditionOperator"); } _expr = expr; _paramName = paramName; if (String.IsNullOrEmpty(paramName)) { _paramName = expr.ParamName; } if (value is String) { value = APSqlExpr.TryFitStringToRawExpr((string)value); } _value = value; _conditionOperator = conditionOperator; }
/// <summary> /// Create a new condition phrase. /// </summary> /// <param name="relationDef">Relation definition.</param> public APSqlConditionPhrase(APRelationDef relationDef) { if (relationDef == null) throw new ArgumentNullException("relationDef"); _expr = new APSqlColumnExpr(relationDef.Master); _conditionOperator = APSqlConditionOperator.Equals; _value = new APSqlColumnExpr(relationDef.Slave); }
/// <summary> /// Create a new 'SELECT' phrase. /// </summary> /// <param name="expr">SQL 'SELECT' Expression.</param> /// <param name="alias">Alias.</param> public APSqlSelectPhrase(APSqlOperateExpr expr, string alias) { if (Object.Equals(expr, null)) throw new ArgumentNullException("expr"); _expr = expr; _alias = alias; }
/// <summary> /// Create a new condition phrase. /// </summary> /// <param name="relationDef">Relation definition.</param> public APSqlConditionPhrase(APRelationDef relationDef) { if (relationDef == null) { throw new ArgumentNullException("relationDef"); } _expr = new APSqlColumnExpr(relationDef.Master); _conditionOperator = APSqlConditionOperator.Equals; _value = new APSqlColumnExpr(relationDef.Slave); }
/// <summary> /// Create a new 'SELECT' phrase. /// </summary> /// <param name="expr">SQL 'SELECT' Expression.</param> /// <param name="alias">Alias.</param> public APSqlSelectPhrase(APSqlOperateExpr expr, string alias) { if (Object.Equals(expr, null)) { throw new ArgumentNullException("expr"); } _expr = expr; _alias = alias; }
/// <summary> /// Create a new LookupAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="joinTable">Join Table.</param> /// <param name="joinType">Join Type.</param> /// <param name="relationDef">Relation define.</param> /// <param name="relationShowColumn">Show relation column.</param> public LookupAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, APTableDef joinTable, APSqlJoinType joinType, APRelationDef relationDef, APRptColumn relationShowColumn) : base(selectExpr, id, title) { _joinTable = joinTable; _joinType = joinType; _relationDef = relationDef; _relationShowColumn = relationShowColumn; }
/// <summary> /// Create a new condition phrase where sub query when use '[NOT] EXISTS' /// </summary> /// <param name="subQuery">Sub Query.</param> /// <param name="conditionOperator">'EXISTS' or 'NOT EXISTS'</param> public APSqlConditionPhrase(APSqlSelectCommand subQuery, APSqlConditionOperator conditionOperator) { if (subQuery == null) { throw new ArgumentNullException("subQuery"); } if (conditionOperator != APSqlConditionOperator.Exists && conditionOperator != APSqlConditionOperator.NotExists) { throw new ArgumentException(APResource.APDB_OperatorExists, "conditionOperator"); } _expr = null; _conditionOperator = conditionOperator; _value = subQuery; }
/// <summary> /// Determines whether two Object instances are equal. /// </summary> /// <param name="obj">The Object to compare with the current Object.</param> /// <returns>true if the specified Object is equal to the current Object; otherwise, false.</returns> public override bool Equals(object obj) { if (obj == null) { return(false); } APSqlOperateExpr other = obj as APSqlOperateExpr; if (!Object.ReferenceEquals(other, null)) { return(SelectExpr == other.SelectExpr); } return(false); }
/// <summary> /// Create a new condition phrase. /// </summary> /// <param name="expr">SQL Expression.</param> /// <param name="conditionOperator">Condition operator.</param> /// <param name="value">Value.</param> /// <param name="paramName">Parameter name.</param> public APSqlConditionPhrase(APSqlOperateExpr expr, APSqlConditionOperator conditionOperator, object value, string paramName) { if (Object.Equals(expr, null)) throw new ArgumentNullException("columnDef"); if (conditionOperator == APSqlConditionOperator.Exists || conditionOperator == APSqlConditionOperator.NotExists) throw new ArgumentException(APResource.APDB_OperatorExists, "conditionOperator"); _expr = expr; _paramName = paramName; if (String.IsNullOrEmpty(paramName)) { _paramName = expr.ParamName; } if (value is String) value = APSqlExpr.TryFitStringToRawExpr((string)value); _value = value; _conditionOperator = conditionOperator; }
/// <summary> /// Create a new DateTimeAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dateTimeType">DateTime type.</param> /// <param name="minValue">The min value.</param> /// <param name="maxValue">The max value.</param> public DateTimeAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, APRptDateTimeType dateTimeType, DateTime minValue, DateTime maxValue) : base(selectExpr, id, title) { _dateTimeType = dateTimeType; _minValue = minValue; _maxValue = maxValue; }
/// <summary> /// Create a new SingleAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="minValue">The min value.</param> /// <param name="maxValue">The max value.</param> public SingleAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, Single minValue = Single.MinValue, Single maxValue = Single.MaxValue) : base(selectExpr, id, title) { _minValue = minValue; _maxValue = maxValue; }
/// <summary> /// Create a new EmailAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dataLength">Data Length</param> public EmailAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int dataLength = 320) : base(selectExpr, id, title, dataLength, RegexAPRptColumn.RegexEmail, "") { }
/// <summary> /// Create a new Int32APRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="minValue">The min value.</param> /// <param name="maxValue">The max value.</param> public Int32APRptColumn(APSqlOperateExpr selectExpr, string id, string title, Int32 minValue = Int32.MinValue, Int32 maxValue = Int32.MaxValue) : base(selectExpr, id, title) { _minValue = minValue; _maxValue = maxValue; }
/// <summary> /// Create a new MultiLineTextAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dataLength">Data length.</param> public MultiLineTextAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int dataLength) : base(selectExpr, id, title, dataLength) { }
/// <summary> /// Create a new UrlAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dataLength">Data Length</param> public UrlAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int dataLength = 2048) : base(selectExpr, id, title, dataLength, RegexAPRptColumn.RegexUrl, "") { }
/// <summary> /// Create a new condition phrase where sub query when use 'ANY | SOME | ALL'. /// </summary> /// <param name="expr">SQL Expression.</param> /// <param name="conditionOperator">Condition operator.</param> /// <param name="subQuery">Sub Query.</param> /// <param name="subQueryScalarRestrict">Sub query scalar restrict.</param> public APSqlConditionPhrase(APSqlOperateExpr expr, APSqlConditionOperator conditionOperator, APSqlSelectCommand subQuery, APSqlSubQueryScalarRestrict subQueryScalarRestrict) : this(expr, conditionOperator, subQuery, null) { _subQueryScalarRestrict = subQueryScalarRestrict; }
/// <summary> /// Create a new condition phrase. /// </summary> /// <param name="expr">SQL Expression.</param> /// <param name="conditionOperator">Condition operator.</param> /// <param name="value">Value.</param> public APSqlConditionPhrase(APSqlOperateExpr expr, APSqlConditionOperator conditionOperator, object value) : this(expr, conditionOperator, value, null) { }
/// <summary> /// Create a new UInt16APRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="minValue">The min value.</param> /// <param name="maxValue">The max value.</param> public UInt16APRptColumn(APSqlOperateExpr selectExpr, string id, string title, UInt16 minValue = UInt16.MinValue, UInt16 maxValue = UInt16.MaxValue) : base(selectExpr, id, title) { _minValue = minValue; _maxValue = maxValue; }
/// <summary> /// Create a new TextAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dataLength">Data length.</param> public TextAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int dataLength) : base(selectExpr, id, title) { _dataLength = dataLength; }
/// <summary> /// Create a new condition phrase where sub query when use '[NOT] EXISTS' /// </summary> /// <param name="subQuery">Sub Query.</param> /// <param name="conditionOperator">'EXISTS' or 'NOT EXISTS'</param> public APSqlConditionPhrase(APSqlSelectCommand subQuery, APSqlConditionOperator conditionOperator) { if (subQuery == null) throw new ArgumentNullException("subQuery"); if (conditionOperator != APSqlConditionOperator.Exists && conditionOperator != APSqlConditionOperator.NotExists) throw new ArgumentException(APResource.APDB_OperatorExists, "conditionOperator"); _expr = null; _conditionOperator = conditionOperator; _value = subQuery; }
/// <summary> /// Create a new RegexAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dataLength">Data length.</param> /// <param name="pattern">Pattern of Regex.</param> /// <param name="message">Invalidated message.</param> public RegexAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int dataLength, string pattern, string message) : base(selectExpr, id, title, dataLength) { _pattern = pattern; _message = message; }
/// <summary> /// Create a new NumberAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> public NumberAPRptColumn(APSqlOperateExpr selectExpr, string id, string title) : base(selectExpr, id, title) { }
/// <summary> /// Create a new DateTimeAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="dateTimeType">DateTime type.</param> public DateTimeAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, APRptDateTimeType dateTimeType) : this(selectExpr, id, title, dateTimeType, DateTime.MinValue, DateTime.MaxValue) { _dateTimeType = dateTimeType; }
/// <summary> /// Create a new CurrencyAPRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> /// <param name="id">Column unique ID.</param> /// <param name="title">Title.</param> /// <param name="scale">Scale.</param> /// <param name="minValue">The min value.</param> /// <param name="maxValue">The max value.</param> public CurrencyAPRptColumn(APSqlOperateExpr selectExpr, string id, string title, int scale = 2, Decimal minValue = Decimal.MinValue, Decimal maxValue = Decimal.MaxValue) : base(selectExpr, id, title, scale, minValue, maxValue) { }
/// <summary> /// Create a new APRptColumn. /// </summary> /// <param name="selectExpr">SQL 'SELECT' Expression.</param> protected APRptColumn(APSqlOperateExpr selectExpr) : this(selectExpr, null, null) { }