Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Ensure the study date entered if invalid will not be erased by the calendar extender
            // Note: this code is actually needed for Firefox because the server validation is used.
            // For IE, because of client-side validation, all input is already valid on postback.
            if (!String.IsNullOrEmpty(StudyDate.Text))
            {
                DateTime result;
                if (InputDateParser.TryParse(StudyDate.Text, out result))
                {
                    // entered value is actually valid... update the calendar
                    StudyDateCalendarExtender.SelectedDate = result;
                }
                else
                {
                    StudyDateCalendarExtender.SelectedDate = null;
                }
            }
            else
            {
                // Prevents the calendar from copying its value into the textbox
                StudyDateCalendarExtender.SelectedDate = null;
            }
        }
Esempio n. 2
0
        private List <UpdateItem> GetChanges()
        {
            var changes        = new List <UpdateItem>();
            var oldPatientName = new PersonName(Study.PatientsName);
            var newPatientName = PatientNamePanel.PersonName;

            if (!oldPatientName.AreSame(newPatientName, PersonNameComparisonOptions.CaseInsensitive))
            {
                var item = new UpdateItem(DicomTags.PatientsName, Study.PatientsName, PatientNamePanel.PersonName);
                changes.Add(item);
            }

            String dicomBirthDate = !(string.IsNullOrEmpty(PatientBirthDate.Text))
                                        ? DateTime.ParseExact(PatientBirthDate.Text, InputDateParser.DateFormat, null).ToString(DicomConstants.DicomDate)
                                        : "";

            if (AreDifferent(Study.PatientsBirthDate, dicomBirthDate))
            {
                var item = new UpdateItem(DicomTags.PatientsBirthDate, Study.PatientsBirthDate, dicomBirthDate);
                changes.Add(item);
            }

            string newPatientAge = String.IsNullOrEmpty(PatientAge.Text)? String.Empty:String.Format("{0}{1}", PatientAge.Text.PadLeft(3, '0'), PatientAgePeriod.SelectedValue);

            if (AreDifferent(Study.PatientsAge, newPatientAge))
            {
                var item = new UpdateItem(DicomTags.PatientsAge, Study.PatientsAge, newPatientAge);
                changes.Add(item);
            }

            // PatientGender is a required field.
            if (AreDifferent(Study.PatientsSex, PatientGender.Text))
            {
                var item = new UpdateItem(DicomTags.PatientsSex, Study.PatientsSex, PatientGender.Text);
                changes.Add(item);
            }

            //PatientID.Text is a required field.
            if (AreDifferent(Study.PatientId, PatientID.Text))
            {
                var item = new UpdateItem(DicomTags.PatientId, Study.PatientId, PatientID.Text);
                changes.Add(item);
            }

            if (AreDifferent(Study.StudyDescription, StudyDescription.Text))
            {
                var item = new UpdateItem(DicomTags.StudyDescription, Study.StudyDescription, StudyDescription.Text);
                changes.Add(item);
            }

            if (AreDifferent(Study.StudyId, StudyID.Text))
            {
                var item = new UpdateItem(DicomTags.StudyId, Study.StudyId, StudyID.Text);
                changes.Add(item);
            }

            if (AreDifferent(Study.AccessionNumber, AccessionNumber.Text))
            {
                var item = new UpdateItem(DicomTags.AccessionNumber, Study.AccessionNumber, AccessionNumber.Text);
                changes.Add(item);
            }

            var oldPhysicianName = new PersonName(Study.ReferringPhysiciansName);
            var newPhysicianName = ReferringPhysicianNamePanel.PersonName;

            if (!newPhysicianName.AreSame(oldPhysicianName, PersonNameComparisonOptions.CaseInsensitive))
            {
                var item = new UpdateItem(DicomTags.ReferringPhysiciansName, Study.ReferringPhysiciansName, ReferringPhysicianNamePanel.PersonName.ToString());
                changes.Add(item);
            }

            string newDicomStudyDate = string.Empty;

            if (!string.IsNullOrEmpty(StudyDate.Text))
            {
                DateTime newStudyDate;
                newDicomStudyDate = InputDateParser.TryParse(StudyDate.Text, out newStudyDate)
                                        ? newStudyDate.ToString(DicomConstants.DicomDate)
                                        : string.Empty;
            }

            if (AreDifferent(Study.StudyDate, newDicomStudyDate))
            {
                var item = new UpdateItem(DicomTags.StudyDate, Study.StudyDate, newDicomStudyDate);
                changes.Add(item);
            }

            int    hh             = String.IsNullOrEmpty(StudyTimeHours.Text)? 0:int.Parse(StudyTimeHours.Text);
            int    mm             = int.Parse(StudyTimeMinutes.Text);
            int    ss             = int.Parse(StudyTimeSeconds.Text);
            String dicomStudyTime = String.Format("{0:00}{1:00}{2:00}", hh, mm, ss);

            if (AreDifferent(Study.StudyTime, dicomStudyTime))
            {
                var item = new UpdateItem(DicomTags.StudyTime, Study.StudyTime, dicomStudyTime);
                changes.Add(item);
            }

            return(changes);
        }
