예제 #1
0
        private void btnViewChildren_Click(object sender, RoutedEventArgs e)
        {
            CustomCategory category = ((FrameworkElement)sender).DataContext as CustomCategory;

            Categories.List categoryWindow = new Categories.List(category.Id, category.Name);
            categoryWindow.Show();
        }
예제 #2
0
        private void btnViewProducts_Click(object sender, RoutedEventArgs e)
        {
            CustomCategory category = ((FrameworkElement)sender).DataContext as CustomCategory;

            Products.List productWindow = new Products.List(category.Id, category.Name);
            productWindow.Show();
        }
예제 #3
0
        public PlayerVendorCustomizeGump(Mobile v, Mobile from)
            : base(30, 40)
        {
            m_Vendor = v;

            from.CloseGump(typeof(PlayerVendorCustomizeGump));

            AddPage(0);
            AddBackground(0, 0, 585, 393, 5054);
            AddBackground(195, 36, 387, 275, 3000);
            AddHtmlLocalized(10, 10, 565, 18, 1011356, false, false);             // <center>VENDOR CUSTOMIZATION MENU</center>
            AddHtmlLocalized(60, 355, 150, 18, 1011036, false, false);            // OKAY
            AddButton(25, 355, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(320, 355, 150, 18, 1011012, false, false);           // CANCEL
            AddButton(285, 355, 4005, 4007, 0, GumpButtonType.Reply, 0);

            int x;
            int y = 35;

            for (int i = 0; i < Categories.Length; i++)
            {
                CustomCategory cat = Categories[i];
                AddHtmlLocalized(5, y, 150, 25, cat.LocNumber, true, false);
                AddButton(155, y, 4005, 4007, 0, GumpButtonType.Page, i + 1);
                y += 25;
            }

            for (int i = 0; i < Categories.Length; i++)
            {
                CustomCategory cat = Categories[i];
                AddPage(i + 1);

                for (int c = 0; c < cat.Entries.Length; c++)
                {
                    CustomItem entry = cat.Entries[c];
                    x = 198 + (c % 3) * 129;
                    y = 38 + (c / 3) * 67;

                    AddHtmlLocalized(x, y, 100, entry.LongText ? 36 : 18, entry.LocNumber, false, false);

                    if (entry.ArtNumber != 0)
                    {
                        AddItem(x + 20, y + 25, entry.ArtNumber);
                    }

                    AddRadio(x, y + (entry.LongText ? 40 : 20), 210, 211, false, (c << 8) + i);
                }

                if (cat.CanDye)
                {
                    AddHtmlLocalized(327, 239, 100, 18, 1011402, false, false);                     // Color
                    AddRadio(327, 259, 210, 211, false, 100 + i);
                }

                AddHtmlLocalized(456, 239, 100, 18, 1011403, false, false);                 // Remove
                AddRadio(456, 259, 210, 211, false, 200 + i);
            }
        }
        public void Delete(int id)
        {
            IEnumerable <Expense> expenses = dbContext.Set <Expense>().Where(exp => exp.CustomCategoryId == id);

            dbContext.Set <Expense>().RemoveRange(expenses);
            CustomCategory item = dbContext.Set <CustomCategory>().Find(id);

            dbContext.Set <CustomCategory>().Remove(item);
            dbContext.SaveChanges();
        }
예제 #5
0
        private static void InsertCustomCategory()
        {
            var customCategory = new CustomCategory
            {
                Name             = "Środki czyszczące",
                Description      = "Chemia do domu",
                ParentCategoryId = GetParentCategoryId("Mieszkanie")
            };

            _context.CustomCategories.Add(customCategory);
            _context.SaveChanges();
        }
예제 #6
0
        private static void InsertCustomCategories()
        {
            var customCategoryFirst = new CustomCategory {
                Name = "Paliwo", Description = "Paliwo do mojego samochodu", ParentCategoryId = 3
            };
            var customCategorySecond = new CustomCategory {
                Name = "Alkohol", Description = "Piwo, wino i inne", ParentCategoryId = 1
            };

            _context.CustomCategories.AddRange(new List <CustomCategory> {
                customCategoryFirst, customCategorySecond
            });
            _context.SaveChanges();
        }
        private PlannerAppliedCategories CreateAppliedCategories(CustomCategory selectedCategory)
        {
            PlannerAppliedCategories appliedCategories = new PlannerAppliedCategories();

            System.Reflection.PropertyInfo[] propertyInfos = appliedCategories.GetType().GetProperties();
            foreach (System.Reflection.PropertyInfo propertyInfo in propertyInfos)
            {
                if (propertyInfo.PropertyType == typeof(bool?))
                {
                    if (propertyInfo.Name.Equals(selectedCategory.Name))
                    {
                        propertyInfo.SetValue(appliedCategories, selectedCategory.Value);
                    }
                    else
                    {
                        propertyInfo.SetValue(appliedCategories, false);
                    }
                }
            }
            return(appliedCategories);
        }
예제 #8
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Vendor.Deleted)
            {
                return;
            }

            Mobile from = state.Mobile;

            if (m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith(from, true))
            {
                return;
            }

            if (m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner(from))
            {
                return;
            }

            if (info.ButtonID == 0)
            {
                if (m_Vendor is PlayerVendor)                 // do nothing for barkeeps
                {
                    m_Vendor.Direction = m_Vendor.GetDirectionTo(from);
                    m_Vendor.Animate(32, 5, 1, true, false, 0);                     //bow
                    m_Vendor.SayTo(from, 1043310 + Utility.Random(12));             // a little random speech
                }
            }
            else if (info.ButtonID == 1 && info.Switches.Length > 0)
            {
                int cnum = info.Switches[0];
                int cat  = cnum % 256;
                int ent  = cnum >> 8;

                if (cat < Categories.Length && cat >= 0)
                {
                    if (ent < Categories[cat].Entries.Length && ent >= 0)
                    {
                        Item item = m_Vendor.FindItemOnLayer(Categories[cat].Layer);

                        if (item != null)
                        {
                            item.Delete();
                        }

                        List <Item> items = m_Vendor.Items;

                        for (int i = 0; item == null && i < items.Count; ++i)
                        {
                            Item checkitem = items[i];
                            Type type      = checkitem.GetType();

                            for (int j = 0; item == null && j < Categories[cat].Entries.Length; ++j)
                            {
                                if (type == Categories[cat].Entries[j].Type)
                                {
                                    item = checkitem;
                                }
                            }
                        }

                        if (item != null)
                        {
                            item.Delete();
                        }

                        switch (Categories[cat].Layer)
                        {
                        case Layer.FacialHair:
                        {
                            if (m_Vendor.Female)
                            {
                                from.SendLocalizedMessage(1010639);                                                 // You cannot place facial hair on a woman!
                            }
                            else
                            {
                                int hue = m_Vendor.FacialHairHue;

                                m_Vendor.FacialHairItemID = 0;
                                m_Vendor.ProcessDelta();                                                 // invalidate item ID for clients

                                m_Vendor.FacialHairItemID = Categories[cat].Entries[ent].ItemID;
                                m_Vendor.FacialHairHue    = hue;
                            }
                        }
                        break;

                        case Layer.Hair:
                        {
                            int hue = m_Vendor.HairHue;

                            m_Vendor.HairItemID = 0;
                            m_Vendor.ProcessDelta();                                             // invalidate item ID for clients

                            m_Vendor.HairItemID = Categories[cat].Entries[ent].ItemID;
                            m_Vendor.HairHue    = hue;
                        }
                        break;

                        default:
                        {
                            item = Categories[cat].Entries[ent].Create();

                            if (item != null)
                            {
                                item.Layer = Categories[cat].Layer;

                                if (!m_Vendor.EquipItem(item))
                                {
                                    item.Delete();
                                }
                            }
                        }
                        break;
                        }

                        from.SendGump(new PlayerVendorCustomizeGump(m_Vendor, from));
                    }
                }
                else
                {
                    cat -= 100;

                    if (cat < 100)
                    {
                        if (cat < Categories.Length && cat >= 0)
                        {
                            CustomCategory category = Categories[cat];

                            switch (category.Layer)
                            {
                            case Layer.Hair:
                                new PVHairHuePicker(false, m_Vendor, from).SendTo(state);
                                break;

                            case Layer.FacialHair:
                                new PVHairHuePicker(true, m_Vendor, from).SendTo(state);
                                break;

                            default:
                            {
                                Item item = null;

                                List <Item> items = m_Vendor.Items;

                                for (int i = 0; item == null && i < items.Count; ++i)
                                {
                                    Item checkitem = items[i];
                                    Type type      = checkitem.GetType();

                                    for (int j = 0; item == null && j < category.Entries.Length; ++j)
                                    {
                                        if (type == category.Entries[j].Type)
                                        {
                                            item = checkitem;
                                        }
                                    }
                                }

                                if (item != null)
                                {
                                    new PVHuePicker(item, m_Vendor, from).SendTo(state);
                                }
                            }
                            break;
                            }
                        }
                    }
                    else
                    {
                        cat -= 100;

                        if (cat < Categories.Length && cat >= 0)
                        {
                            CustomCategory category = Categories[cat];

                            switch (category.Layer)
                            {
                            case Layer.Hair:
                                m_Vendor.HairItemID = 0;
                                break;

                            case Layer.FacialHair:
                                m_Vendor.FacialHairItemID = 0;
                                break;

                            default:
                            {
                                Item item = null;

                                List <Item> items = m_Vendor.Items;

                                for (int i = 0; item == null && i < items.Count; ++i)
                                {
                                    Item checkitem = items[i];
                                    Type type      = checkitem.GetType();

                                    for (int j = 0; item == null && j < category.Entries.Length; ++j)
                                    {
                                        if (type == category.Entries[j].Type)
                                        {
                                            item = checkitem;
                                        }
                                    }
                                }

                                if (item != null)
                                {
                                    item.Delete();
                                }
                            }
                            break;
                            }

                            from.SendGump(new PlayerVendorCustomizeGump(m_Vendor, from));
                        }
                    }
                }
            }
        }
 public CustomCategoryAttribute(CustomCategory cat)
 {
     Category = cat;
 }
