public CategoryEntity(Category Category, params object[] args) : base(Category) { foreach (object arg in args) { if (arg is Category Parent) { ParentEntity = new CategoryEntity(Parent); } if (arg is ICollection <CategoryName> CategoryNames) { CategoryNameEntities = CategoryNames.Select(model => new CategoryNameEntity(model, model.Language)).ToList(); } if (arg is ICollection <Category> InverseParent) { InverseParentEntities = InverseParent.Select(model => new CategoryEntity(model)).ToList(); } if (arg is ICollection <ProductAttribute> ProductAttributes) { ProductAttributeEntities = ProductAttributes.Select(model => new ProductAttributeEntity(model)).ToList(); } if (arg is ICollection <Product> Products) { ProductEntities = Products.Select(model => new ProductEntity(model, model.Manufacturer)).ToList(); } if (arg is ICollection <Tax> Taxes) { TaxEntities = Taxes.Select(model => new TaxEntity(model, model.Country)).ToList(); } } }
public async Task Disable([Name("카테고리")] string category) { if (!CategoryNames.Contains(category)) { await Context.MsgReplyEmbedAsync($"알 수 없는 카테고리에요\n{string.Join(", ", CategoryNames.Select(c => $"`{c}`"))} 중 하나를 선택할 수 있어요"); return; } OliveGuild.GuildSetting setting = OliveGuild.Get(Context.Guild.Id).Setting; CategoryType cat = StringToCategory(category); if (cat == CategoryType.Setting) { await Context.MsgReplyEmbedAsync($"비활성화 할 수 없는 카테고리에요"); return; } if (!setting.EnabledCategories.Contains(cat)) { await Context.MsgReplyEmbedAsync($"이미 비활성화돼있는 카테고리에요"); return; } setting.EnabledCategories.Remove(cat); OliveGuild.Set(Context.Guild.Id, g => g.Setting, setting); await Context.MsgReplyEmbedAsync($"{category} 카테고리를 비활성화했어요"); }
public LanguageEntity(Language Language, params object[] args) : base(Language) { foreach (object arg in args) { if (arg is ICollection <CategoryName> CategoryNames) { CategoryNameEntities = CategoryNames.Select(model => new CategoryNameEntity(model, model.Category)).ToList(); } if (arg is ICollection <ProductAttributeName> ProductAttributeNames) { ProductAttributeNameEntities = ProductAttributeNames.Select(model => new ProductAttributeNameEntity(model, model.ProductAttribute)).ToList(); } if (arg is ICollection <ProductValue> ProductValues) { ProductValueEntities = ProductValues.Select(model => new ProductValueEntity(model, model.Attribute, model.Product)).ToList(); } } }