private string GenerateIdShort() { var shortName = ShortName.GetDefault(); var name = shortName.Length > 0 ? shortName : PreferredName.GetDefault(); return(Iec61360Utils.CreateIdShort(name)); }
private List <int> VerifyPreferedName() { if (!Helpers.IsProperString(PreferredName)) { PreferredName = null; return(new List <int>()); } PreferredName = Helpers.CapitalizeFirstLetterOfEachWord(PreferredName.Trim()); var errors = new List <int>(); var lenTest = new Regex(@".{2,50}"); if (!lenTest.IsMatch(PreferredName)) { errors.Add(7); } var spTest = new Regex(@"^[A-Za-z_\-.'() ]*$"); if (!spTest.IsMatch(PreferredName)) { errors.Add(8); } return(errors); }
public override int GetHashCode() { unchecked { int result = (Name != null ? Name.GetHashCode() : 0); result = (result * 397) ^ (Description != null ? Description.GetHashCode() : 0); result = (result * 397) ^ (Accession != null ? Accession.GetHashCode() : 0); result = (result * 397) ^ (Gene != null ? Gene.GetHashCode() : 0); result = (result * 397) ^ (Species != null ? Species.GetHashCode() : 0); result = (result * 397) ^ (PreferredName != null ? PreferredName.GetHashCode() : 0); result = (result * 397) ^ (WebSearchInfo != null ? WebSearchInfo.GetHashCode() : 0); // not proper metadata but worth noting when it changes return(result); } }
public AdminShellV20.DataSpecificationIEC61360 ToDataSpecification() { var ds = new AdminShellV20.DataSpecificationIEC61360() { definition = Definition.ToLangStringSet(), preferredName = PreferredName.ToLangStringSet(), shortName = ShortName.ToLangStringSet(), }; if (DefinitionSource.Length > 0) { ds.sourceOfDefinition = DefinitionSource; } if (Symbol.Length > 0) { ds.symbol = Symbol; } if (Unit.Length > 0) { ds.unit = Unit; } if (UnitIrdi.Length > 0) { ds.unitId = AdminShellV20.UnitId.CreateNew( AdminShellV20.Key.GlobalReference, false, AdminShellV20.Identification.IRDI, UnitIrdi); } if (DataType.Length > 0) { ds.dataType = DataType; } if (DataFormat.Length > 0) { ds.valueFormat = DataFormat; } return(ds); }
/// <summary> /// Compares two GedcomName instances by using the full name. /// </summary> /// <param name="other">The name to compare against this instance.</param> /// <returns>An integer specifying the relative sort order.</returns> public int CompareTo(GedcomName other) { if (other == null) { return(1); } var compare = string.Compare(Type, other.Type); if (compare != 0) { return(compare); } compare = GedcomGenericListComparer.CompareListOrder(PhoneticVariations, other.PhoneticVariations); if (compare != 0) { return(compare); } compare = GedcomGenericListComparer.CompareListOrder(RomanizedVariations, other.RomanizedVariations); if (compare != 0) { return(compare); } compare = string.Compare(Surname, other.Surname); if (compare != 0) { return(compare); } compare = string.Compare(Prefix, other.Prefix); if (compare != 0) { return(compare); } compare = string.Compare(Given, other.Given); if (compare != 0) { return(compare); } compare = string.Compare(SurnamePrefix, other.SurnamePrefix); if (compare != 0) { return(compare); } compare = string.Compare(Suffix, other.Suffix); if (compare != 0) { return(compare); } compare = string.Compare(Nick, other.Nick); if (compare != 0) { return(compare); } compare = PreferredName.CompareTo(other.PreferredName); if (compare != 0) { return(compare); } return(compare); }