Esempio n. 1
0
    private bool CheckValues()
    {
        if (string.IsNullOrEmpty(txtBranchName.Text))
        {
            txtError.Text = "Enter Branch Name.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtAddress.Text))
        {
            txtError.Text = "Enter Branch Address.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtZipCode.Text))
        {
            txtError.Text = "Enter Zip Code of Branch.";
            return(false);
        }
        else if (!ValidationUtil.IsPositiveInteger(txtZipCode.Text))
        {
            txtError.Text = "Zip Code must be positive integer values.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtState.Text))
        {
            txtError.Text = "Enter State.";
            return(false);
        }
        else if (!ValidationUtil.IsName(txtState.Text))
        {
            txtError.Text = "State must be character values.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtPhone.Text))
        {
            txtError.Text = "Enter Telephone Number.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtFax.Text))
        {
            txtError.Text = "Enter Fax Number.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtOpenTime.DateInput.Text))
        {
            txtError.Text = "Enter Branch open time.";
            return(false);
        }
        if (string.IsNullOrEmpty(txtCloseTime.DateInput.Text))
        {
            txtError.Text = "Enter Branch close time.";
            return(false);
        }
        if (txtPercentage.Value == null)
        {
            txtError.Text = "Enter Tax Percentage.";
            return(false);
        }
        if (txtYes.Checked == txtNo.Checked)
        {
            txtError.Text = "Select Yes or No for branch delivery.";
            return(false);
        }
        else if (txtYes.Checked)
        {
            if (txtDeliveryTax.Value == null)
            {
                txtError.Text = "You must enter delivery charges.";
                return(false);
            }
        }

        return(true);
    }