Ejemplo n.º 1
0
 void CategoryListCtrl_CategoryAdded(object sender, CategoryAddedEventArgs e)
 {
     //
 }
Ejemplo n.º 2
0
        void catLstCtrl_CategoryAdded(object sender, CategoryAddedEventArgs e)
        {
            try
            {
                if (e.ParentId != "" && e.ParentId != "{ROOT}")
                {
                    var lookupQuery = from category in this.gl_xDoc.Descendants("Category")
                                      where category.Attribute("Id").Value == e.ParentId
                                      select category;

                    foreach (var category in lookupQuery)
                    {
#if DEBUG
                        System.Diagnostics.Debug.WriteLine("Category was found. Category found: {0}", category.Attribute("CategoryName").Value.ToString());
#endif
                        category.Add(new XElement("Category", new XAttribute("Id", e.CategoryId.ToString()), new XAttribute("CategoryName", e.CategoryName.ToString())));
                    }
                }
                else
                {
                    this.gl_xDoc.Root.Element("CategoryRoot").Add(new XElement("Category", new XAttribute("Id", e.CategoryId.ToString()), new XAttribute("CategoryName", e.CategoryName.ToString())));
                }
            }
            catch
            {
            }

            try
            {
                this.CommitChanges();
            }
            catch
            {
            }
        }