Exemplo n.º 1
0
        /// <summary>
        /// Checks if fields, containg mandatory and compulsory data, has been filled with valid data.
        /// </summary>
        /// <returns>Bool telling if fields contains valid data.</returns>
        private bool ValidateControls()
        {
            bool validationResult = true;

            if (!ValidatorHelper.FirstNameCheckAndSetErrors(tbFirstName.Text, epFirstName, labelFirstName))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.LastNameCheckAndSetErrors(tbLastName.Text, epLastName, labelLastName))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.PhoneCheckAndSetErrors(tbPhone.Text, epPhone, labelPhone))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.EmailCheckAndSetErrors(tbEmail.Text, epEmail, labelEmail))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.ManufacturerCheckAndSetErrors(tbManufacturer.Text, epManufacturer, labelManufacturer))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.ModelCheckAndSetErrors(tbModel.Text, epModel, labelModel))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.FrameNoCheckAndSetErrors(tbFrameNo.Text, epFrameNo, labelFrameNo))
            {
                validationResult = false;
            }
            //if (!ValidatorHelper.AdditionalInfoValidation(tbAdditionalInfo.Text, epAddidtionalInfo, labelAdditionalInfo)) validationResult = false;
            if (!ValidatorHelper.DatesCheckAndSetErrors(dtpStartDate.Value, dtpEndDate.Value, epStartDate, epEndDate, labelStartDate, labelEndDate))
            {
                validationResult = false;
            }

            if (!ValidatorHelper.CostCheckAndSetErrors(tbCost.Text, epCost, labelCost, tbCost))
            {
                validationResult = false;
            }
            if (!ValidatorHelper.DescriptionCheckAndSetErrors(tbDescription.Text, epDescription, labelDescription))
            {
                validationResult = false;
            }

            return(validationResult);
        }
Exemplo n.º 2
0
 private void tbDescription_TextChanged(object sender, EventArgs e)
 {
     ValidatorHelper.DescriptionCheckAndSetErrors(tbDescription.Text, epDescription, labelDescription);
 }