Esempio n. 3
0
        private List <UpdateItem> GetChanges()
        {
            var changes        = new List <UpdateItem>();
            var oldPatientName = new PersonName(Study.PatientsName);
            var newPatientName = PatientNamePanel.PersonName;

            if (!oldPatientName.AreSame(newPatientName, PersonNameComparisonOptions.CaseSensitive))
            {
                var item = new UpdateItem(DicomTags.PatientsName, Study.PatientsName, PatientNamePanel.PersonName);
                changes.Add(item);
            }

            String dicomBirthDate = string.IsNullOrEmpty(PatientBirthDate.Text)
                        ? ""
                        : DateTime.Parse(PatientBirthDate.Text).ToString(DicomConstants.DicomDate, CultureInfo.InvariantCulture);

            if (AreDifferent(Study.PatientsBirthDate, dicomBirthDate))
            {
                var item = new UpdateItem(DicomTags.PatientsBirthDate, Study.PatientsBirthDate, dicomBirthDate);
                changes.Add(item);
            }

            string newPatientAge = String.IsNullOrEmpty(PatientAge.Text)? String.Empty:String.Format("{0}{1}", PatientAge.Text.PadLeft(3, '0'), PatientAgePeriod.SelectedValue);

            if (AreDifferent(Study.PatientsAge, newPatientAge))
            {
                var item = new UpdateItem(DicomTags.PatientsAge, Study.PatientsAge, newPatientAge);
                changes.Add(item);
            }

            // PatientGender is a required field.
            if (AreDifferent(Study.PatientsSex, PatientGender.Text))
            {
                var item = new UpdateItem(DicomTags.PatientsSex, Study.PatientsSex, PatientGender.Text);
                changes.Add(item);
            }

            //PatientID.Text is a required field.
            if (AreDifferent(Study.PatientId, PatientID.Text))
            {
                var item = new UpdateItem(DicomTags.PatientId, Study.PatientId, PatientID.Text);
                changes.Add(item);
            }

            if (AreDifferent(Study.StudyDescription, StudyDescription.Text))
            {
                var item = new UpdateItem(DicomTags.StudyDescription, Study.StudyDescription, StudyDescription.Text);
                changes.Add(item);
            }

            if (AreDifferent(Study.StudyId, StudyID.Text))
            {
                var item = new UpdateItem(DicomTags.StudyId, Study.StudyId, StudyID.Text);
                changes.Add(item);
            }

            if (AreDifferent(Study.AccessionNumber, AccessionNumber.Text))
            {
                var item = new UpdateItem(DicomTags.AccessionNumber, Study.AccessionNumber, AccessionNumber.Text);
                changes.Add(item);
            }

            var oldPhysicianName = new PersonName(Study.ReferringPhysiciansName);
            var newPhysicianName = ReferringPhysicianNamePanel.PersonName;

            if (!newPhysicianName.AreSame(oldPhysicianName, PersonNameComparisonOptions.CaseSensitive))
            {
                var item = new UpdateItem(DicomTags.ReferringPhysiciansName, Study.ReferringPhysiciansName, ReferringPhysicianNamePanel.PersonName.ToString());
                changes.Add(item);
            }

            string newDicomStudyDate = string.Empty;

            if (!string.IsNullOrEmpty(StudyDate.Text))
            {
                DateTime newStudyDate;
                newDicomStudyDate = InputDateParser.TryParse(StudyDate.Text, out newStudyDate)
                                        ? newStudyDate.ToString(DicomConstants.DicomDate, CultureInfo.InvariantCulture) /* to ISO yyyyMMdd */
                                        : string.Empty;
            }

            if (AreDifferent(Study.StudyDate, newDicomStudyDate))
            {
                var item = new UpdateItem(DicomTags.StudyDate, Study.StudyDate, newDicomStudyDate);
                changes.Add(item);
            }

            int    hh             = String.IsNullOrEmpty(StudyTimeHours.Text)? 0:int.Parse(StudyTimeHours.Text);
            int    mm             = String.IsNullOrEmpty(StudyTimeMinutes.Text) ? 0 : int.Parse(StudyTimeMinutes.Text);
            int    ss             = String.IsNullOrEmpty(StudyTimeSeconds.Text) ? 0 : int.Parse(StudyTimeSeconds.Text);
            String dicomStudyTime = String.Format("{0:00}{1:00}{2:00}", hh, mm, ss);

            // #9475 : if fraction is in the original time, it should be preserved unless the hours, minutes or seconds are modified.
            var originalTime = Study.StudyTime;

            if (!string.IsNullOrEmpty(originalTime) && originalTime.Contains("."))
            {
                originalTime = originalTime.Substring(0, originalTime.IndexOf(".", StringComparison.InvariantCultureIgnoreCase));
            }

            if (AreDifferent(originalTime, dicomStudyTime))
            {
                var item = new UpdateItem(DicomTags.StudyTime, Study.StudyTime, dicomStudyTime);
                changes.Add(item);
            }

            return(changes);
        }