예제 #10
0
 public void Create(CustomCategory item)
 {
     dbContext.Set <CustomCategory>().Add(item);
     dbContext.SaveChanges();
 }
예제 #11
0
        public void Create(CustomCategoryDTO item)
        {
            CustomCategory customCategory = _mapper.Map <CustomCategory>(item);

            repository.Create(customCategory);
        }
예제 #12
0
    public async Task AddCat()
    {
        if (CustomConfig.CustomLv2MenuItems?.Count > 0)
        //if (false)
        {
            CustomConfig.Categories.Clear();
            //CustomConfig.Categories.Add("加载中..",null,null);
            //CatChange();
            //CustomConfig.Categories.Clear();
            //Lv2Cat.Add("加载中..");
            //CatChange();
            foreach (var item in CustomConfig.CustomLv2MenuItems)
            {
                var net  = Net.CloneWithCookie();
                var url  = item.PageUrl ?? CustomConfig.HomeUrl;
                var html = await net.GetHtmlAsync(url);

                var nodes = html.DocumentNode.SelectNodes(item.Menus.Path);
                foreach (var node in nodes)
                {
                    var cat = new CustomCategory();

                    try
                    {
                        var name = node.GetValue(item.MenuTitleFromMenus);
                        var url2 = node.GetValue(item.MenuUrlFromMenus);
                        if ($"{url2}".Equals(HomeUrl, StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        cat.Name = name;
                        if (cat.Name.Equals("首页"))
                        {
                            continue;
                        }
                        cat.FirstPageApi = $"{url2}{item.FirstApi}";
                        var follow = $"{url2}{item.FollowApi}";
                        if (item.FollowApiReplaceFrom != null)
                        {
                            follow = follow.Replace(item.FollowApiReplaceFrom, item.FollowApiReplaceTo);
                        }
                        cat.FollowUpPageApi = $"{follow}";
                        if (item.OverridePagePara != null)
                        {
                            cat.OverridePagePara = item.OverridePagePara;
                        }
                        CustomConfig.Categories.Add(cat);
                    }
                    catch (Exception e)
                    {
                        Ex.Log(e);
                    }
                }
            }
        }
        //Lv2Cat.Clear();

        foreach (var cat in CustomConfig.Categories)
        {
            Lv2Cat.Add(cat.Name);
        }
        CatChange();
    }