Example #1
0
        private void SetupFormValidationRules()
        {
            try
            {
                Form thisForm = (Form)this;
                m_formValidation = new FormValidation(ref thisForm, ref btnSubmit);

                FieldProxy field = null;

                field = new FieldProxy();
                field.Name = "WELLSITE_SITE";
                field.Type = esriFieldType.esriFieldTypeDouble;
                field.Precision = 15;
                field.Scale = 0;
                field.IsNullable = false;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtWellsiteSID,enumTextEntryTypes.intnum);

                field = new FieldProxy();
                field.Name = "UTM_NORTHING";
                field.Type = esriFieldType.esriFieldTypeDouble;
                field.Precision = 13;
                field.Scale = 4;
                field.IsNullable = true;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtUTMnorthing,enumTextEntryTypes.decnum);

                field = new FieldProxy();
                field.Name = "UTM_EASTING";
                field.Type = esriFieldType.esriFieldTypeDouble;
                field.Precision = 12;
                field.Scale = 4;
                field.IsNullable = true;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtUTMeasting,enumTextEntryTypes.decnum);

                field = new FieldProxy();
                field.Name = "UTM_ZONE";
                field.Type = esriFieldType.esriFieldTypeInteger;
                field.Precision = 10;
                field.IsNullable = true;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtUTMzone,enumTextEntryTypes.intnum,new CustomTextBoxValidator(CustomUTMZoneValidation));

                field = new FieldProxy();
                field.Name = "LATITUDE";
                field.Type = esriFieldType.esriFieldTypeDouble;
                field.Precision = 11;
                field.Scale = 7;
                field.IsNullable = true;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtLatitude,enumTextEntryTypes.decnum);

                field = new FieldProxy();
                field.Name = "LONGITUDE";
                field.Type = esriFieldType.esriFieldTypeDouble;
                field.Precision = 11;
                field.Scale = 7;
                field.IsNullable = true;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtLongitude,enumTextEntryTypes.decnum);

                field = new FieldProxy();
                field.Name = "BCGS_MAPSHEET";
                field.Type = esriFieldType.esriFieldTypeString;
                field.Length = 32;
                field.IsNullable = false;

                m_formValidation.AddControlValidationInfo(field,
                    ref txtBCGSMap,enumTextEntryTypes.text);

            }
            catch(Exception ex)
            {
                util.Logger.Write(" Descrip  : Setting up form validation rules. " +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);

                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }