예제 #1
0
        public DiffLog GenerateDiff(string docket, string extract)
        {
            var diffLog = DiffLog.Create(docket, extract);

            var sql =
                $"SELECT MAX({nameof(PatientExtract.Date_Created)}) {nameof(PatientExtract.Date_Created)},MAX({nameof(PatientExtract.Date_Last_Modified)}) {nameof(PatientExtract.Date_Last_Modified)} FROM {extract}";

            var extractDates = Context.Database.GetDbConnection().QuerySingle(sql);

            if (null != extractDates)
            {
                diffLog.MaxCreated  = Extentions.CastDateTime(extractDates.Date_Created);
                diffLog.MaxModified = Extentions.CastDateTime(extractDates.Date_Last_Modified);
            }

            return(diffLog);
        }
예제 #2
0
        public void should_cast_dynamic()
        {
            dynamic  dateItem = "2020-11-01 22:03:41";
            DateTime?date     = Extentions.CastDateTime(dateItem);

            Assert.False(date.IsNullOrEmpty());

            dynamic  dateItem2 = "XXX0-11-01 22:03:41";
            DateTime?date2     = Extentions.CastDateTime(dateItem2);

            Assert.True(date2.IsNullOrEmpty());

            dynamic  dateItem3 = string.Empty;
            DateTime?date3     = Extentions.CastDateTime(dateItem3);

            Assert.True(date3.IsNullOrEmpty());

            dynamic  realDateItem = DateTime.Now;
            DateTime?readDate     = Extentions.CastDateTime(realDateItem);

            Assert.False(readDate.IsNullOrEmpty());
        }