Ejemplo n.º 1
0
        /// <summary>
        /// Create a new Initiative object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="currentRating">Initial value of the CurrentRating property.</param>
        /// <param name="desiredRating">Initial value of the DesiredRating property.</param>
        /// <param name="criticality">Initial value of the Criticality property.</param>
        /// <param name="differential">Initial value of the Differential property.</param>
        public static Initiative CreateInitiative(global::System.Int32 id, global::System.String currentRating, global::System.String desiredRating, global::System.String criticality, global::System.String differential)
        {
            Initiative initiative = new Initiative();

            initiative.Id            = id;
            initiative.CurrentRating = currentRating;
            initiative.DesiredRating = desiredRating;
            initiative.Criticality   = criticality;
            initiative.Differential  = differential;
            return(initiative);
        }
 public void AddInitiative(string name)
 {
     Initiative initiative = new Initiative(this, name);
     this.Controls.Add(initiative);
     initiatives.Add(initiative);
     initiativesCount++;
     initiative.Text = name;
     initiative.Location = new Point(20, 40);
     initiative.BackColor = Color.CornflowerBlue;
     Console.WriteLine(name + "belongs to " + this.name + "which belongs to " + Owner.Name);
 }
Ejemplo n.º 3
0
        public void AddInitiative(string name)
        {
            Initiative initiative = new Initiative(this, name);

            this.Controls.Add(initiative);
            initiatives.Add(initiative);
            initiativesCount++;
            initiative.Text      = name;
            initiative.Location  = new Point(20, 40);
            initiative.BackColor = Color.CornflowerBlue;
            Console.WriteLine(name + "belongs to " + this.name + "which belongs to " + Owner.Name);
        }
Ejemplo n.º 4
0
        public Initiative AddInitiative(string name)
        {
            Initiative initiative = new Initiative(this, name);
            this.Controls.Add(initiative);
            initiatives.Add(initiative);
            initiativesCount++;

            Console.WriteLine(name + "belongs to " + this.name + "which belongs to " + Owner.Name);

            UpdateLocation();

            return initiative;
        }
Ejemplo n.º 5
0
        public Initiative AddInitiative(string name)
        {
            Initiative initiative = new Initiative(this, name);

            this.Controls.Add(initiative);
            initiatives.Add(initiative);
            initiativesCount++;

            Console.WriteLine(name + "belongs to " + this.name + "which belongs to " + Owner.Name);

            UpdateLocation();

            return(initiative);
        }
Ejemplo n.º 6
0
        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");
                }
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Create a new Initiative object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="currentRating">Initial value of the CurrentRating property.</param>
 /// <param name="desiredRating">Initial value of the DesiredRating property.</param>
 /// <param name="criticality">Initial value of the Criticality property.</param>
 /// <param name="differential">Initial value of the Differential property.</param>
 public static Initiative CreateInitiative(global::System.Int32 id, global::System.String currentRating, global::System.String desiredRating, global::System.String criticality, global::System.String differential)
 {
     Initiative initiative = new Initiative();
     initiative.Id = id;
     initiative.CurrentRating = currentRating;
     initiative.DesiredRating = desiredRating;
     initiative.Criticality = criticality;
     initiative.Differential = differential;
     return initiative;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Initiative EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToInitiative(Initiative initiative)
 {
     base.AddObject("Initiative", initiative);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Initiative EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToInitiative(Initiative initiative)
 {
     base.AddObject("Initiative", initiative);
 }