Esempio n. 1
0
        public override bool IsValid()
        {
            if (string.IsNullOrEmpty(Number))
            {
                throw new DocumentInvalidNumberException();
            }
            var now = DateTime.Now;

            if (Issue.CompareTo(now) > 0)
            {
                throw new DocumentIssueDateException();
            }
            if (Expire.CompareTo(now) < 0)
            {
                throw new DocumentExpiredException();
            }
            return(true);
        }
Esempio n. 2
0
        public int CompareTo(object iOther)
        {
            if (iOther is RoyalGazette)
            {
                Int32        retval = 0;
                RoyalGazette value2 = (RoyalGazette)iOther;

                retval = Volume.CompareTo(value2.Volume);
                if (retval == 0)
                {
                    retval = Issue.CompareTo(value2.Issue);
                    if (retval == 0)
                    {
                        retval = PageInfo.CompareTo(value2.PageInfo);
                    }
                }
                return(retval);
            }
            throw new InvalidCastException("Not a RoyalGazette");
        }