Пример #1
0
        public IActionResult SearchPurchaseOrderDetails(int pageNum, int pageSize, SearchOrderDetailsRequest searchRequest)
        {
            if (searchRequest.StartDate == null || searchRequest.EndDate == null)
            {
                return(BadRequest("Invalid arguments"));
            }
            IQueryable <PurchaseOrderDetail> searchResult;

            try
            {
                bool startDateParsed = DateParser.ParseDate(searchRequest.StartDate, out DateTime startDatePassed);
                bool endDateParsed   = DateParser.ParseDate(searchRequest.EndDate, out DateTime endDatePassed);
                searchResult = purchaseOrderDetailAppService.SearchPurchaseOrderDetails(
                    startDateParsed ? startDatePassed as DateTime? : null,
                    endDateParsed ? endDatePassed as DateTime? : null);
            }
            catch (Exception e)
            {
                // TODO: log exception stack trace
                return(BadRequest("Invalid arguments"));
            }

            var filteredResult = from order in searchResult
                                 group order by order.DueDate into d
                                 select new
            {
                Date      = d.Key,
                LineTotal = d.Sum(order => order.LineTotal),
                Quantity  = d.Sum(order => order.OrderQty),
                TotalSum  = d.Sum(order => order.LineTotal) + d.Sum(order => order.OrderQty)
            };

            filteredResult.OrderBy(m => m.Date).ToPagedList(pageNum, pageSize);
            return(Ok(filteredResult));
        }
Пример #2
0
        public DatabaseManager loadAll()
        {
            Console.WriteLine("Loading from .csv file...");
            List <Flight> records = new List <Flight>();

            try
            {
                using (var reader = new StreamReader(PATH_TO_CSV))
                {
                    while (!reader.EndOfStream)
                    {
                        var    line   = reader.ReadLine();
                        var    values = line.Split(';');
                        Flight flight = new Flight(values[0], values[1], DateParser.parse_HHmm(values[2]), DateParser.parse_HHmm(values[3]));
                        records.Add(flight);
                    }
                    currentQueryFlights = records;
                    return(this);
                }
            }
            catch (Exception e)
            {
                Flight flight = new Flight("fakap_while_loadAll()", e.Message, new DateTime(), new DateTime());
                currentQueryFlights.Add(flight);
                return(this);
            }
        }
Пример #3
0
 private static Study CreateStudy(string studyInstanceUid, string accessionNumber = "ACCESSION",
                                  string patientId         = "PATIENTID", string patientsName     = "PATIENTNAME",
                                  DateTime?studyDate       = null, string studyId                 = "STUDYID", string studyDescription = "DESCRIPTION",
                                  string modalitiesInStudy = "OT", int?numberOfStudyRelatedSeries = null, int?numberOfStudyRelatedInstances = null,
                                  DateTime?storeTime       = null, bool reindex = false, DateTime?deleteTime = null, bool deleted = false)
 {
     return(new Study
     {
         StudyInstanceUid = studyInstanceUid,
         AccessionNumber = accessionNumber,
         PatientId = patientId,
         PatientsName = patientsName,
         StudyDate = ConstrainSqlDateTime(studyDate),
         StudyDateRaw = studyDate.HasValue ? DateParser.ToDicomString(studyDate.Value) : string.Empty,
         StudyId = studyId,
         StudyDescription = studyDescription,
         ModalitiesInStudy = modalitiesInStudy,
         NumberOfStudyRelatedSeries = numberOfStudyRelatedSeries,
         NumberOfStudyRelatedInstances = numberOfStudyRelatedInstances,
         StoreTime = ConstrainSqlDateTime(storeTime.GetValueOrDefault(DateTime.Now)),
         Reindex = reindex,
         DeleteTime = ConstrainSqlDateTime(deleteTime),
         Deleted = deleted
     });
 }
Пример #4
0
 private void AppendPeriod(Period?period)
 {
     if (period.HasValue)
     {
         this.builder.AppendFormat("&min_date={0}&max_date={1}", DateParser.ToUnixTimestamp(period.Value.Begin), DateParser.ToUnixTimestamp(period.Value.End));
     }
 }
