コード例 #1
0
        public static CategoryDiscountTemplate Parse(int id, IDataProperty property)
        {
            var t = new CategoryDiscountTemplate
            {
                ID           = id,
                Category     = Convert.ToByte(property.Parent.Name),
                CategorySub  = Convert.ToByte(property.Name),
                DiscountRate = property.Resolve <byte>() ?? 0
            };

            return(t);
        }
コード例 #2
0
        public override Task LoadAll()
        {
            var property = Collection.Resolve("Server/CategoryDiscount.img");

            var id = 0;

            property.Children
            .SelectMany(c => c.Children)
            .ToDictionary(
                c => id++,
                c => CategoryDiscountTemplate.Parse(id, c)
                )
            .ForEach(kv => Templates.Add(kv.Key, kv.Value));
            return(Task.CompletedTask);
        }