protected void customVal_OnServerValidate(object source, ServerValidateEventArgs args) { bool validated = true; if (this.isReadonly) { args.IsValid = true; return; } DateTime?visit1Date = null; visit1Date = Domain.Helper.GetCanadianDate(this.txtVisit1Date.Text); DateTime dateOfConsent = visRepos.GetVisit1DateOfConsent(this.patientID); if (visit1Date < dateOfConsent || visit1Date > DateTime.Now) { validated = false; this.imgVisit1Date.Visible = true; lblDateOfConsent.Visible = true; } if (chkGender.SelectedItem == null) { validated = false; imgPatientGender.Visible = true; } if (rdoWeightType.SelectedIndex == -1) { validated = false; imgWeight.Visible = true; } if (rdoHeightType.SelectedIndex == -1) { validated = false; imgHeight.Visible = true; } if (rdoWeightType.SelectedIndex > -1 && rdoHeightType.SelectedIndex > -1) { bool isKg = rdoWeightType.SelectedIndex == 0; bool isCm = rdoHeightType.SelectedIndex == 0; decimal weight = decimal.Parse(this.txtWeight.Text); decimal height = decimal.Parse(this.txtHeight.Text); if (isKg) { if (weight < 30 || weight > 300) { validated = false; lblWeight.Visible = true; lblWeight.Text = "Weight should be between 30 and 300 Kg"; } } else { if (weight < 66 || weight > 660) { validated = false; lblWeight.Visible = true; lblWeight.Text = "Weight should be between 66 and 660 lbs"; } } if (isCm) { if (height < 100 || height > 230) { validated = false; lblHeight.Visible = true; lblHeight.Text = "Height should be between 100 and 230 cm"; } } else { if (height < 39 || height > 90) { validated = false; lblHeight.Visible = true; lblHeight.Text = "Height should be between 39 and 90 Inches"; } } } //BP int bpSystolic = Int32.Parse(this.txtSystolic.Text); int bpDystolic = Int32.Parse(this.txtDiastolic.Text); if (bpDystolic > bpSystolic) { validated = false; lblBPLarge.Visible = true; } if (!chkNeverSmoked.Checked && !chkPastSmoker.Checked && !chkCurrentSmoker.Checked) { validated = false; imgSmokingHistory.Visible = true; } if ( !chkDepressionYes.Checked && !chkErectleYes.Checked && !chkHypoglycemiaYes.Checked && !chkMacroalbuminuriaYes.Checked && !chkMicroalbuminuriaYes.Checked && !chkRetinopathyYes.Checked && !chkDiabetesComplicationsNone.Checked ) { validated = false; imgDiab.Visible = true; } if ( !chkCurrentMedicationNone.Checked && !chkASAYes.Checked && !chkOtherAntiplateletAgentYes.Checked && !chkACEInhibitorYes.Checked && !chkARBYes.Checked && !chkBetaBlockerYes.Checked && !chkCalciumChannelBlockerYes.Checked && !chkDiureticYes.Checked ) { validated = false; imgCurrMed.Visible = true; } if ( //!chkEstimateMedicationNo.Checked && !chkPatientCaregiver.Checked && !chkPhramacyRenewal.Checked && !chkMedicationCount.Checked && !chkGuessedEstimated.Checked && !chkDidNotEvaluate.Checked ) { validated = false; imgEstMedAdhere.Visible = true; } args.IsValid = validated; if (!validated) { Helper.Utility.FocusControlOnPageLoad(this.pnlCustVal.ClientID, this.Page); } }
public DateTime GetVisit1DateOfConsent(int patientID) { return(visRepos.GetVisit1DateOfConsent(patientID)); }