Esempio n. 1
0
        /// <summary>
        /// Check so the user has entered a text in the TextBox for name
        /// </summary>
        /// <param name="name">A string variable passing customer name inputted by the user</param>
        /// <returns>True Validation (name must have atleast one char other than
        /// a blank space) is OK, false otherwise</returns>
        /// <remarks></remarks>
        private bool ReadAndValidateName(out string name)
        {
            name = txtName.Text;

            // calling CheckString method of InputUtility to validate name
            bool isInValid = InputUtility.CheckString(name);

            if (!isInValid)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Call GetDouble method of the InputUtility to convert the text given by the user
        /// in the price TextBox. Validate and then the converted value is checked with  a value >= 0 and less than or equal to a
        /// max ticket price (3500.00)
        /// </summary>
        /// <param name="price">Variable receiving the converted value</param>
        /// <returns>True if the convertion is successful and validation is OK, False otherwise</returns>
        private bool ReadAndValidatePrice(out double price)
        {
            string str = txtPrice.Text;

            double       min = 0.0;
            const double max = 3500.00; // delcaring a constant for max value

            bool isValid = InputUtility.GetDouble(str, out price, min, max);

            if (isValid)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }