private void categoryAddButton_Click(object sender, EventArgs e) { Category category = new Category(this, categoryNames.Text); categories.Add(category); categoryCount++; category.Click += new EventHandler(category_Click); }
public BusinessObjective(Category owner, string name) { this.owner = owner; this.name = name; baseObjectiveWidth = owner.Width; owner.Controls.Add(this); this.Height = baseObjectiveHeight; this.Width = Parent.Width; this.BackColor = Color.Aquamarine; this.Location = FindLocation(); MakeLabel(); // objective.Name = name; owner.UpdateHeight(); //owner.Controls.Add(this); //this.Location = FindLocation(); }
private void category_Click(object sender, EventArgs e) { Category cat = (Category)sender; lastFocused = cat; Console.WriteLine("clicked on category:" + cat.Name); }
/// <summary> /// Create a new Category object. /// </summary> /// <param name="id">Initial value of the Id property.</param> public static Category CreateCategory(global::System.Int32 id) { Category category = new Category(); category.Id = id; return category; }
/// <summary> /// Deprecated Method for adding a new object to the Category EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCategory(Category category) { base.AddObject("Category", category); }
public BusinessObjective(Category owner, string name) { this.owner = owner; this.name = name; }
private void initiativeAddButton_Click(object sender, EventArgs e) { string catName; string busName; string iniName = initiativeNames.Text.Trim(); INITIATIVE initiative; if (!db.GetInitiative(iniName, out initiative)) { initiative = new INITIATIVE(); initiative.NAME = iniName; BUSINESSOBJECTIVE objective; busName = objectiveNames.Text.Trim(); if(!db.GetObjective(busName, out objective)) { objective = new BUSINESSOBJECTIVE(); objective.NAME = objectiveNames.Text.Trim(); CATEGORY category; catName = categoryNames.Text.Trim(); if(!db.GetCategory(catName, out category)) { category = new CATEGORY(); category.NAME = catName; if(!db.AddCategory(category)) { MessageBox.Show("Failed to add Category to Database", "Error"); return; } } objective.CATEGORY = category; if (!db.AddObjective(objective)) { MessageBox.Show("Failed to add Objective to Database", "Error"); return; } } initiative.BUSINESSOBJECTIVE = objective; if (!db.AddInitiative(initiative)) { MessageBox.Show("Failed to add Initiative to Database", "Error"); return; } } BOM bom = new BOM(); bom.INITIATIVE = initiative; if (!db.AddBOM(bom, client)) { MessageBox.Show("Failed to add Initiative to BOM", "Error"); return; } if (!db.SaveChanges()) { MessageBox.Show("Failed to save changes to database", "Error"); return; } else { //Successfully added to database, update GUI catName = bom.INITIATIVE.BUSINESSOBJECTIVE.CATEGORY.NAME.TrimEnd(); Category category = categories.Find(delegate(Category cat) { return cat.Name == catName; }); if (category == null) { category = new Category(this, catName); categories.Add(category); categoryCount++; category.Click += new EventHandler(category_Click); } busName = bom.INITIATIVE.BUSINESSOBJECTIVE.NAME.TrimEnd(); BusinessObjective objective = category.Objectives.Find(delegate(BusinessObjective bus) { return bus.Name == busName; }); if (objective == null) { objective = category.AddObjective(busName); } iniName = bom.INITIATIVE.NAME.TrimEnd(); Initiative initiativeObj = objective.Initiatives.Find(delegate(Initiative ini) { return ini.Name == iniName; }); if (initiativeObj == null) { initiativeObj = objective.AddInitiative(iniName); } else { MessageBox.Show("Initiative already exists in BOM", "Error"); } } }