public string this[string columnName]
        {
            get
            {
                string error = null;

                switch (columnName)
                {
                case "DbConnectionTimeout":
                    if (DbConnectionTimeout <= 0)
                    {
                        error = "Please enter a database timeout greater than 0 seconds.";
                    }
                    break;

                case "IncidTablePageSize":
                    if (IncidTablePageSize <= 0)
                    {
                        error = "Please enter a database page size greater than 0 rows.";
                    }
                    break;

                case "HistoryDisplayLastN":
                    if (HistoryDisplayLastN <= 0)
                    {
                        error = "Number of history rows to be displayed must be greater than 0.";
                    }
                    break;

                case "PreferredGis":
                    if (GisAppsEnabled && (PreferredGis == GISApplications.None))
                    {
                        error = "Please select your preferred GIS application.";
                    }
                    break;

                case "MapPath":
                    if (String.IsNullOrEmpty(MapDocument))
                    {
                        error = "Please enter a path to a GIS workspace.";
                    }
                    else
                    {
                        string msg;
                        if (!ValidateMapPath(out msg))
                        {
                            error = msg;
                        }
                    }
                    break;

                case "HistoryColumns":
                    if (_historyColumns.Count(h => h.IsSelected) == 0)
                    {
                        error = "Please select columns to be recorded in history trail.";
                    }
                    break;

                case "SeasonSpring":
                    if (String.IsNullOrEmpty(SeasonSpring))
                    {
                        error = "Please enter a season name for spring.";
                    }
                    break;

                case "SeasonSummer":
                    if (String.IsNullOrEmpty(SeasonSummer))
                    {
                        error = "Please enter a season name for summer.";
                    }
                    break;

                case "SeasonAutumn":
                    if (String.IsNullOrEmpty(SeasonAutumn))
                    {
                        error = "Please enter a season name for autumn.";
                    }
                    break;

                case "SeasonWinter":
                    if (String.IsNullOrEmpty(SeasonWinter))
                    {
                        error = "Please enter a season name for winter.";
                    }
                    break;

                case "VagueDateDelimiter":
                    if (String.IsNullOrEmpty(VagueDateDelimiter))
                    {
                        error = "Please enter a vague date delimiter character.";
                    }
                    else if (VagueDateDelimiter.Length > 1)
                    {
                        error = "Vague date delimiter must be a single character.";
                    }
                    break;
                }

                CommandManager.InvalidateRequerySuggested();

                return(error);
            }
        }
Beispiel #2
0
        public string this[string columnName]
        {
            get
            {
                string error = null;

                switch (columnName)
                {
                    //---------------------------------------------------------------------
                    // FIX: 017 Validate that mandatory values are not blank
                    // Validate that the database timeout period, database page size and
                    // history rows to display are not null.
                    //---------------------------------------------------------------------
                    case "DbConnectionTimeout":
                        if (Convert.ToInt32(DbConnectionTimeout) <= 0 || DbConnectionTimeout == null)
                            error = "Please enter a database timeout greater than 0 seconds.";
                        break;
                    case "IncidTablePageSize":
                        if (Convert.ToInt32(IncidTablePageSize) <= 0 || IncidTablePageSize == null)
                            error = "Please enter a database page size greater than 0 rows.";
                        break;
                    case "HistoryDisplayLastN":
                        if (Convert.ToInt32(HistoryDisplayLastN) <= 0 || HistoryDisplayLastN == null)
                            error = "Number of history rows to be displayed must be greater than 0.";
                        break;
                    //---------------------------------------------------------------------
                    case "PreferredGis":
                        if (GisAppsEnabled && (PreferredGis == GISApplications.None))
                            error = "Please select your preferred GIS application.";
                        break;
                    case "MapDocument":
                        if (String.IsNullOrEmpty(MapDocument))
                        {
                            error = "Please enter a path to a GIS workspace.";
                        }
                        else
                        {
                            string msg;
                            if (!ValidateMapPath(out msg)) error = msg;
                        }
                        break;
                    case "HistoryColumns":
                        if (_historyColumns.Count(h => h.IsSelected) == 0)
                            error = "Please select columns to be recorded in history trail.";
                        break;
                    //---------------------------------------------------------------------
                    // CHANGED: CR10 (Attribute updates for incid subsets)
                    // Validate the users preferred action when updating a
                    // subset of features for an incid.
                    case "SubsetUpdateAction":
                        if (SubsetUpdateAction == null)
                            error = "Please select the action to take when updating an incid subset.";
                        break;
                    //---------------------------------------------------------------------
                    //---------------------------------------------------------------------
                    // CHANGED: CR29 (Habitat classification and conversion to IHS)
                    // Validate the users preferred habitat class.
                    case "PreferredHabitatClass":
                        if (PreferredHabitatClass == null)
                            error = "Please select your preferred habitat class.";
                        break;
                    //---------------------------------------------------------------------
                    //---------------------------------------------------------------------
                    // CHANGED: CR5 (Select by attributes interface)
                    // Validate the maximum number of rows to be retrieved
                    // when getting values for a data column when building
                    // a sql query.
                    case "GetValueRows":
                        if (Convert.ToInt32(GetValueRows) <= 0 || GetValueRows == null)
                            error = "Number of value rows to be retrieved must be greater than 0.";
                        if (Convert.ToInt32(GetValueRows) > Settings.Default.MaxGetValueRows)
                            error = String.Format("Number of value rows to be retrieved must not be greater than {0}.", Settings.Default.MaxGetValueRows);
                        break;
                    //---------------------------------------------------------------------
                    case "SeasonSpring":
                        if (String.IsNullOrEmpty(SeasonSpring))
                            error = "Please enter a season name for spring.";
                        break;
                    case "SeasonSummer":
                        if (String.IsNullOrEmpty(SeasonSummer))
                            error = "Please enter a season name for summer.";
                        break;
                    case "SeasonAutumn":
                        if (String.IsNullOrEmpty(SeasonAutumn))
                            error = "Please enter a season name for autumn.";
                        break;
                    case "SeasonWinter":
                        if (String.IsNullOrEmpty(SeasonWinter))
                            error = "Please enter a season name for winter.";
                        break;
                    case "VagueDateDelimiter":
                        if (String.IsNullOrEmpty(VagueDateDelimiter))
                            error = "Please enter a vague date delimiter character.";
                        else if (VagueDateDelimiter.Length > 1)
                            error = "Vague date delimiter must be a single character.";
                        break;
                }

                CommandManager.InvalidateRequerySuggested();

                return error;
            }
        }