private Boolean validateEdit()
    {
        DataSet          theDS = new DataSet();
        IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");

        theDS = PatientTransferMgr.GetDataValidate(PatientId, txtTransferDate.Value);

        //Satellite Cannot Be Blank - 0
        if (ddSatelliteEdit.SelectedValue == "0")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "New Satellite";
            IQCareMsgBox.Show("BlankDropDown", theBuilder, this);
            return(false);
        }
        //Transfer Date cannot be Blank - 1
        if (TxtTransDateEdit.Text == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Transfer Date";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            txtTransferDate.Focus();
            return(false);
        }

        //Transfer Date cannot be greater than Enrolment Registration Date - 2
        if (Convert.ToDateTime(TxtTransDateEdit.Text) < Convert.ToDateTime(theDS.Tables[3].Rows[0]["VisitDate"].ToString()))
        {
            IQCareMsgBox.Show("TransferDate", this);
            txtTransferDate.Focus();
            return(false);
        }

        //Cannot Tranfer a patient more than one satellite on same date - 3
        if (Convert.ToInt32(theDS.Tables[0].Rows[0]["DateExist"]) > 0)
        {
            IQCareMsgBox.Show("TransferDate_2", this);
            TxtTransDateEdit.Focus();
            return(false);
        }

        //Transfer date should be greater than the previous date - 4


        //Transfer Date Cannot Greater than the Current Date - 5
        if (Convert.ToDateTime(TxtTransDateEdit.Text) > Convert.ToDateTime(Application["AppCurrentDate"].ToString()))
        {
            IQCareMsgBox.Show("TransferDate_1", this);
            txtTransferDate.Focus();
            return(false);
        }
        //Validation between two dates
        DataSet theDS1 = new DataSet();

        theDS1 = PatientTransferMgr.GetDateValidateBetween(PatientId, ViewState["TransferDate"].ToString());
        if (Convert.ToInt32(theDS1.Tables[1].Rows[0]["ID"]) > Convert.ToInt32(TransferId))
        {
            IQCareMsgBox.Show("TransferDate_3", this);
            TxtTransDateEdit.Focus();
            return(false);
        }

        //Current Satellite and New Satellite cannot be same.
        if (txtFromSatellite.Text == ddSatelliteEdit.SelectedItem.Text)
        {
            IQCareMsgBox.Show("DD_Satellite", this);
            ddSatelliteEdit.SelectedValue = "0";
            return(false);
        }

        return(true);
    }
    private Boolean validate()
    {
        DataSet          theDS = new DataSet();
        IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");

        theDS = PatientTransferMgr.GetDataValidate(PatientId, txtTransferDate.Value);
        //Satellite Cannot Be Blank - 0
        if (ddSatellite.SelectedValue == "0")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "New Satellite";
            IQCareMsgBox.Show("BlankDropDown", theBuilder, this);
            return(false);
        }

        //Transfer Date cannot be Blank - 1
        if (txtTransferDate.Value == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Transfer Date";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            txtTransferDate.Focus();
            return(false);
        }

        ////Transfer Date cannot be less than Latest Visit Dates - 2
        //if (Convert.ToDateTime(txtTransferDate.Value) < Convert.ToDateTime(theDS.Tables[3].Rows[0]["VisitDate"].ToString()))
        //{
        //    IQCareMsgBox.Show("TransferDate", this);
        //    txtTransferDate.Focus();
        //    return false;
        //}

        ////Cannot Tranfer a patient more than one satellite on same date - 3
        //if (Convert.ToInt32(theDS.Tables[0].Rows[0]["DateExist"]) > 0)
        //{
        //    IQCareMsgBox.Show("TransferDate_2", this);
        //    txtTransferDate.Focus();
        //    return false;
        //}

        ////Transfer date should be greater than the previous date - 4
        //if (Convert.ToInt32(theDS.Tables[1].Rows[0]["Exist"]) == 1)
        //{
        //    if (Convert.ToDateTime(theDS.Tables[1].Rows[0]["TransferredDate"]) > Convert.ToDateTime(txtTransferDate.Value))
        //    {
        //        IQCareMsgBox.Show("TransferDate_3", this);
        //        txtTransferDate.Focus();
        //        return false;
        //    }
        //}

        ////Transfer Date Cannot Greater than the Current Date - 5
        //if (Convert.ToDateTime(txtTransferDate.Value) > Convert.ToDateTime(Application["AppCurrentDate"]))
        //{
        //    IQCareMsgBox.Show("TransferDate_1", this);
        //    txtTransferDate.Focus();
        //    return false;
        //}

        //Current Satellite and New Satellite cannot be same.
        if (txtLocationName.Text == ddSatellite.SelectedItem.Text)
        {
            IQCareMsgBox.Show("DD_Satellite", this);
            ddSatellite.SelectedValue = "0";
            return(false);
        }

        return(true);
    }