TdoInt16.cs :  » Database » TDO » Tdo » Common » TdoTypes » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Database » TDO 
TDO » Tdo » Common » TdoTypes » TdoInt16.cs
using System;
using System.Xml;
using System.Xml.Serialization;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Diagnostics;
using System.Runtime;
using System.Runtime.Serialization;
using Tdo;
using Tdo.Common;
using Tdo.Common.Entities;
using Tdo.Common.Entities.Tables;
using Tdo.Common.Entities.Views;
using Tdo.Common.Helper;
using Tdo.Common.TdoSqlExpressionDom;
using Tdo.Common.TdoTypes;

namespace Tdo.Common.TdoTypes{
  /// <summary>
  /// TdoInt16 class. Allows to keep SqlInt16 values type
  /// </summary>
  [CLSCompliant(true)]
  [Serializable()]
  public sealed class TdoInt16 : TdoTypeBase<SqlInt16>, ITdoExactNumericColumn
  {
    #region Constructors
    /// <summary>
    /// Default constructor for TdoInt16 Class
    /// </summary>
    public TdoInt16()
    {
            this.actualValue = SqlInt16.Null;
    }
    /// <summary>
    /// Constructor for TdoInt16 Class.
    /// </summary>
    /// <param name="value">Column constant value</param>
    /// <param name="columnAlias">Alias column.</param>
    public TdoInt16(SqlInt16 value, string columnAlias)
    {
      this.Caption = this.ColumnName = columnAlias;
            this.actualValue = TdoInt16.ClonedValue(value);
      this.IsConstant = true;
    }
    /// <summary>
    /// Constructor for TdoInt16 class
    /// </summary>
    /// <param name="allowDBNull">Boolean that indicates wether the field can be NULL</param>
    /// <param name="autoIncrement">Boolean that indicates if the field is IDENTITY (auto-increase)</param>
    /// <param name="autoIncrementSeed">Long that indicates how much is increasing the IDENTITY field</param>
    /// <param name="autoIncrementStep">Long that indicates the start actualValue of the IDENTITY field </param>
    /// <param name="caption">String that indicates the heading/columnAlias of the field</param>
    /// <param name="columnName">String that indicates the name of the column (field)</param>
    /// <param name="maxLength">Integer that indicates the maximum length of the field (-1,field without limit)</param>
    /// <param name="readOnly">Boolean that indicates if the field is only reading</param>
    /// <param name="unique">Boolean that indicates if a unique constraint exists on that field</param>
    /// <param name="tdoEntity">TdoEntity referenced to the class that contains the field</param>
    public TdoInt16(bool allowDBNull, bool autoIncrement, long autoIncrementSeed,
      long autoIncrementStep, string caption, string columnName,
      int maxLength, bool readOnly,
      bool unique, ITdoEntity tdoEntity)
      :
      base(allowDBNull, autoIncrement, autoIncrementSeed,
      autoIncrementStep, caption, columnName, maxLength,
      readOnly,
      unique, tdoEntity)
    {
            this.actualValue = SqlInt16.Null;
    }
    #endregion Constructors
    #region Properties
    /// <summary>
    /// Get or Set Value property of Object type
    /// </summary>
    [XmlIgnore]
    public override object ObjectValue
    {
      get
      {
        return this.actualValue;
      }
      set
      {
        if (value != null && value != DBNull.Value)
                    this.actualValue = new SqlInt16((Int16)value);
        else
                    this.actualValue = SqlInt16.Null;
                this.pModified = !this.ReadOnly;
      }
    }
    /// <summary>
    /// System.Data.SqlDbType of ITdoColumn
    /// </summary>
    [XmlAttribute()]
    public override SqlDbType SqlDbType
    {
      get
      {
        return System.Data.SqlDbType.SmallInt;
      }
    }
    #endregion Properties
    #region Methods
    /// <summary>
    /// Comparison operator Equals
    /// </summary>
    /// <param name="obj">Object to compare</param>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
    public override bool Equals(object obj)
    {
      return base.Equals(obj);
    }
    /// <summary>
    /// Returns Hash code
    /// </summary>
    public override int GetHashCode()
    {
      return base.GetHashCode();
    }
    internal override SqlInt16 ClonedValue(bool actualValue)
    {
      return (actualValue ? TdoInt16.ClonedValue(this.actualValue) : TdoInt16.ClonedValue(this.oldValue));
    }
    /// <summary>
    /// Return a copy of SqlInt16 structure
    /// </summary>
    /// <param name="toClone">SqlInt16 to copy</param>
    /// <returns>SqlInt16 structure copied</returns>
    public static SqlInt16 ClonedValue(SqlInt16 toClone)
    {
      SqlInt16 res;
      if (toClone.IsNull)
      {
        res = SqlInt16.Null;
      }
      else
      {
        res = new SqlInt16(toClone.Value);
      }
      return res;
    }
    /// <summary>
    /// Creates a copy of this TdoInt16 object.
    /// </summary>
    /// <returns></returns>
    public override ITdoType<SqlInt16> Clone()
    {
      TdoInt16 clone = new TdoInt16(this.pAllowDBNull, this.pAutoIncrement, this.pAutoIncrementSeed, this.pAutoIncrementStep, this.pCaption, this.pColumnName, this.pMaxLength, this.pReadOnly, this.pUnique, this.pTdoEntity);
      clone.Value = this.ClonedValue();
      return clone;
    }
    /// <summary>
    /// Returns the string representation of the content of the field
    /// </summary>
    /// <returns>string</returns>
    public override string ToString()
    {
      //TODO: Ridefinire per alcuni tipi ... tipo Binary
      return this.Value.ToString();
    }
    #endregion Methods
    #region Operators    
    /// <summary>
    /// Comparison operator Equals
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator ==(TdoInt16 left, Int16 right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Equal, right);
    }
    /// <summary>
    /// Comparison operator Equals
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator ==(TdoInt16 left, ITdoColumn right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Equal, right);
    }
    /// <summary>
    /// Comparison operator is (null)
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator ==(TdoInt16 left, DBNull right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Equal, right);
    }
    /// <summary>
    /// Comparison operator BetWeen
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="range">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator ==(TdoInt16 left, TdoWhereRange range)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Between, range);
    }
    /// <summary>
    /// Comparison operator IN
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="setOfValues">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator ==(TdoInt16 left, TdoWheresetOfValues setOfValues)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.In, new TdoWheresetOfValues(setOfValues.setOfValues));
    }
    /// <summary>
    /// Comparison operator IN
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="setOfValues">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator ==(TdoInt16 left, object[] setOfValues)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.In, new TdoWheresetOfValues(setOfValues));
    }
    /// <summary>
    /// Comparison operator Greater
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator >(TdoInt16 left, Int16 right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Greater, right);
    }
    /// <summary>
    /// Comparison operator Greater
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator >(TdoInt16 left, ITdoColumn right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Greater, right);
    }
    /// <summary>
    /// Comparison operator Greater or Equal
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator >=(TdoInt16 left, Int16 right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.GreaterOrEqual, right);
    }
    /// <summary>
    /// Comparison operator Greater or Equal
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator >=(TdoInt16 left, ITdoColumn right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.GreaterOrEqual, right);
    }
    /// <summary>
    /// Comparison operator Lower
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator <(TdoInt16 left, Int16 right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Lower, right);
    }
    /// <summary>
    /// Comparison operator Lower
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator <(TdoInt16 left, ITdoColumn right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.Lower, right);
    }
    /// <summary>
    /// Comparison operator Lower or Equal
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator <=(TdoInt16 left, Int16 right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.LowerOrEqual, right);
    }
    /// <summary>
    /// Comparison operator Lower or Equal
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator <=(TdoInt16 left, ITdoColumn right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.LowerOrEqual, right);
    }
    /// <summary>
    /// Comparison operator NOT IN
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="setOfValues">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator !=(TdoInt16 left, TdoWheresetOfValues setOfValues)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.NotIn, new TdoWheresetOfValues(setOfValues.setOfValues));
    }
    /// <summary>
    /// Comparison operator NotEqual
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator !=(TdoInt16 left, ITdoColumn right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.NotEqual, right);
    }
    /// <summary>
    /// Comparison operator NOT IN
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="setOfValues">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator !=(TdoInt16 left, object[] setOfValues)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.NotIn, new TdoWheresetOfValues(setOfValues));
    }
    /// <summary>
    /// Comparison operator Not BetWeen
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="range">range on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator !=(TdoInt16 left, TdoWhereRange range)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.NotBetween, range);
    }
    /// <summary>
    /// Comparison operator NotEqual 
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator !=(TdoInt16 left, Int16 right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.NotEqual, right);
    }
    /// <summary>
    /// Comparison operator is not (null)
    /// </summary>
    /// <param name="left">Parameter on the left of the operator</param>
    /// <param name="right">Parameter on the right of the operator</param>
    /// <returns>Returns an expression like TdoSqlExpression useful to convert the where clause to string</returns>
    public static TdoSqlExpression operator !=(TdoInt16 left, DBNull right)
    {
      return new TdoSqlExpression((ITdoColumn)left, SqlOperator.NotEqual, right);
    }
    #endregion Operators
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.