public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (ColumnName.ToLower() == "publisheruri" || ColumnName.ToLower() == "publisherlabel" || ColumnName.ToLower() == "publisher uri" || ColumnName.ToLower() == "publisher label")
     {
         yield return(new ValidationResult("This column name is reserved.", new[] { "ColumnName" }));
     }
 }
Esempio n. 2
0
        public override int GetHashCode()
        {
            if (ColumnName == null)
            {
                return(0);
            }

            return(ColumnName.ToLower().GetHashCode());
        }
        public int Compare(object x, object y)
        {
            Show _x = (Show)x;
            Show _y = (Show)y;

            int r = 0;

            switch (ColumnName.ToLower())
            {
            case "tvdb id": r = CompareTvdbId(_x, _y); break;

            case "imdb id": r = CompareImdbId(_x, _y); break;

            case "name": r = CompareName(_x, _y); break;

            case "status": r = CompareStatus(_x, _y); break;

            case "network": r = CompareNetwork(_x, _y); break;

            case "run time": r = CompareRuntime(_x, _y); break;

            case "genre": r = CompareGenre(_x, _y); break;

            case "air day": r = CompareAirDay(_x, _y); break;

            case "latest episode": r = CompareLatestEpisode(_x, _y); break;

            case "latest aired": r = CompareLatestAired(_x, _y); break;

            case "next episode": r = CompareNextEpisode(_x, _y); break;

            case "next aired":
            case "how long": r = CompareNextAired(_x, _y); break;

            case "local folder": r = CompareLocalFolder(_x, _y); break;

            default: throw new Exception("Invalid column name " + ColumnName);
            }

            // 0 means same value, so then sort by DisplayName
            if (r == 0)
            {
                r = string.Compare(_x.DisplayName, _y.DisplayName);
            }

            // Check for descending
            if (Direction == ListSortDirection.Descending)
            {
                r *= -1;
            }

            return(r);
        }
Esempio n. 4
0
        public override bool Equals(object obj)
        {
            ColumnInfo test = obj as ColumnInfo;

            if (test != null)
            {
                return
                    (test.Schema.ToLower().Equals(Schema.ToLower()) &&
                     test.TableName.ToLower().Equals(TableName.ToLower()) &&
                     test.ColumnName.ToLower().Equals(ColumnName.ToLower()));
            }

            return(false);
        }
Esempio n. 5
0
        public override bool Equals(object obj)
        {
            ColumnInfo cr = obj as ColumnInfo;

            if (cr != null)
            {
                return
                    (Schema.ToLower().Equals(cr.Schema.ToLower()) &&
                     TableName.ToLower().Equals(cr.TableName.ToLower()) &&
                     ColumnName.ToLower().Equals(cr.ColumnName.ToLower()));
            }

            return(base.Equals(obj));
        }
Esempio n. 6
0
        public string ColumnsClassName(string className)
        {
            Guard.AgainstNullOrEmptyString(className, "className");

            var match = ColumnName.ToLower();

            foreach (var mapping in MainView.ColumnMapping)
            {
                if (mapping.Value.Contains(match))
                {
                    return(mapping.Key);
                }
            }

            return(string.Concat(className, "Columns"));
        }
Esempio n. 7
0
 public bool NameNotIn(string[] excludedNames)
 {
     return(!excludedNames.Contains(ColumnName.ToLower()));
 }
        /// <summary>
        ///Validate Fields and create LookupInfo if required
        /// </summary>
        public void InitFinish()
        {
            //  Not null fields
            if (DisplayLogic == null)
            {
                DisplayLogic = "";
            }
            if (DefaultValue == null)
            {
                DefaultValue = "";
            }
            if (FieldGroup == null)
            {
                FieldGroup = "";
            }
            if (Description == null)
            {
                Description = "";
            }
            if (Help == null)
            {
                Help = "";
            }
            if (Callout == null)
            {
                Callout = "";
            }
            if (ReadOnlyLogic == null)
            {
                ReadOnlyLogic = "";
            }


            //  Create Lookup, if not ID

            if (ctx.SkipLookup) //No need if call from Visual editor
            {
                return;
            }
            if (DisplayType.IsLookup(displayType))
            {
                if (IsDisplayedf || IsDisplayedMR || ColumnName.ToLower().Equals("createdby") || ColumnName.ToLower().Equals("updatedby"))
                {
                    try
                    {
                        lookupInfo = VLookUpFactory.GetLookUpInfo(ctx, windowNo, displayType,
                                                                  AD_Column_ID, Env.GetLanguage(ctx), ColumnName, AD_Reference_Value_ID,
                                                                  IsParent, ValidationCode);
                    }
                    catch (Exception e)     //  Cannot create Lookup
                    {
                        VLogger.Get().Log(Level.SEVERE, "No LookupInfo for " + ColumnName, e);
                        displayType = DisplayType.ID;
                    }
                }
                else
                {
                    displayType = DisplayType.ID;
                }
            }
        }