Exemplo n.º 1
0
    public string GetNextAvailableName()
    {
        int i = 0;

        while (Componets.Any(x => x.FieldName.Equals(string.Format("{0} {1}", DefaultComponentName, i))))
        {
            i++;
        }
        return(string.Format("{0} {1}", DefaultComponentName, i));
    }
Exemplo n.º 2
0
    //methods--------------------------------------------------------------------------------------------
    public void ValidateFieldName(EntryComponent component)
    {
        if (!Componets.Contains(component))
        {
            throw new ArgumentException("component does not belong to entry");
        }

        if (string.IsNullOrEmpty(component.FieldName))
        {
            throw new ArgumentNullException("field new name must not be null");
        }

        if (Componets.Any(x => x != component && x.FieldName.Equals(component.FieldName)))
        {
            component.FieldName = GetNextAvailableName();
        }
    }