private void UpdateFields()
{
if(Study == null) return;
var patientName = new PersonName(Study.PatientsName);
var physicianName = new PersonName(Study.ReferringPhysiciansName);
PatientNamePanel.PersonName = patientName;
ReferringPhysicianNamePanel.PersonName = physicianName;
// Patient Information
if (!string.IsNullOrEmpty(Study.PatientsSex))
{
switch(Study.PatientsSex)
{
case "M":
PatientGender.SelectedIndex = 1;
break;
case "F":
PatientGender.SelectedIndex = 2;
break;
case "O":
PatientGender.SelectedIndex = 3;
break;
default:
PatientGender.SelectedIndex = 0;
break;
}
} else
{
PatientGender.SelectedIndex = 0;
}
PatientID.Text = Study.PatientId;
DateTime? originalBirthDate = String.IsNullOrEmpty(Study.PatientsBirthDate)? (DateTime?) null:DateParser.Parse(Study.PatientsBirthDate);
PatientBirthDateCalendarExtender.SelectedDate = originalBirthDate;
if (!String.IsNullOrEmpty(Study.PatientsAge))
{
PatientAge.Text = Study.PatientsAge.Substring(0, 3).TrimStart('0');
switch (Study.PatientsAge.Substring(3))
{
case "Y":
PatientAgePeriod.SelectedIndex = 0;
break;
case "M":
PatientAgePeriod.SelectedIndex = 1;
break;
case "W":
PatientAgePeriod.SelectedIndex = 2;
break;
default:
PatientAgePeriod.SelectedIndex = 3;
break;
}
}
else
{
PatientAge.Text = string.Empty;
PatientAgePeriod.SelectedIndex = 0;
}
// Study Information
StudyDescription.Text = Study.StudyDescription;
StudyID.Text = Study.StudyId;
AccessionNumber.Text = Study.AccessionNumber;
if (!string.IsNullOrEmpty(Study.StudyDate))
{
DateTime? studyDate = DateParser.Parse(Study.StudyDate);
StudyDateCalendarExtender.SelectedDate = studyDate;
}
else
{
StudyDateCalendarExtender.SelectedDate = null;
}
if (!string.IsNullOrEmpty(Study.StudyTime))
{
DateTime? studyTime = TimeParser.Parse(Study.StudyTime);
if (studyTime!=null)
{
StudyTimeHours.Text = String.Format("{0:00}",studyTime.Value.Hour);
StudyTimeMinutes.Text = String.Format("{0:00}", studyTime.Value.Minute);
StudyTimeSeconds.Text = String.Format("{0:00}", studyTime.Value.Second);
}
else
{
// The time is invalid, display it in the boxes
StudyTimeHours.Text = "";
StudyTimeMinutes.Text = "";
StudyTimeSeconds.Text = "";
}
}
else
{
StudyTimeHours.Text = "00";
StudyTimeMinutes.Text = "00";
StudyTimeSeconds.Text = "00";
}
ReasonListBox.SelectedIndex = 0;
if(string.IsNullOrEmpty(ReasonListBox.SelectedValue))
{
Comment.Text = string.Empty;
} else
{
Comment.Text = SR.CustomReasonComment;
}
SaveReasonAsName.Text = string.Empty;
AttachmentExistWarning.Visible = this.Study.HasAttachment;
DataBind();
}