/// <summary>
        ///
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static DateTime GetPeriodicDate(Document doc)
        {
            var docType = (SBDocumentType)SBType.GetType(doc);

            switch (docType.Periodicity)
            {
            case Periodicity.None:
                return(DateTimeNow.Now);

            case Periodicity.Day:
                return(doc.Date.BeginOfDay());

            case Periodicity.Month:
                return(doc.Date.StartOfMonth());

            case Periodicity.Quarter:
                return(doc.Date.GetQuarterBegin());

            case Periodicity.Year:
                return(doc.Date.StartOfYear());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#2
0
        public void MetadataTestDetail()
        {
            var tab = new TabTestDetail();

            Assert.AreEqual(tab.TypeId, 3);

            var tabType = SBType.GetType(tab);

            Assert.IsInstanceOf <SBDetailType>(tabType);
        }
示例#3
0
        public void MetadataTestDocument()
        {
            var document = new MovementDocument();

            Assert.AreEqual(document.TypeId, 4);

            var documentType = SBType.GetType(document);

            Assert.IsInstanceOf <SBDocumentType>(documentType);
        }
示例#4
0
        public void MetadataTestEntity()
        {
            var country = new CountryTestEntity();

            Assert.AreEqual(country.TypeId, 1);

            var countryType = SBType.GetType(country);

            Assert.IsInstanceOf <SBEntityType>(countryType);

            var city = new CityTestEntity();

            Assert.AreEqual(city.TypeId, 2);

            var cityType = SBType.GetType(city);

            Assert.IsInstanceOf <CitySBType>(cityType);
        }