Пример #5
0
        public void TestDateParser()
        {
            //valid date
            DateTime date;
            bool     returnValue = DateParser.Parse("20060607", out date);

            Assert.IsTrue(returnValue);
            Assert.AreEqual(date, new DateTime(2006, 6, 7));

            // Valid date according to OLD Dicom Standard (pre 3.0).
            // Recommended by Dicom that we still support it.
            returnValue = DateParser.Parse("2006.06.07", out date);
            Assert.IsFalse(returnValue);

            //Invalid dates
            returnValue = DateParser.Parse("a0060607", out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse("2006067", out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse(String.Empty, out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse(null, out date);
            Assert.IsFalse(returnValue);
        }
Пример #6
0
        public void RetrieveSeries()
        {
            if (!Enabled || SelectedSeries.Count == 0)
            {
                return;
            }

            var client     = new DicomRetrieveBridge();
            var seriesUids = Context.SelectedSeries.Select(item => item.SeriesInstanceUid).ToList();

            try
            {
                client.RetrieveSeries(Server, Context.Study, seriesUids.ToArray());

                DateTime?studyDate = DateParser.Parse(Context.Study.StudyDate);
                Context.DesktopWindow.ShowAlert(AlertLevel.Info,
                                                string.Format(SR.MessageFormatRetrieveSeriesScheduled, seriesUids.Count,
                                                              Server.Name, Context.Study.PatientsName.FormattedName, studyDate.HasValue ? Format.Date(studyDate.Value) : string.Empty,
                                                              Context.Study.AccessionNumber),
                                                SR.LinkOpenActivityMonitor, ActivityMonitorManager.Show, true);
            }
            catch (EndpointNotFoundException)
            {
                Context.DesktopWindow.ShowMessageBox(SR.MessageRetrieveDicomServerServiceNotRunning, MessageBoxActions.Ok);
            }
            catch (Exception ex)
            {
                ExceptionHandler.Report(ex, SR.MessageFailedToRetrieveSeries, Context.DesktopWindow);
            }

            //TODO (CR Sept 2010): put a Close method on the context, or put a property on SeriesDetailsTool
            //that somehow allows a tool to flag that when it is clicked, the component should close.
            //if (result == EventResult.Success)
            //	SeriesDetailsComponent.Close();
        }
Пример #7
0
        private void TraceAcquisitionTime(IEnumerable <IPresentationImage> images)
        {
            foreach (IPresentationImage image in images)
            {
                if (image is DicomGrayscalePresentationImage)
                {
                    DicomGrayscalePresentationImage dicomImage = (DicomGrayscalePresentationImage)image;

                    DateTime?acqDate = DateParser.Parse(dicomImage.ImageSop.Frames[1].AcquisitionDate);
                    DateTime?acqTime = TimeParser.Parse(dicomImage.ImageSop.Frames[1].AcquisitionTime);
                    if (acqDate != null)
                    {
                        acqDate = acqDate.Value.AddTicks(acqTime.Value.Ticks);
                    }
                    else
                    {
                        acqDate = DateTimeParser.Parse(dicomImage.ImageSop.Frames[1].AcquisitionDateTime);
                    }

                    string line = string.Format("StudyUID: {0}, Series: {1}, Acq.Date/Time: {2}, Instance: {3}, Frame: {4}",
                                                dicomImage.ImageSop.StudyInstanceUid,
                                                dicomImage.ImageSop.SeriesInstanceUid,
                                                acqDate.Value.ToString(DateTimeParser.DicomFullDateTimeFormat),
                                                dicomImage.ImageSop.InstanceNumber,
                                                dicomImage.Frame.FrameNumber);
                    Debug.WriteLine(line);
                }
                else
                {
                    Debug.WriteLine("** Non-Dicom Image **");
                }
            }
        }
Пример #8
0
        public ActionResult ChangeDeadLine(DateTime?start, DateTime?firstDeadline, DateTime?lastDeadline)
        {
            ViewBag.Result = false;
            if (start != null && firstDeadline != null && lastDeadline != null)
            {
                if (start < firstDeadline && firstDeadline < lastDeadline)
                {
                    ViewBag.Result = true;

                    DeadlineConfig.JobMaker.ClearSchedule();

                    DateParser dp = new DateParser();

                    string startPoint = dp.Parse(start);
                    DeadlineConfig.JobMaker.Start <StartJob>(startPoint);

                    string frstDeadline = dp.Parse(firstDeadline);
                    DeadlineConfig.JobMaker.Start <FirstDeadLineJob>(frstDeadline);

                    string lstDeadline = dp.Parse(lastDeadline);
                    DeadlineConfig.JobMaker.Start <LastDeadlineJob>(lstDeadline);
                    staticData.StartTime         = new DateTime(start.Value.Year, start.Value.Month, start.Value.Day); //start;
                    staticData.firstDeadLineTime = new DateTime(firstDeadline.Value.Year, firstDeadline.Value.Month,
                                                                firstDeadline.Value.Day);                              // firstDeadline;
                    staticData.lastDeadLineTime = new DateTime(lastDeadline.Value.Year, lastDeadline.Value.Month,
                                                               lastDeadline.Value.Day);                                // lastDeadline;
                    staticData.disciplinesID = _repository.GetDisciplinesForSecondWave();
                }
            }

            ViewBag.Start         = staticData.StartTime;
            ViewBag.FirstDeadline = staticData.firstDeadLineTime;
            ViewBag.LastDeadline  = staticData.lastDeadLineTime;
            return(View());
        }
Пример #9
0
        public void IsNotMonth()
        {
            int  month;
            bool success = DateParser.TryParseMonth("febtober", out month);

            Assert.False(success);
        }
        public async Task <V1StoryModel> GetArticle(int storyId)
        {
            var html = await _downloadService.DownloadWithSharedLogin($"https://www.shacknews.com/article/{storyId}");

            var p = new Parser(html);

            p.Seek(1, "<div class=\"article-lead-middle\">");
            var name = WebUtility.HtmlDecode(p.Clip(
                                                 new[] { "<h1 class=\"article-title\">", ">" },
                                                 "</h1>"));
            var preview = WebUtility.HtmlDecode(p.Clip(
                                                    new[] { "<description>", "<p>", ">" },
                                                    "</p>"));

            p.Seek(1, "<div class=\"article-lead-bottom\">");
            var date = DateParser.Parse(p.Clip(
                                            new[] { "<time datetime=\"", "\"" },
                                            "\">"));
            var body = "<p>" + p.Clip(
                new[] { "<p>", ">" },
                "<div class=\"author-short-bio");

            return(new V1StoryModel
            {
                Preview = preview,
                Name = name,
                Body = body,
                Date = date,
                CommentCount = 0,
                Id = storyId,
                ThreadId = 0
            });
        }
        public void ThrowArgumentNullException_WhenPassedInvoiceIsNull()
        {
            var      dateParser = new DateParser();
            IInvoice invoice    = null;

            Assert.Throws <ArgumentNullException>(() => dateParser.ParseInvoiceDate(invoice));
        }
Пример #12
0
        private void SetStudyTags()
        {
            StudyInstanceUid = DicomUid.GenerateUid().UID;

            _theFile.DataSet[DicomTags.StudyInstanceUid].SetStringValue(StudyInstanceUid);
            _theFile.DataSet[DicomTags.StudyDate].SetStringValue(DateParser.ToDicomString(StudyDate));
            _theFile.DataSet[DicomTags.StudyTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            _theFile.DataSet[DicomTags.PerformedProcedureStepStartDate].SetStringValue(DateParser.ToDicomString(StudyDate));
            _theFile.DataSet[DicomTags.PerformedProcedureStepStartTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            _theFile.DataSet[DicomTags.AccessionNumber].SetStringValue(ModalityHospital.GetNextAccession());

            _studyNumber++;
            _theFile.DataSet[DicomTags.StudyId].SetStringValue(string.Format("S{0:0000}", _studyNumber));
            _theFile.DataSet[DicomTags.ReferringPhysiciansName].SetStringValue(GetPatient());

            string name = GetPatient();

            _theFile.DataSet[DicomTags.PatientsName].SetStringValue(name);
            _theFile.DataSet[DicomTags.PatientId].SetStringValue(string.Format("{0} {1}", Math.Abs(name.GetHashCode()), ModalityHospital.Name));
            _theFile.DataSet[DicomTags.IssuerOfPatientId].SetStringValue(ModalityHospital.Name);

            DateTime birthdate = GetBirthdate(name);
            TimeSpan age       = StudyDate.Subtract(birthdate);

            _theFile.DataSet[DicomTags.PatientsBirthDate].SetStringValue(DateParser.ToDicomString(birthdate));
            _theFile.DataSet[DicomTags.PatientsAge].SetStringValue(String.Format("{0:000}Y", age.Days / 365));
            _theFile.DataSet[DicomTags.PatientsSex].SetStringValue("M");

            _theFile.DataSet[DicomTags.StudyDescription].SetStringValue(_studyDescription[Rand.Next(_studyDescription.Count)]);
        }
Пример #13
0
 public Lecture(string name, string date, ITrainer trainer)
 {
     this.Name      = name;
     this.Date      = DateParser.Parse(date);
     this.Trainer   = trainer;
     this.Resources = new List <ILectureResource>();
 }
Пример #14
0
        public void TestDateParser()
        {
            //Valid date. In DICOM, it's 8 bytes fixed ... period.
            DateTime date;
            bool     returnValue = DateParser.Parse("20060607", out date);

            Assert.IsTrue(returnValue);
            Assert.AreEqual(date, new DateTime(2006, 6, 7));

            // Valid date according to OLD Dicom Standard (pre 3.0).
            // Recommended by Dicom that we still support it, but we're choosing not to.
            returnValue = DateParser.Parse("2006.06.07", out date);
            Assert.IsFalse(returnValue);

            //Invalid dates
            returnValue = DateParser.Parse("a0060607", out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse("2006067", out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse("200606", out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse("2006", out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse(String.Empty, out date);
            Assert.IsFalse(returnValue);

            returnValue = DateParser.Parse(null, out date);
            Assert.IsFalse(returnValue);
        }
Пример #15
0
 /// <summary>
 /// See <see cref="IInitializationPostOperations.AfterPropertiesSet"/>.
 /// </summary>
 public void AfterPropertiesSet()
 {
     if (DateParser == null)
     {
         DateParser = new DateParser();
     }
 }
Пример #16
0
        /// <summary>
        /// Set the file timestamp.
        /// </summary>
        public void SetTimeStamp()
        {
            if (null == date)
            {
                DateTime now = DateTime.Now;
                // File system time is stored without regards to daylight savings time
                //  therefore if the file time is different then we can assume
                //  that daylight savings is in effect.
//                if (now.ToFileTime() != now.Ticks) {
//                    now = now.AddHours(-1);
//                }
                now                 = now.AddHours(-1);
                date                = DateParser.GetCvsDateString(now);
                this.timestamp      = now;
                this.isUtcTimeStamp = false;
            }
            else
            {
                this.timestamp      = DateParser.ParseCvsDate(date);
                this.isUtcTimeStamp = true;
            }
            if (LOGGER.IsDebugEnabled)
            {
                StringBuilder msg = new StringBuilder();
                msg.Append("timestamp=[").Append(timestamp).Append("]");
                msg.Append("date=[").Append(date).Append("]");
                LOGGER.Debug(msg);
            }
        }
Пример #17
0
        protected override string GetRenderedDateTimeText()
        {
            if (String.IsNullOrEmpty(Value))
            {
                return(EmptyValueText);
            }

            DateTime?dt = DateParser.Parse(Value);

            if (dt != null)
            {
                if (String.IsNullOrEmpty(Format))
                {
                    return(DateTimeFormatter.Format(dt.Value, DateTimeFormatter.Style.Date));
                }
                else
                {
                    return(dt.Value.ToString(Format));
                }
            }
            else
            {
                return(null);
            }
        }
Пример #18
0
 public void CheckParsedDates()
 {
     DateParser.ParseRawDates("31Aug1992(mon),  05Dec2015(tues),   22Sep2012(wed)");
     Assert.IsNotEmpty(CustomerUtil.Dates);
     Assert.Contains(new DateTime(1992, 08, 31), CustomerUtil.Dates);
     Assert.Contains(new DateTime(2015, 12, 05), CustomerUtil.Dates);
     Assert.Contains(new DateTime(2012, 09, 22), CustomerUtil.Dates);
 }
Пример #19
0
        private IEnumerable <IComparable> GetCompareValues(IStudyData studyData)
        {
            yield return(DateParser.Parse(studyData.StudyDate));

            yield return(TimeParser.Parse(studyData.StudyTime));

            yield return(studyData.StudyDescription);
        }
Пример #20
0
        private void InitNewStudy(DateTime studyDate)
        {
            Random ran = new Random();

            AccessionNumber.Text  = String.Format("{0}{1}", (char)((int)'A' + ran.Next(26)), ran.Next(10000, 99999));
            StudyInstanceUid.Text = DicomUid.GenerateUid().UID;
            StudyDate.Text        = DateParser.ToDicomString(studyDate);
        }
Пример #21
0
        public void Day_MMMdyyyy()
        {
            var result = new DateParser().Parse("August 6, 2014");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Check(result[0], d(2014, 8, 6), d(2014, 8, 7));
        }
Пример #22
0
        public void DateTime_object()
        {
            var result = new DateParser().Parse(d(2014, 8, 6));

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Check(result[0], d(2014, 8, 6), d(2014, 8, 7));
        }
Пример #23
0
 /// <summary>
 /// Encode date
 /// </summary>
 /// <param name="date"></param>
 /// <param name="format"></param>
 /// <returns></returns>
 private object EncodeDate(DateTime date, FieldFormat format)
 {
     if (DecimalTypes.Contains(format.Type))
     {
         return(DateParser.EncodeDecimal(date));
     }
     return(DateParser.EncodeString(date));
 }
Пример #24
0
        public void Month_MMMyyyy_short()
        {
            var result = new DateParser().Parse("Aug 2014");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Check(result[0], d(2014, 8, 1), d(2014, 9, 1));
        }
Пример #25
0
        public void Test_Duration_Parsing(string duration)
        {
            DataValue <TimeSpan> ts = DateParser.Duration(new JValue(duration));

            Assert.True(ts.HasValue);

            _output.WriteLine(ts.Value.ToString());
        }
Пример #26
0
        public void TestShouldIgnoreTimestamp()
        {
            //Calendar aDate = Calendar.getInstance();
            //aDate.setTime(new Date(84, OCTOBER, 20));
            DateTime aDate = DateTime.Parse("84-10-20");

            Assert.AreEqual(aDate, DateParser.ParseDate("1984/10/20 12:34:56"));
        }
Пример #27
0
        public void Year_yyyy()
        {
            var result = new DateParser().Parse("2014");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Check(result[0], d(2014, 1, 1), d(2015, 1, 1));
        }
Пример #28
0
        public void Day_yyyyMMdd()
        {
            var result = new DateParser().Parse("20140806");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Check(result[0], d(2014, 8, 6), d(2014, 8, 7));
        }
Пример #29
0
        public void ParseDatesDuplicatesExpectOneDate()
        {
            string          input  = "12-31-95, 12-31-95";
            DateParser      parser = new DateParser();
            List <DateTime> dates  = parser.ParseDates(input);

            Assert.AreEqual(1, dates.Count);
        }
Пример #30
0
 public void CanParseRwDoB()
 {
     Assert.Equal(DateTime.Parse("25-Jan-65"), DateParser.ParseRwDate(@"25/1/1965"));
     Assert.Equal(DateTime.Parse("25-Jan-65"), DateParser.ParseRwDate(@"25/01/1965"));
     Assert.Equal(DateTime.Parse("25-Jan-65"), DateParser.ParseRwDate(@"25/1/65"));
     Assert.Equal(DateTime.Parse("25-Jan-65"), DateParser.ParseRwDate(@"25/01/65"));
     Assert.Equal(DateTime.Parse("5-Jan-65"), DateParser.ParseRwDate(@"05/01/65"));
 }
Пример #31
0
 public void Init()
 {
     parser = new DateParser(TimeZoneInfo.Local);
 }
Пример #32
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DateParser obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }