public override int GetHashCode() { int hash = Title.GetHashCode(); hash ^= Text.GetHashCode(); hash ^= Level.GetHashCode(); if (Image != null) { hash ^= Image.GetHashCode(); } hash ^= CategoryId.GetHashCode(); hash ^= Faction.GetHashCode(); hash ^= IsHidden.GetHashCode(); if (ClassRestricted) { foreach (var x in Classes) { hash ^= x.Fqn.GetHashCode(); } } if (HasPlanets) { foreach (var x in Planets) { hash ^= x.Id.GetHashCode(); } } return(hash); }
private void FillDropDown() { ItemRelationship.DisplayCategoryHierarchy(cboCategories, -1, PortalId, false); var li = new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1"); cboCategories.Items.Insert(0, li); li = cboCategories.Items.FindByValue(CategoryId.ToString(CultureInfo.InvariantCulture)); if (li != null) { li.Selected = true; } cboWorkflow.Visible = UseApprovals; lblWorkflow.Visible = UseApprovals; if (UseApprovals) { cboWorkflow.DataSource = DataProvider.Instance().GetApprovalStatusTypes(PortalId); cboWorkflow.DataValueField = "ApprovalStatusID"; cboWorkflow.DataTextField = "ApprovalStatusName"; cboWorkflow.DataBind(); li = cboWorkflow.Items.FindByText(ApprovalStatus.Waiting.Name); if (li != null) { li.Selected = true; } } }
public bool Equals(Product other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(base.Equals(other) && string.Equals(Name, other.Name) && string.Equals(BarCode, other.BarCode) && Price == other.Price && string.Equals(Description, other.Description) && IsPublished == other.IsPublished && Equals(Dimensions, other.Dimensions) && ManufacturerId.Equals(other.ManufacturerId) && Equals(Pictures, other.Pictures) && CategoryId.Equals(other.CategoryId) && Equals(Category, other.Category) && ProductTypeId == other.ProductTypeId && Equals(ProductType, other.ProductType) && string.Equals(ExternalSourceName, other.ExternalSourceName) && string.Equals(ExternalId, other.ExternalId)); }
public void MapNullProperties() { const int CategoryId = 1; const string CategoryName = null; DocumentMapperConfig.NewConfig <Category>() .WithId(c => c.Id) .WithAttribute(c => c.Name); var category = new Category { Id = CategoryId, Name = CategoryName }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); }
public SPDiagnosticsCategory this[CategoryId id] { get { return(Areas[DiagnosticsAreaName].Categories[id.ToString()]); } }
/// <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 (CategoryId != null) { hashCode = hashCode * 59 + CategoryId.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Info != null) { hashCode = hashCode * 59 + Info.GetHashCode(); } if (CategoryItems != null) { hashCode = hashCode * 59 + CategoryItems.GetHashCode(); } if (Buy != null) { hashCode = hashCode * 59 + Buy.GetHashCode(); } if (Sell != null) { hashCode = hashCode * 59 + Sell.GetHashCode(); } return(hashCode); } }
public void MapWithDefaultsChangingTypeName() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; const string CategoryType = "CategoryModel"; DocumentMapperConfig.NewConfig <Category>() .WithTypeName(CategoryType) .MapWithDetaults(); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Type.Should().Be(CategoryType); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); resource.Attributes.Should().ContainKey(nameof(Category.Description)); resource.Attributes[nameof(Category.Description)].Should().Be(CategoryDescription); }
public void MapWithoutIdShouldUseDefaultMapping() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; DocumentMapperConfig.NewConfig <Category>() .WithAttribute(c => c.Name) .WithAttribute(c => c.Description); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); }
public void MapWrapperType() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; DocumentMapperConfig.NewConfig <Category>() .MapWithDetaults() .Ignore(c => c.Description); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var result = new ResultModel <Category> { Data = category }; DocumentMapperConfig.AddWrapperType(typeof(ResultModel <>), r => r.Data); var document = result.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); resource.Attributes.Should().NotContainKey(nameof(Category.Description)); }
public void Configure(EntityTypeBuilder <CatalogCategory> builder) { builder .Property(x => x.Id) .UsePropertyAccessMode(PropertyAccessMode.Field) .HasConversion(x => x.Id, id => CatalogCategoryId.Of(id)); builder .Property(x => x.CatalogId) .IsRequired() .HasConversion(x => x.Id, id => CatalogId.Of(id)); builder .Property(x => x.CategoryId) .IsRequired() .HasConversion(x => x.Id, id => CategoryId.Of(id)); builder .HasOne(x => x.Parent) .WithMany() .HasForeignKey("CatalogCategoryParentId") .IsRequired(false); builder.Ignore(x => x.IsRoot); }
public void WhenIProcessTheFile() { ImageMemoryStream.Seek(0, SeekOrigin.Begin); const string classifierConfigFile = "svm_config.xml"; //Arrange var handler = new ImageRatingHandler { Parameters = new WorkItemBase.WorkItemParameters { RuntimeData = new Dictionary <string, string> { { "ExhibitId", ExhibitId.ToString(CultureInfo.InvariantCulture) }, { "FileId", FileId.ToString(CultureInfo.InvariantCulture) }, { "FileCategoryId", CategoryId.ToString(CultureInfo.InvariantCulture) }, { "ClassifierConfigFile", Path.GetFullPath(classifierConfigFile) } } }, WorkItemDataStream = ImageMemoryStream }; //Act using (new Performance("ImageRating")) { HandlerOutcome = handler.Execute(); } }
public void Configure(EntityTypeBuilder <Category> builder) { builder .Property(x => x.Id) .UsePropertyAccessMode(PropertyAccessMode.Field) .HasConversion(x => x.Id, id => CategoryId.Of(id)); }
/// <summary> /// Returns true if CategoryInfoWithProductCountDto instances are equal /// </summary> /// <param name="other">Instance of CategoryInfoWithProductCountDto to be compared</param> /// <returns>Boolean</returns> public bool Equals(CategoryInfoWithProductCountDto other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( CategoryId == other.CategoryId || CategoryId.Equals(other.CategoryId) ) && ( ParentCategoryId == other.ParentCategoryId || ParentCategoryId != null && ParentCategoryId.Equals(other.ParentCategoryId) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( ProductCount == other.ProductCount || ProductCount.Equals(other.ProductCount) )); }
private void Bind2() { CategoryId.DataSource = bllut.GetList(""); CategoryId.DataTextField = "typename"; CategoryId.DataValueField = "typeid"; CategoryId.DataBind(); }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (Object.ReferenceEquals(this, obj)) { return(true); } if (this.GetType() != obj.GetType()) { return(false); } var other = (VLLibraryQuestionCategory)obj; //reference types if (!Object.Equals(Name, other.Name)) { return(false); } //value types if (!CategoryId.Equals(other.CategoryId)) { return(false); } if (!AttributeFlags.Equals(other.AttributeFlags)) { return(false); } return(true); }
public void MapSpecificProperties() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; DocumentMapperConfig.NewConfig <Category>() .WithId(c => c.Id) .WithAttribute(c => c.Name); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); resource.Attributes.Should().NotContainKey(nameof(Category.Description)); }
public void Normalize() { Keyword = Keyword.EmptyToNull(); Sort = Sort.EmptyToNull(); SortOrder = SortOrder.EmptyToNull(); CatalogId = CatalogId.EmptyToNull(); CategoryId = CategoryId.EmptyToNull(); Sort = Sort.EmptyToNull(); Sort = Sort.EmptyToNull(); if (!string.IsNullOrEmpty(Keyword)) { Keyword = Keyword.EscapeSearchTerm(); } if (PricelistIds != null) { PricelistIds = PricelistIds.Where(id => id != null).ToArray(); if (!PricelistIds.Any()) { PricelistIds = null; } } }
public async Task <ExecutionStatus <Category> > Run(CategoryId categoryId) { using var connection = new SqliteConnection (_geekLemonContext.ConnectionString); var q = @"SELECT Id, DisplayName, Name, WhatWeAreLookingFor,UniqueId ,Version FROM Categories Where Id = @Id"; try { var r = await connection. QueryFirstOrDefaultAsync <CategoryTemp> (q, new { @Id = categoryId.Value, }); var rmaped = _mapper.Map <Category>(r); return(ExecutionStatus <Category> .DbIfDefaultThenError(rmaped)); } catch (Exception ex) { return(ExecutionStatus <Category> .DbError(ex)); } }
private bool CategoryIsExisting(IRepositoryFactory repositoryFactory, CategoryId categoryId) { var repository = repositoryFactory.CreateRepository <Category>(); var category = repository.FindOneAsync(x => x.CategoryId == categoryId).GetAwaiter().GetResult(); return(category != null); }
public override int GetHashCode() { unchecked { const int randomPrime = 397; int hashCode = Id.GetHashCode(); hashCode = (hashCode * randomPrime) ^ (FullDocumentFileName != null ? FullDocumentFileName.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (FreeSnippetFileName != null ? FreeSnippetFileName.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (OriginalFileName != null ? OriginalFileName.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (Degree != null ? Degree.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (CourseName != null ? CourseName.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (CourseCode != null ? CourseCode.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (Year != null ? Year.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ UniversityId.GetHashCode(); hashCode = (hashCode * randomPrime) ^ UploadedBy.GetHashCode(); hashCode = (hashCode * randomPrime) ^ UploadedAt.GetHashCode(); hashCode = (hashCode * randomPrime) ^ (DeletedAt != null ? DeletedAt.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ IsFree.GetHashCode(); hashCode = (hashCode * randomPrime) ^ (IsApproved != null ? IsApproved.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (Hash != null ? Hash.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ (MinHashSignature != null ? MinHashSignature.GetHashCode() : 0); hashCode = (hashCode * randomPrime) ^ CategoryId.GetHashCode(); return(hashCode); } }
[U] public void Null() { CategoryId c = 10; (c == null).Should().BeFalse(); (null == c).Should().BeFalse(); }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (CategoryId != 0) { hash ^= CategoryId.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Details.Length != 0) { hash ^= Details.GetHashCode(); } if (Price != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price); } if (StockQuantity != 0) { hash ^= StockQuantity.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static void SampleIntValueObject() { Console.WriteLine("---IntValueObject Sample---"); var productId = new ProductId(1); var otherProductId = productId; var categoryId = new CategoryId(1); Console.WriteLine("var productId = new ProductId(1);"); Console.WriteLine("var otherProductId = productId;"); Console.WriteLine("var categoryId = new CategoryId(1);"); Console.WriteLine(); Console.WriteLine($"productId: {productId}"); Console.WriteLine($"productId.Value: {productId.Value}"); Console.WriteLine(); Console.WriteLine($"productId == otherProductId: {productId == otherProductId}"); Console.WriteLine($"productId.Equals(otherProductId): {productId.Equals(otherProductId)}"); Console.WriteLine($"productId == new ProductId(1): {productId == new ProductId(1)}"); Console.WriteLine($"productId.Equals(new ProductId(1)): {productId.Equals(new ProductId(1))}"); Console.WriteLine(); Console.WriteLine($"productId == new ProductId(2): {productId == new ProductId(2)}"); Console.WriteLine($"productId.Equals(new ProductId(2)): {productId.Equals(new ProductId(2))}"); Console.WriteLine($"productId.Equals(null): {productId.Equals(null)}"); Console.WriteLine($"productId.Equals(1): {productId.Equals(1)}"); Console.WriteLine(); Console.WriteLine("productId == categoryId: Compile Error"); Console.WriteLine($"productId.Equals(categoryId): {productId.Equals(categoryId)}"); Console.WriteLine("productId == new CategoryId(1): Compile Error"); Console.WriteLine($"productId.Equals(new CategoryId(1)): {productId.Equals(new CategoryId(1))}"); Console.WriteLine(); }
public async Task <ExecutionStatus> Run(CategoryId categoryId) { using var connection = new SqliteConnection(_geekLemonContext.ConnectionString); var q = @"DELETE FROM Categories WHERE Id=@Id;"; try { var result = await connection.QueryAsync <int>(q, new { @Id = categoryId.Value }); } catch (Exception ex) { if (ExecutionFlow.Options.ThrowExceptions) { throw; } return(ExecutionStatus.DbError(ex)); } return(ExecutionStatus.DbOk()); }
public static Category GetCategory(CategoryId id = null, string name = "name", int level = 0, string iconPath = "path", CategoryId parentId = null, IEnumerable <CategoryProperty> categoryProperties = null) { id = id ?? GetCategoryId(0); return(Category.CreateCategory(id, name, level, iconPath, parentId, categoryProperties)); }
public static IDomainEvent GetCreatedEvent(CategoryId id = null, string name = "name", int level = 0, string iconPath = "path", CategoryId parentId = null, IEnumerable <CategoryProperty> categoryProperties = null) { id = id ?? GetCategoryId(0); return(new CategoryCreated(id, name, level, iconPath, parentId, categoryProperties)); }
private bool CategoryMustExist(IRepositoryFactory repositoryFactory, CategoryId categoryId) { var repository = repositoryFactory.CreateRepository <Category>(); var category = repository.FindOneAsync(x => x.CategoryId == categoryId).Result; return(category != null); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CatalogItem other && ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) && ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) && ((Abbreviation == null && other.Abbreviation == null) || (Abbreviation?.Equals(other.Abbreviation) == true)) && ((LabelColor == null && other.LabelColor == null) || (LabelColor?.Equals(other.LabelColor) == true)) && ((AvailableOnline == null && other.AvailableOnline == null) || (AvailableOnline?.Equals(other.AvailableOnline) == true)) && ((AvailableForPickup == null && other.AvailableForPickup == null) || (AvailableForPickup?.Equals(other.AvailableForPickup) == true)) && ((AvailableElectronically == null && other.AvailableElectronically == null) || (AvailableElectronically?.Equals(other.AvailableElectronically) == true)) && ((CategoryId == null && other.CategoryId == null) || (CategoryId?.Equals(other.CategoryId) == true)) && ((TaxIds == null && other.TaxIds == null) || (TaxIds?.Equals(other.TaxIds) == true)) && ((ModifierListInfo == null && other.ModifierListInfo == null) || (ModifierListInfo?.Equals(other.ModifierListInfo) == true)) && ((Variations == null && other.Variations == null) || (Variations?.Equals(other.Variations) == true)) && ((ProductType == null && other.ProductType == null) || (ProductType?.Equals(other.ProductType) == true)) && ((SkipModifierScreen == null && other.SkipModifierScreen == null) || (SkipModifierScreen?.Equals(other.SkipModifierScreen) == true)) && ((ItemOptions == null && other.ItemOptions == null) || (ItemOptions?.Equals(other.ItemOptions) == true))); }
/// <summary> /// Returns true if PatchProductRequestDto instances are equal /// </summary> /// <param name="other">Instance of PatchProductRequestDto to be compared</param> /// <returns>Boolean</returns> public bool Equals(PatchProductRequestDto other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ManufacturerId == other.ManufacturerId || ManufacturerId != null && ManufacturerId.Equals(other.ManufacturerId) ) && ( CategoryId == other.CategoryId || CategoryId != null && CategoryId.Equals(other.CategoryId) ) && ( ProductName == other.ProductName || ProductName != null && other.ProductName != null && ProductName.SequenceEqual(other.ProductName) )); }
public override bool Equals(Object obj) { if (obj is Source ob) { return(Id.Equals(ob.Id) && Name.Equals(ob.Name) && CategoryId.Equals(ob.CategoryId)); } return(false); }
/// <summary> /// Logs to the ULS. /// </summary> /// <param name="categoryId"></param> /// <param name="traceSeverity">The trace severity.</param> /// <param name="message">The message.</param> /// <param name="args">The message arguments.</param> protected virtual void InnerLog(CategoryId categoryId, TraceSeverity traceSeverity, string message, params object[] args) { //SPSecurity.RunWithElevatedPrivileges( // () => // { if (_innerLogger == null) { _innerLogger = new InnerLogger(Name); } SPDiagnosticsCategory category = _innerLogger.Areas[_innerLogger.Name].Categories[categoryId.ToString()]; _innerLogger.WriteTrace(0, category, traceSeverity, message, args); //}); }