private void AddNode(TreeNode parentNode, ToolCategory parentCategory) { foreach (ToolCategory c in parentCategory.ChildCategories) { TreeNode n = new TreeNode(c.Code + "-" + c.Name); parentNode.Nodes.Add(n); AddNode(n, c); } }
private void LoadData() { if (CurrentCategory == null) CurrentCategory = new ToolCategory(); else ParentCategory = CurrentCategory.ParentCategory; txtCode.Text = CurrentCategory.Code; txtName.Text = CurrentCategory.Name; if (ParentCategory != null) txtParentCategory.Text = ParentCategory.Code + "-" + ParentCategory.Name; }
/// <summary> /// Create a new ToolCategory object. /// </summary> /// <param name="toolCategoryID">Initial value of the ToolCategoryID property.</param> /// <param name="code">Initial value of the Code property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="deleted">Initial value of the Deleted property.</param> public static ToolCategory CreateToolCategory(global::System.Int32 toolCategoryID, global::System.String code, global::System.String name, global::System.Boolean deleted) { ToolCategory toolCategory = new ToolCategory(); toolCategory.ToolCategoryID = toolCategoryID; toolCategory.Code = code; toolCategory.Name = name; toolCategory.Deleted = deleted; return toolCategory; }
/// <summary> /// Deprecated Method for adding a new object to the ToolCategories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToToolCategories(ToolCategory toolCategory) { base.AddObject("ToolCategories", toolCategory); }
private void _saveButton_Click(object sender, EventArgs e) { ExecuteActionHelper.ExecuteAction(delegate() { if (!_validationManager.Validate()) { return; } CurrentCategory.Code = txtCode.Text; CurrentCategory.Name = txtName.Text; if (CurrentCategory.EntityKey == null) { CurrentCategory.ParentCategory = ParentCategory; SystemHelper.TMSContext.AddToToolCategories(CurrentCategory); } ToolCategory c = new ToolCategory(); c.Code = txtCode.Text; c.Name = txtName.Text; SystemHelper.TMSContext.SaveChanges(); DialogResult = DialogResult.OK; }); }