コード例 #1
0
    private Boolean FieldValidation()
    {
        IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
        DateTime      theCurrentDate = (DateTime)IQCareSecurity.SystemDate();
        IQCareUtils   theUtils       = new IQCareUtils();

        if (DDFinalResult.SelectedItem.Value == "9")
        {
            spDeath.Visible = true;
        }

        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 (TxtInfantId.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Infant ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtInfantId.Focus();
            return(false);
        }

        try
        {
            int i = Convert.ToInt32(TxtInfantId.Text);
        }
        catch
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Infant ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDateOfBirth.Focus();
            return(false);
        }

        if (TxtDateOfBirth.Value.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "DOB";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDateOfBirth.Focus();
            return(false);
        }
        DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDateOfBirth.Value));

        if (theDOBDate > theCurrentDate)
        {
            IQCareMsgBox.Show("DOBDate", this);
            TxtDateOfBirth.Focus();
            return(false);
        }

        if (TxtDeathDate.Text != "")
        {
            spDeath.Visible = true;

            DateTime theDeathDate = Convert.ToDateTime(theUtils.MakeDate(TxtDeathDate.Text));
            if (theDeathDate > theCurrentDate)
            {
                IQCareMsgBox.Show("DeathDateCheck", this);
                TxtDeathDate.Focus();
                return(false);
            }
            if (theDeathDate < theDOBDate)
            {
                IQCareMsgBox.Show("DeathDOBDate", this);
                TxtDeathDate.Focus();
                return(false);
            }
        }



        //if (DDInfantFeedingPractice.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantFeed", this);
        //    DDInfantFeedingPractice.Focus();
        //    return false;
        //}
        //if (DDHIVTestType.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantHivTestType", this);
        //    DDHIVTestType.Focus();
        //    return false;
        //}
        //if (DDResult.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantResult", this);
        //    DDResult.Focus();
        //    return false;
        //}

        //if (DDFinalResult.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantFinalResult", this);
        //    DDFinalResult.Focus();
        //    return false;
        //}
        return(true);
    }
コード例 #2
0
    private Boolean FieldValidation()
    {
        IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
        DateTime      theCurrentDate = (DateTime)IQCareSecurity.SystemDate();
        IQCareUtils   theUtils       = new IQCareUtils();

        if (DDFinalResult.SelectedItem.Value == "9")
        {
            spDeath.Visible = true;
        }

        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 (TxtInfantId.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Infant ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtInfantId.Focus();
            return(false);
        }

        try
        {
            Int64 i = Convert.ToInt64(TxtInfantId.Text);
        }
        catch
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Infant ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDateOfBirth.Focus();
            return(false);
        }

        if (TxtDateOfBirth.Value.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "DOB";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDateOfBirth.Focus();
            return(false);
        }
        DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDateOfBirth.Value));

        if (theDOBDate > theCurrentDate)
        {
            IQCareMsgBox.Show("DOBDate", this);
            TxtDateOfBirth.Focus();
            return(false);
        }

        int Age = GetAge(theDOBDate);

        if (TxtDateOfBirth.Value != "")
        {
            Decimal AgeinYear = Math.Round(Convert.ToDecimal(Session["PatientAge"]), 0);
            if (Convert.ToDecimal(Age) >= AgeinYear)
            {
                //ScriptManager.RegisterStartupScript(this, GetType(), "PatientAge", "alert('Infant Age cannot be more than Parent Age');", true);
                MsgBuilder theMsg = new MsgBuilder();
                theMsg.DataElements["Control"] = "Infant Age cannot be more than Parent Age";
                IQCareMsgBox.Show("PatientAge", theMsg, this);
                TxtDateOfBirth.Focus();
                return(false);
            }
        }

        if (TxtDeathDate.Value != "")
        {
            spDeath.Visible = true;

            DateTime theDeathDate = Convert.ToDateTime(theUtils.MakeDate(TxtDeathDate.Value));
            if (theDeathDate > theCurrentDate)
            {
                IQCareMsgBox.Show("DeathDateCheck", this);
                TxtDeathDate.Focus();
                return(false);
            }
            if (theDeathDate < theDOBDate)
            {
                IQCareMsgBox.Show("DeathDOBDate", this);
                TxtDeathDate.Focus();
                return(false);
            }
        }



        //if (DDInfantFeedingPractice.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantFeed", this);
        //    DDInfantFeedingPractice.Focus();
        //    return false;
        //}
        //if (DDHIVTestType.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantHivTestType", this);
        //    DDHIVTestType.Focus();
        //    return false;
        //}
        //if (DDResult.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantResult", this);
        //    DDResult.Focus();
        //    return false;
        //}

        //if (DDFinalResult.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantFinalResult", this);
        //    DDFinalResult.Focus();
        //    return false;
        //}
        return(true);
    }