コード例 #1
0
        public Boolean ValueEquals(LogicTransactionObjectParam other)
        {
            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }
            if (this.DataType != other.DataType)
            {
                return(false);
            }
            switch (this.DataType)
            {
            case LogDataType.Binary:
                return(this.BinaryValue.ArrayEquals(other.BinaryValue));

            case LogDataType.DateTime:
                return(this.DateTimeValue == other.DateTimeValue);

            case LogDataType.Enum:
            case LogDataType.Numeric:
            case LogDataType.Reference:
            case LogDataType.String:
                return(String.Equals(this.StrValue, other.StrValue, StringComparison.Ordinal));

            case LogDataType.TimeSpan:
                return(this.TimeSpanValue == other.TimeSpanValue);
            }
            return(false);
        }
コード例 #2
0
 public static bool ValueEquals(LogicTransactionObjectParam a, LogicTransactionObjectParam b)
 {
     if (a == null)
     {
         return(b == null);
     }
     return(a.ValueEquals(b));
 }
コード例 #3
0
        internal LogicTransactionObjectParam AddParam(LogicTransactionObjectParam value)
        {
            var existingParam = Params.FirstOrDefault(p => p.ParamName.Equals(value.ParamName, StringComparison.Ordinal) &&
                                                      p.RecordTypeChar.Equals(value.RecordTypeChar));

            if (existingParam != null)
            {
                Params.Remove(existingParam);
            }
            this.Params.Add(value);
            return(value);
        }
コード例 #4
0
        public static IEnumerable <LogicTransactionObjectParam> EnumerateObjectParams(this Object obj, BaseContext context)
        {
            var objectMetaData = obj.GetType().GetObjectMetaData();

            foreach (var eMD in obj.GetType().GetObjectMetaData())
            {
                var r = new LogicTransactionObjectParam(eMD.DataType)
                {
                    ColumnName = eMD.ColumnName,
                    TableName  = eMD.TableName,
                    ParamName  = eMD.PropertyName
                };
                if (context != null)
                {
                    r.CreateIid(context);
                }

                var value = eMD.GetValue(obj);

                switch (eMD.DataType)
                {
                case LogDataType.Binary:
                    r.BinaryValue = value as Byte[];
                    break;

                case LogDataType.DateTime:
                    r.DateTimeValue = value == null ? null : new DateTime?((DateTime)value);
                    break;

                case LogDataType.Enum:
                    r.StrValue = value == null ? null : value.ToString();
                    break;

                case LogDataType.Numeric:
                    r.NumericValue = value == null ? null : new Decimal?(Convert.ToDecimal(value));
                    break;

                case LogDataType.Reference:
                case LogDataType.String:
                    r.StrValue = value as String;
                    break;

                case LogDataType.TimeSpan:
                    r.TimeSpanValue = value == null ? null : new TimeSpan?((TimeSpan)value);
                    break;
                }

                yield return(r);
            }
        }