示例#1
0
        private void DeleteCategory(object param)
        {
            commandBuffer.Add(new Helpers.CategoryCommand <InvoiceCategory> {
                CommandType = Helpers.CommandEnum.Remove, Item = SelectedInvoiceCategory
            });

            CategoryCollection.Remove(SelectedInvoiceCategory);
        }
        private void DeleteCategory(object param)
        {
            commandBuffer.Add(new Helpers.CategoryCommand <BuildingChargeBasisCategory> {
                CommandType = Helpers.CommandEnum.Remove, Item = SelectedCostCategory
            });

            CategoryCollection.Remove(SelectedCostCategory);
        }
    private void BindData(CategoryWidget widget)
    {
        txtTitle.Text = widget.Title;

        CategoryCollection cc = new CategoryController().GetTopLevelCachedCategories();

        CategoryCollection InUse    = new CategoryCollection();
        CategoryCollection NotInUse = new CategoryCollection();

        NotInUse.AddRange(cc);

        foreach (int i in widget.CategoryIds)
        {
            bool found = false;
            foreach (Category c in NotInUse)
            {
                if (i == c.Id)
                {
                    InUse.Add(c);
                    found = true;
                }
            }

            if (found)
            {
                NotInUse.Remove(InUse[InUse.Count - 1]);
            }
        }

        the_Categories.DataSource = NotInUse;
        the_Categories.DataBind();

        existing_items.Items.Clear();
        foreach (Category c in InUse)
        {
            existing_items.Items.Add(new OrderedListItem(string.Format(ItemFormat, c.Name, c.Id), c.Name,
                                                         c.Id.ToString()));
        }
    }
    private void BindData(CategoryWidget widget)
    {
        txtTitle.Text = widget.Title;

        CategoryCollection cc = new CategoryController().GetTopLevelCachedCategories();

        CategoryCollection InUse = new CategoryCollection();
        CategoryCollection NotInUse = new CategoryCollection();

        NotInUse.AddRange(cc);

        foreach(int i in widget.CategoryIds)
        {
            bool found = false;
            foreach(Category c in NotInUse)
            {
                if(i == c.Id)
                {
                    InUse.Add(c);
                    found = true;
                }
            }

            if(found)
            {
                NotInUse.Remove(InUse[InUse.Count - 1]);
            }
        }

        the_Categories.DataSource = NotInUse;
        the_Categories.DataBind();

        existing_items.Items.Clear();
        foreach (Category c in InUse)
        {
            existing_items.Items.Add(new Telligent.Glow.OrderedListItem(string.Format(this.ItemFormat, c.Name, c.Id), c.Name, c.Id.ToString()));
        }
    }