public string this[string columnName] { get { return(columnName switch { "ShortName" when string.IsNullOrEmpty(ShortName.Trim()) => "Short Name can't be empty", "LongName" when string.IsNullOrEmpty(LongName.Trim()) => "Long Name can't be empty", "Age" when Age < 18 || Age > 100 => "Age must be between [18, 100]", "Height" when Height < 100 || Height > 300 => "Height must be between [100, 300]", "Weight" when Weight < 40 || Weight > 200 => "Weight must be between [40, 200]", "Club" when string.IsNullOrEmpty(Club.Trim()) => "Club can't be empty", "Nationality" when string.IsNullOrEmpty(Nationality.Trim()) => "Nationality can't be empty", "Overall" when Overall < 0 || Overall > 100 => "Overall must be between [0, 100]", "Potential" when Potential < 0 || Potential > 100 => "Potential must be between [0, 100]", "SofifaID" when SofifaID < 0 => "SofifaID can't be negative", "PlayerURL" when string.IsNullOrEmpty(PlayerURL.Trim()) => "Player URL can't be empty", _ => null });
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Code != null) { hashCode = hashCode * 59 + Code.GetHashCode(); } if (ShortName != null) { hashCode = hashCode * 59 + ShortName.GetHashCode(); } if (LongName != null) { hashCode = hashCode * 59 + LongName.GetHashCode(); } if (ExternalReference != null) { hashCode = hashCode * 59 + ExternalReference.GetHashCode(); } return(hashCode); } }
public IsoFolderElement(TreeNode folderElement, bool isRoot, string childNumber) { Date = folderElement.CreationTime; LongName = folderElement.Name; // If you need to use the short name, then you may want to change the naming method. if (isRoot) { ShortName = "."; LongName = "."; } else { if (LongName.Length > 8) { ShortName = LongName.Substring(0, 8 - childNumber.Length).ToUpper().Replace(' ', '_').Replace('.', '_'); ShortName += childNumber; } else { ShortName = LongName.ToUpper().Replace(' ', '_').Replace('.', '_'); } } if (LongName.Length > IsoAlgorithm.FileNameMaxLength) { LongName = LongName.Substring(0, IsoAlgorithm.FileNameMaxLength - childNumber.Length) + childNumber; } }
/// <summary> /// Returns true if Grade instances are equal /// </summary> /// <param name="other">Instance of Grade to be compared</param> /// <returns>Boolean</returns> public bool Equals(Grade other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( LongName == other.LongName || LongName != null && LongName.Equals(other.LongName) ) && ( ShortName == other.ShortName || ShortName != null && ShortName.Equals(other.ShortName) ) && ( ExternalReference == other.ExternalReference || ExternalReference != null && ExternalReference.Equals(other.ExternalReference) )); }
/** * Create a {@link LongName} object * * @param sValue * The value to assign * @return Never <code>null</code>. */ public static LongName CreateLongName(string value) { LongName longName = new LongName(); longName.Value = value; return(longName); }
// TO DO: Use numeric constants below public async Task <Associate> Load(AssociateId id) { await using SqlCommand cmd = Db.Connection.CreateCommand(); cmd.CommandText = "SELECT ID, DUNSNumber, LongName, ShortName, IsParent, BusinessAssociateType, StatusId FROM Associate" + " WHERE ID = " + id.Value; Db.Connection.Open(); await using SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { return(null); } Associate associate = new Associate(new AssociateId(Convert.ToInt32(reader[0]))) { DUNSNumber = DUNSNumber.Create(Convert.ToInt32(reader[1])), LongName = LongName.Create(reader[2].ToString()), ShortName = ShortName.Create(reader[3].ToString()), IsParent = Convert.ToBoolean(reader[4]), AssociateType = (AssociateType)reader[5], Status = (Status)reader[6] }; return(associate); }
/// <summary> /// Returns true if HoursAssignmentOwningUnit instances are equal /// </summary> /// <param name="other">Instance of HoursAssignmentOwningUnit to be compared</param> /// <returns>Boolean</returns> public bool Equals(HoursAssignmentOwningUnit other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Code == other.Code || Code != null && Code.Equals(other.Code) ) && ( ShortName == other.ShortName || ShortName != null && ShortName.Equals(other.ShortName) ) && ( LongName == other.LongName || LongName != null && LongName.Equals(other.LongName) ) && ( ExternalReference == other.ExternalReference || ExternalReference != null && ExternalReference.Equals(other.ExternalReference) )); }
public override int GetHashCode() { int result; result = (Name != null ? Name.GetHashCode() : 0); result = 31 * result + (LongName != null ? LongName.GetHashCode() : 0); return(result); }
public Agent(DUNSNumber dunsNumber, LongName longName, ShortName shortName, ExternalAssociateType externalBusinessAssociateType) : base(dunsNumber, longName, shortName, externalBusinessAssociateType) { DUNSNumber = dunsNumber; LongName = longName; ShortName = shortName; ExternalBusinessAssociateType = externalBusinessAssociateType; }
protected EGMSAssociate(DUNSNumber dunsNumber, LongName longName, ShortName shortName) { DUNSNumber = dunsNumber; LongName = longName; ShortName = shortName; OperatingContexts = new List <OperatingContext>(); Users = new List <User>(); Contacts = new List <Contact>(); }
/// <summary> /// Returns a value that indicates whether the current instance and a specified <see cref="CommandLine.NameInfo"/> have the same value. /// </summary> /// <param name="other">The <see cref="CommandLine.NameInfo"/> instance to compare.</param> /// <returns><value>true</value> if this instance of <see cref="CommandLine.NameInfo"/> and <paramref name="other"/> have the same value; otherwise, <value>false</value>.</returns> public bool Equals(NameInfo other) { if (other == null) { return(false); } return(ShortName.Equals(other.ShortName) && LongName.Equals(other.LongName)); }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int hash = 31; hash = (hash * 17) + ShortName.GetHashCode(); hash = (hash * 17) + LongName.GetHashCode(); hash = (hash * 17) + Arguments.GetHashCode(); hash = (hash * 17) + Occurs.GetHashCode(); return(hash); } }
public sysDamageRoll(string n, string nl, int die, int number, int bonus, sysBaseStatistic per, int perdivide) : base() { this.Die = die; this.Number = number; this.Bonus = bonus; this.BonusPer = per; this.PerDivide = perdivide; this.LongName = toStringImpl(); this.Name = LongName.Substring(0, Math.Min(nwdbConst.LEN_SHORT, LongName.Length)); this.ItemsDamage = new List <sysItemType>(); }
public override int GetHashCode() { unchecked { var hashCode = Id; hashCode = (hashCode * 397) ^ (ShortName != null ? ShortName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LongName != null ? LongName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Hours; return(hashCode); } }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 29 + (RequestId != null ? RequestId.GetHashCode() : 0); hash = hash * 29 + TradeConditionId.GetHashCode(); hash = hash * 29 + ShortName.GetHashCode(); hash = hash * 29 + LongName.GetHashCode(); return(hash); } }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 29 + RequestId != null?RequestId.GetHashCode() : 0; hash = hash * 29 + SecurityTypeId.GetHashCode(); hash = hash * 29 + ShortName.GetHashCode(); hash = hash * 29 + LongName.GetHashCode(); return(hash); } }
public bool Equals(IOption other) { if (Name != null ? !Name.Equals(other.Name) : other.Name != null) { return(false); } if (LongName != null ? !LongName.Equals(other.LongName) : other.LongName != null) { return(false); } return(true); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$"); parameters.Add(LongName != null ? LongName.ToStepValue() : "$"); parameters.Add(PredefinedType.ToStepValue()); return(string.Join(", ", parameters.ToArray())); }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 29 + RequestId != null?RequestId.GetHashCode() : 0; hash = hash * 29 + ListedMarketId.GetHashCode(); hash = hash * 29 + ShortName.GetHashCode(); hash = hash * 29 + LongName.GetHashCode(); hash = hash * 29 + GroupId.GetHashCode(); hash = hash * 29 + ShortGroupName.GetHashCode(); return(hash); } }
public bool CheckIfCalledThisCommand(string textInput) { textInput = textInput?.Trim().ToLower(); if (string.IsNullOrEmpty(textInput)) { return(false); } if (textInput.ToLower().StartsWith(LongName.ToLower()) || textInput.ToLower().StartsWith(ShortName.ToLower())) { return(true); } return(false); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$"); parameters.Add(LongName != null ? LongName.ToStepValue() : "$"); parameters.Add(Phase != null ? Phase.ToStepValue() : "$"); parameters.Add(RepresentationContexts != null ? RepresentationContexts.ToStepValue() : "$"); parameters.Add(UnitsInContext != null ? UnitsInContext.ToStepValue() : "$"); return(string.Join(", ", parameters.ToArray())); }
public int CompareTo(object obj) { if (null == obj) { throw new ArgumentNullException("obj"); } Tuning tuning = obj as Tuning; if (null == tuning) { throw new ArgumentException(); } return(LongName.CompareTo(tuning.LongName)); }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int hash = 31; hash = (hash * 17) + ShortName.GetHashCode(); hash = (hash * 17) + LongName.GetHashCode(); hash = (hash * 17) + Count.GetHashCode(); foreach (var argument in Arguments) { hash = (hash * 17) + argument.GetHashCode(); } return(hash); } }
public override string ToString() { if (IsPositionalOption) { return(LongName.ToHyphenCase(CultureInfo)); } var name = LongName.ToHyphenCase(CultureInfo).AddLongNamePrefix(); if (!ShortName.HasValue) { return(name); } return(ShortName.Value.AddShortNamePrefix() + "|" + name); }
public int CompareTo(object obj) { if (null == obj) { throw new ArgumentNullException(nameof(obj)); } NamedInterval namedInterval = obj as NamedInterval; if (null == namedInterval) { throw new ArgumentException(); } return(LongName.CompareTo(namedInterval.LongName)); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$"); parameters.Add(ObjectPlacement != null ? ObjectPlacement.ToStepValue() : "$"); parameters.Add(Representation != null ? Representation.ToStepValue() : "$"); parameters.Add(LongName != null ? LongName.ToStepValue() : "$"); parameters.Add(CompositionType.ToStepValue()); parameters.Add(Elevation != null ? Elevation.ToStepValue() : "$"); return(string.Join(", ", parameters.ToArray())); }
public override string ToString() { string n; if (string.IsNullOrEmpty(Name)) { n = GetType().Name.Substring(3); } else { n = Name; } if (!string.IsNullOrEmpty(LongName) && Name != LongName) { n += " - " + LongName.ToString(); } return(n); }
public static Associate Create(int associateId, int dunsNumber, string longName, string shortName, bool isParent, bool isInternal, bool isDeactivating, AssociateTypeLookup associateType, StatusCodeLookup statusCode) { return(new Associate { Id = associateId, DUNSNumber = DUNSNumber.Create(dunsNumber), LongName = LongName.Create(longName), ShortName = ShortName.Create(shortName), IsParent = isParent, IsInternal = isInternal, IsDeactivating = isDeactivating, AssociateType = associateType, AssociateTypeId = associateType.AssociateTypeId, StatusCode = statusCode, StatusCodeId = statusCode.StatusCodeId }); }
#pragma warning disable 1998 public async Task <ActionResult <InternalAssociate> > Create([FromBody] CreateInternalAssociateDto item) #pragma warning restore 1998 { Result <DUNSNumber> dunsNumberOrError = DUNSNumber.Create(item.DUNSNumber); Result <LongName> longNameOrError = LongName.Create(item.LongName); Result <ShortName> shortNameOrError = ShortName.Create(item.ShortName); Result result = Result.Combine(dunsNumberOrError, longNameOrError, shortNameOrError); //if (result.IsFailure) // return Error(result.Error); InternalAssociate internalAssociate = new InternalAssociate(dunsNumberOrError.Value, longNameOrError.Value, shortNameOrError.Value, InternalAssociateType.LDC_FACILITY); _repository.AddInternalAssociate(internalAssociate); return(CreatedAtAction("Create", new { id = internalAssociate.Id }, internalAssociate)); }
/// <summary> /// Activate this parameter when found /// </summary> /// <param name="arguments">Arguments to process.</param> public override bool TryActivate(Queue <string> arguments) { if (arguments == null) { throw new ArgumentNullException(nameof(arguments)); } if (arguments.Count == 0) { return(false); } var arg = arguments.Peek(); if (arg.StartsWith(ShortName + ":", StringComparison.CurrentCultureIgnoreCase) || arg.StartsWith(AlternateShortName + ":", StringComparison.CurrentCultureIgnoreCase) || arg.StartsWith(LongName + ":", StringComparison.CurrentCultureIgnoreCase)) { arguments.Dequeue(); var value = arg.After(":").As <V>(); _values.Add(value); return(true); } if (ShortName.Equals(arg, StringComparison.CurrentCultureIgnoreCase) || AlternateShortName.Equals(arg, StringComparison.CurrentCultureIgnoreCase) || LongName.Equals(arg, StringComparison.CurrentCultureIgnoreCase)) { arguments.Dequeue(); if (arguments.Count < 1) { _valueMissing = true; return(true); } var value = arguments.Dequeue().As <V>(); _values.Add(value); return(true); } return(false); }