/// <summary> /// Returns true if InputDateTimeFormat instances are equal /// </summary> /// <param name="other">Instance of InputDateTimeFormat to be compared</param> /// <returns>Boolean</returns> public bool Equals(InputDateTimeFormat other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Input == other.Input || Input != null && Input.Equals(other.Input) ) && ( Culture == other.Culture || Culture.Equals(other.Culture) ) && ( Format == other.Format || Format != null && Format.Equals(other.Format) )); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(ApplicationInformation <TIdType> obj) { if (obj != null) { // Transient objects are not considered as equal if (IsTransient() && obj.IsTransient()) { return(false); } else { // For safe equality we need to match on business key equality. // Base domain entities are functionally equal if their key and metadata and tags are equal. // Subclasses should extend to include their own enhanced equality checks, as required. if (TenantId != null) { return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && ApplicationKey.Equals(obj.ApplicationKey) && Name.Equals(obj.Name)); } else { return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && ApplicationKey.Equals(obj.ApplicationKey) && Name.Equals(obj.Name) && TenantId.Equals(obj.TenantId)); } } } return(false); }
// <summary> // Check if the item is localizable or not. // </summary> // <param name="fileItem"></param> // <returns></returns> private bool IsItemLocalizable(ITaskItem fileItem) { bool isLocalizable = false; // if the default culture is not set, by default all // the items are not localizable. if (Culture != null && Culture.Equals("") == false) { string localizableString; // Default culture is set, by default the item is localizable // unless it is set as false in the Localizable attribute. isLocalizable = true; localizableString = fileItem.GetMetadata(SharedStrings.Localizable); if (localizableString != null && String.Compare(localizableString, "false", StringComparison.OrdinalIgnoreCase) == 0) { isLocalizable = false; } } return(isLocalizable); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(GetOutputDtoBase <TIdType> obj) { if (obj != null) { return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && Name.Equals(obj.Name)); } return(false); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(CreateUpdateInputDtoBase <TIdType> obj) { if (obj != null) { return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && DescriptionShort.Equals(obj.DescriptionShort) && Name.Equals(obj.Name) && TranslatedFromId.Equals(obj.TranslatedFromId) ); } return(false); }
/// <summary> /// Use with care. If lang is an InputLanguage, new InputLanguage(lang).Equals(lang) is true. /// But I'm pretty sure lang.Equals(new InputLanguage(lang)) will not be. This violates the Equals contract. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { var other = obj as InputLanguageWrapper; if (other == null) { var lang = obj as InputLanguage; other = lang; } return(other != null && LayoutName == other.LayoutName && Culture.Equals(other.Culture) && Handle.Equals(other.Handle)); }
private bool HasSameData(TimeCalendar comp) { return(Culture.Equals(comp.Culture) && StartOffset == comp.StartOffset && EndOffset == comp.EndOffset && YearBaseMonth == comp.YearBaseMonth && FiscalYearBaseMonth == comp.FiscalYearBaseMonth && YearWeekType == comp.YearWeekType && _dayNameType == comp._dayNameType && _monthNameType == comp._monthNameType); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(GetDetailOutputDtoBase <TIdType> obj) { if (obj != null) { return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && DescriptionShort.Equals(obj.DescriptionShort) && CreationTime.Equals(obj.CreationTime) && CreatorUserName.Equals(obj.CreatorUserName) && LastModifierUserName.Equals(obj.LastModifierUserName) && LastModificationTime.Equals(obj.LastModificationTime) ); } return(false); }
/// <summary> /// Determines whether the specified object is the same as the current <see cref="TranslationBase"/> /// </summary> /// <param name="obj">The object to compare to the current <see cref="TranslationBase"/></param> /// <returns>Returns <c>true</c> if the objects match</returns> public override bool Equals(object obj) { if (obj == null) { return(false); } var other = obj as TranslationBase; if (other == null) { return(false); } return(String.Equals(Author, other.Author) && Culture.Equals(other.Culture)); }
public bool Equals(AssemblyDefinition other) { if (ReferenceEquals(this, other)) { return(true); } // Check if other is a null reference by using ReferenceEquals because // we overload the == operator. If other isn't actually null then // we get an infinite loop where we're constantly trying to compare to null. return(!ReferenceEquals(other, null) && string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase) && Version.Equals(other.Version) && Culture.Equals(other.Culture) && string.Equals(PublicKeyToken, other.PublicKeyToken, StringComparison.OrdinalIgnoreCase)); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(GetAllInputDtoBase <TIdType> obj) { if (obj != null) { return(Name.Equals(obj.Name) && Culture.Equals(obj.Culture) && TenantId.Equals(obj.TenantId) && DescriptionShort.Equals(obj.DescriptionShort) && DescriptionFull.Equals(obj.DescriptionFull) && IsActive.Equals(obj.IsActive) && CreationTime.Equals(obj.CreationTime) && CreatorUserName.Equals(obj.CreatorUserName) && LastModifierUserName.Equals(obj.LastModifierUserName) && LastModificationTime.Equals(obj.LastModificationTime) ); } return(false); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(GetAdminOutputDtoBase <TIdType> obj) { if (obj != null) { return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && TranslatedFromId.Equals(obj.TranslatedFromId) && IsActive.Equals(obj.IsActive) && IsDeleted.Equals(obj.IsDeleted) && DescriptionFull.Equals(obj.DescriptionFull) && CreationTime.Equals(obj.CreationTime) && CreatorUserId.Equals(obj.CreatorUserId) && CreatorUserName.Equals(obj.CreatorUserName) && LastModifierUserId.Equals(obj.LastModifierUserId) && LastModifierUserName.Equals(obj.LastModifierUserName) && LastModificationTime.Equals(obj.LastModificationTime) ); } return(false); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(TenantSpecificAggregateRootBase <TIdType> obj) { if (obj != null) { // Transient objects are not considered as equal if (IsTransient() && obj.IsTransient()) { return(false); } else { // For safe equality we need to match on business key equality. // Base domain entities are functionally equal if their key and metadata are equal. // Subclasses should extend to include their own enhanced equality checks, as required. return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture)); } } return(false); }
/// <summary> /// Equality method between two objects of the same type. /// Because the Equals method is strongly typed by generic constraints, /// it is not necessary to test for the correct object type. /// For safety we just want to match on business key value - in this case the fields /// that cannot be different between the two objects if they are supposedly equal. /// </summary> /// <param name="obj">The other object of this type that we are testing equality with</param> /// <returns></returns> public virtual bool Equals(UserOwnedDomainEntityBase <TIdType> obj) { if (obj != null) { // Transient objects are not considered as equal if (IsTransient() && obj.IsTransient()) { return(false); } else { // For safe equality we need to match on business key equality. // Base domain entities are functionally equal if their key and metadata are equal. // Subclasses should extend to include their own enhanced equality checks, as required. return(Id.Equals(obj.Id) && Culture.Equals(obj.Culture) && ExternalId.Equals(obj.ExternalId) && IsActive.Equals(obj.IsActive) && IsDeleted.Equals(obj.IsDeleted) && UserId.Equals(obj.UserId)); } } return(false); }
public override bool Equals(object obj) { if (!(obj is UserDto entity)) { return(false); } if (Id == entity.Id && UserName.Equals(entity.UserName, StringComparison.Ordinal) && PasswordHash.Equals(entity.PasswordHash, StringComparison.Ordinal) && Salt.Equals(entity.Salt, StringComparison.Ordinal) && Email.Equals(entity.Email, StringComparison.Ordinal) && Firstname.Equals(entity.Firstname, StringComparison.OrdinalIgnoreCase) && Surname.Equals(entity.Surname, StringComparison.OrdinalIgnoreCase) && Culture.Equals(entity.Culture, StringComparison.OrdinalIgnoreCase) && Timezone.Equals(entity.Timezone, StringComparison.OrdinalIgnoreCase) && Amount == entity.Amount) { return(true); } return(false); }
/// <exclude /> public bool Equals(CompositeC1SiteMapNode obj) { return(Key == obj.Key && Culture.Equals(obj.Culture)); }
/// <exclude /> public bool Equals(CmsPageSiteMapNode obj) { return(Key == obj.Key && Culture.Equals(obj.Culture)); }
public async void ChangeSettingsMethod() { var needsRestart = false; var dbBeenChanged = false; var seasonRate = 0; var seriesRate = 0; var allTimeRate = 0; var xml = new XmlDocument(); xml.Load($@"{System.IO.Directory.GetCurrentDirectory()}\Settings.xml"); var seasonBalNode = xml.SelectSingleNode("/Settings/SeasonBal"); if (seasonBalNode != null) { seasonRate = Convert.ToInt32(seasonBalNode.InnerText); } var seriesBalNode = xml.SelectSingleNode("/Settings/SeriesBal"); if (seriesBalNode != null) { seriesRate = Convert.ToInt32(seriesBalNode.InnerText); } var allTimeBalNode = xml.SelectSingleNode("/Settings/AllTimeBal"); if (allTimeBalNode != null) { allTimeRate = Convert.ToInt32(allTimeBalNode.InnerText); } if (seasonRate != 0 && seasonRate != SeasonBal) { foreach (var s in _context.SeasonRatingDbSet) { s.Rating = s.Games < SeasonBal ? 0 : Math.Round((s.Score ?? 0) / s.Games * 100, 3); } dbBeenChanged = true; } if (seriesRate != 0 && seriesRate != SeriesBal) { foreach (var s in _context.SeriesRatingDbSet) { s.Rating = s.Games < SeriesBal ? 0 : Math.Round((s.Score ?? 0) / s.Games * 100, 3); } dbBeenChanged = true; } if (allTimeRate != 0 && allTimeRate != AllTimeBal) { foreach (var s in _context.AllTimeRatingDbSet) { s.Rating = s.Games < AllTimeBal ? 0 : Math.Round((s.Score ?? 0) / s.Games * 100, 3); } dbBeenChanged = true; } if (dbBeenChanged) { await _settingswindow.ShowMessageAsync("SUCCESS", GetLocalized("DbRefreshedMessage"), MessageDialogStyle.Affirmative, _settings); } if (seasonBalNode != null) { seasonBalNode.InnerText = SeasonBal.ToString(); } if (seriesBalNode != null) { seriesBalNode.InnerText = SeriesBal.ToString(); } if (allTimeBalNode != null) { allTimeBalNode.InnerText = AllTimeBal.ToString(); } if (NickBefore != NickAfter && !string.IsNullOrEmpty(NickBefore) && !string.IsNullOrEmpty(NickAfter)) { var foundInSeason = _context.SeasonRatingDbSet.FirstOrDefault(x => x.Nick == NickBefore); if (foundInSeason != null) { foundInSeason.Nick = NickAfter; foundInSeason.NickNormalized = NickAfter.ToLower(); } var foundInSeries = _context.SeriesRatingDbSet.FirstOrDefault(x => x.Nick == NickBefore); if (foundInSeries != null) { foundInSeries.Nick = NickAfter; foundInSeries.NickNormalized = NickAfter.ToLower(); } var foundInAllTime = _context.AllTimeRatingDbSet.FirstOrDefault(x => x.Nick == NickBefore); if (foundInAllTime != null) { foundInAllTime.Nick = NickAfter; foundInAllTime.NickNormalized = NickAfter.ToLower(); } var foundInWeek = _context.WeekRatingDbSet.FirstOrDefault(t => t.Nick == NickBefore); if (foundInWeek != null) { foundInWeek.Nick = NickAfter; foundInWeek.NickNormalized = NickAfter.ToLower(); } await _settingswindow.ShowMessageAsync("SUCCESS", GetLocalized("NickChangedMessage"), MessageDialogStyle.Affirmative, _settings); } if (!string.IsNullOrEmpty(ExtraScoreNick) && NicksCollection.Contains(ExtraScoreNick) && ExtraScoreValue != null) { var seasonTarget = _context.SeasonRatingDbSet.FirstOrDefault(t => t.Nick == ExtraScoreNick); if (seasonTarget != null) { seasonTarget.Score += ExtraScoreValue.Value; seasonTarget.Rating = Math.Round((seasonTarget.Score ?? 0) / seasonTarget.Games * 100, 3); await _settingswindow.ShowMessageAsync("SUCCESS", GetLocalized("PtsAddedMessage"), MessageDialogStyle.Affirmative, _settings); } var seriesTarget = _context.SeriesRatingDbSet.FirstOrDefault(t => t.Nick == ExtraScoreNick); if (seriesTarget != null) { seriesTarget.Score += ExtraScoreValue.Value; seriesTarget.Rating = Math.Round((seriesTarget.Score ?? 0) / seriesTarget.Games * 100, 3); await _settingswindow.ShowMessageAsync("SUCCESS", GetLocalized("PtsAddedMessage"), MessageDialogStyle.Affirmative, _settings); } var weekTarget = _context.WeekRatingDbSet.FirstOrDefault(t => t.Nick == ExtraScoreNick); if (weekTarget != null) { weekTarget.Score += ExtraScoreValue.Value; weekTarget.Rating = Math.Round((weekTarget.Score ?? 0) / weekTarget.Games * 100, 3); await _settingswindow.ShowMessageAsync("SUCCESS", GetLocalized("PtsAddedMessage"), MessageDialogStyle.Affirmative, _settings); } var allTimeTarget = _context.AllTimeRatingDbSet.FirstOrDefault(t => t.Nick == ExtraScoreNick); if (allTimeTarget != null) { allTimeTarget.Score += ExtraScoreValue.Value; allTimeTarget.Rating = Math.Round((allTimeTarget.Score ?? 0) / allTimeTarget.Games * 100, 3); await _settingswindow.ShowMessageAsync("SUCCESS", GetLocalized("PtsAddedMessage"), MessageDialogStyle.Affirmative, _settings); } } if (!Culture.Equals(GetCulture())) { needsRestart = true; var languageNode = xml.SelectSingleNode("/Settings/Language"); if (languageNode != null) { languageNode.InnerText = Culture.Name; } } if (ApplyRatio != IsApplyRatio()) { var ratioNode = xml.SelectSingleNode("/Settings/UseFiimRatio"); if (ratioNode != null) { ratioNode.InnerText = ApplyRatio ? "True" : "False"; } } xml.Save($@"{System.IO.Directory.GetCurrentDirectory()}\Settings.xml"); _context.SaveChanges(); if (!needsRestart) { return; } var result = await ShowMetroDialog("ADD TO DB", GetLocalized("ChangeLanguageMessage"), MessageDialogStyle.AffirmativeAndNegative) .ConfigureAwait(true); if (result == MessageDialogResult.Negative) { return; } Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); }