Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)                     //Изменение товара
        {
            Dictionary <string, string> param = new Dictionary <string, string>(); //Спсок полей редактируемого обьекта
            TreeNode s_node = treeView1.SelectedNode;

            if (s_node != null)
            {
                param["name"] = s_node.Text.ToString();

                foreach (string type in lists.GetTypes())
                {
                    CCategorizedList cat_list = lists.GetCatList(type);
                    List <string>    subtypes = cat_list.GetTypes();

                    foreach (string subtype in subtypes)
                    {
                        TreeNode     subtypeNode = new TreeNode(subtype);
                        List <CItem> items       = cat_list.GetByType(subtype);

                        foreach (CItem item in items)
                        {
                            var t = item.Get();
                            if (t.ContainsValue(param["name"]))
                            {
                                lists.Remove(item);
                                new_frm.main_frm = this;
                                new_frm.edit_item(t);
                            }
                        }
                    }
                }
                update_tree();
                update_data();
            }
        }