private Boolean FieldValidation() { IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security"); DateTime theCurrentDate = (DateTime)IQCareSecurity.SystemDate(); IQCareUtils theUtils = new IQCareUtils(); if (TxtFirstName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "First Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtFirstName.Focus(); return(false); } if (TxtLastName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtLastName.Focus(); return(false); } if (TxtAdmissionNo.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); return(false); } if (TxtRegistrationDate.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Registration Date"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtRegistrationDate.Focus(); return(false); } DateTime theEnrolDate = Convert.ToDateTime(theUtils.MakeDate(TxtRegistrationDate.Text)); if (theEnrolDate > theCurrentDate) { IQCareMsgBox.Show("EnrolDate", this); TxtRegistrationDate.Focus(); return(false); } if (DDGender.SelectedValue == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Sex"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); DDGender.Focus(); return(false); } if (TxtDOB.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "DOB"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDOB.Focus(); return(false); } DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDOB.Text)); if (theDOBDate > theCurrentDate) { IQCareMsgBox.Show("DOBDate", this); TxtDOB.Focus(); return(false); } if (theDOBDate > theEnrolDate) { IQCareMsgBox.Show("DOB_EnrolDate", this); return(false); } return(true); }
private Boolean FieldValidation() { IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security"); DateTime theCurrentDate = (DateTime)IQCareSecurity.SystemDate(); IQCareUtils theUtils = new IQCareUtils(); if (TxtFirstName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "First Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtFirstName.Focus(); return(false); } if (TxtLastName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtLastName.Focus(); return(false); } if (TxtRegistrationDate.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Registration Date"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtRegistrationDate.Focus(); return(false); } DateTime theEnrolDate = Convert.ToDateTime(theUtils.MakeDate(TxtRegistrationDate.Text)); if (theEnrolDate > theCurrentDate) { IQCareMsgBox.Show("EnrolDate", this); TxtRegistrationDate.Focus(); return(false); } if (DDGender.SelectedValue == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Sex"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); DDGender.Focus(); return(false); } if (TxtDOB.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "DOB"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDOB.Focus(); return(false); } DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDOB.Text)); if (theDOBDate > theCurrentDate) { IQCareMsgBox.Show("DOBDate", this); TxtDOB.Focus(); return(false); } if (theDOBDate > theEnrolDate) { IQCareMsgBox.Show("DOB_EnrolDate", this); return(false); } /////17-09-09 //if (chkTransferIn.Checked == true && ddReferredFrom.SelectedIndex != 0) //{ // // //MsgBuilder theBuilder = new MsgBuilder(); // // theBuilder.DataElements["Control"] = "RefFrom"; // //// IQCareMsgBox.Show("BlankDropDown", theBuilder, this); // return false; // } ////17-09-09 if (chkTransferIn.Checked == false && ddReferredFrom.SelectedIndex != 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Either Tranfer in/Referred From"; IQCareMsgBox.Show("BlankDropDown", theBuilder, this); return(false); } if (chkTransferIn.Checked == true && ddReferredFrom.SelectedIndex == 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Either Tranfer in/Referred From"; IQCareMsgBox.Show("BlankDropDown", theBuilder, this); return(false); } if (TxtANCNumber.Text == "" && TxtPMTCTNumber.Text == "" && TxtAdmissionNumber.Text == "" && TxtOutPatientNumber.Text == "") { IQCareMsgBox.Show("PMTCTEnrol_ANC", this); return(false); } IPatientRegistration ValMgrPMTCT = (IPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter); string msg = ""; if (TxtANCNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtANCNumber.Text, "ANC"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") if (Convert.ToInt32(Session["PatientId"]) > 0) //i.e. update mode { if (theDT.Rows[0]["IDNumber"].ToString() != Convert.ToString(ViewState["ANC"])) { msg = "ANC" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "ANC" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } if (TxtPMTCTNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtPMTCTNumber.Text, "PMTCT"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") //if (Request.QueryString["Name"] != "Add") //i.e. edit mode if (Convert.ToInt32(Session["PatientId"]) > 0) { if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["PMTCT"].ToString()) { msg = "PMTCT" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "PMTCT" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } if (TxtAdmissionNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtAdmissionNumber.Text, "Admission"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") //if (Request.QueryString["Name"] != "Add") //i.e. edit mode if (Convert.ToInt32(Session["PatientId"]) > 0) { if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["Admission"].ToString()) { msg = "Admission" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "Admission" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } if (TxtOutPatientNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtOutPatientNumber.Text, "Outpatient"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") //if (Request.QueryString["Name"] != "Add") //i.e. edit mode if (Convert.ToInt32(Session["PatientId"]) > 0) { if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["Outpatient"].ToString()) { msg = "OutpatientNumber" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "OutpatientNumber" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } return(true); }