Exemple #1
0
        //public void ButtonSave() {
        //    MessageBox.Show(Validation.isStringWithoutNumbers("hel3lo").ToString());
        //}

        /// <summary>
        /// Validate fields in frm_Projects check if they are all in prefered format, if it is
        /// return true, else return false.
        /// </summary>
        /// <returns></returns>
        public Boolean ValidateFields()
        {
            // Validate Project Basic Details

            // + Land Info
            foreach (Control control in landInfo_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + Profile Info, no Validations for the date since we get it from dtp
            foreach (Control control in profileInfo_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isStringWithoutNumbers(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + cost of purchase
            foreach (Control control in costOfPurchase_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + survey charges
            foreach (Control control in surveyCharges_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + develpoment
            foreach (Control control in development_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + utilities
            foreach (Control control in utilities_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + travelling
            foreach (Control control in travelling_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // + advertising
            foreach (Control control in advertising_gb.Controls)
            {
                if (control is TextBox)
                {
                    if (!Validation.isNumber(control.Text))
                    {
                        return(false);
                    }
                }
            }

            // cost, sales and profitability part should be validated.

            return(true);
        }