Пример #1
0
        public static DateTimeSr FromString(string sXml)
        {
            DateTimeSr dt = new DateTimeSr();

            dt.FromXmlString(sXml);

            return(dt);
        }
Пример #2
0
        private string SerializablePropertyToString(SerializableProperty sp)
        {
            Debug.Assert(sp.PropertyValue != null);
            string sName = sp.PropertyName.ToLowerInvariant();

            try
            {
                ExcpHelper.ThrowIf <InvalidOperationException>(!this.PropTypes.ContainsKey(sName), "Cannot find property type.");
                Type tProperty = this.PropTypes[sName];

                if (tProperty == typeof(Int32) || tProperty == typeof(Int32?))
                {
                    return(XmlConvert.ToString((Int32)sp.PropertyValue));
                }

                if (tProperty == typeof(Int64) || tProperty == typeof(Int64?))
                {
                    return(XmlConvert.ToString((Int64)sp.PropertyValue));
                }

                if (tProperty == typeof(DateTime) || tProperty == typeof(DateTime?))
                {
                    return(XmlConvert.ToString((DateTime)sp.PropertyValue));
                }

                if (tProperty == typeof(DateTimeSr))
                {
                    DateTimeSr dtsr = sp.PropertyValue as DateTimeSr;
                    Debug.Assert(dtsr != null);

                    return(dtsr.ToXmlString());
                }

                if (tProperty == typeof(bool) || tProperty == typeof(bool?))
                {
                    return(XmlConvert.ToString((bool)sp.PropertyValue));
                }

                if (tProperty == typeof(decimal) || tProperty == typeof(decimal?))
                {
                    return(XmlConvert.ToString((decimal)sp.PropertyValue));
                }

                if (tProperty.IsEnum)
                {
                    return(sp.PropertyValue.ToString());
                }

                return(sp.PropertyValue.ToString());
            }
            catch (Exception excp)
            {
                m_logger.Excp(excp, "SerializablePropertyToString({0}) ERROR.", sp);
                throw;
            }
        }
Пример #3
0
        public override bool Equals(object obj)
        {
            DateTimeSr dtsr = obj as DateTimeSr;

            return(dtsr != null?this.DateTimeOffset.Equals(dtsr.DateTimeOffset) : false);
        }