Пример #1
0
        private void sortedImperativesListBox_SelectedValueChanged(object sender, EventArgs e)
        {
            NewImperative imp = (NewImperative)sortedImperativesListBox.SelectedValue;

            categoryNames.Text   = imp.owner.owner.Owner.Name;
            imperativeNames.Text = imp.Name;
            objectiveNames.Text  = imp.owner.ObjName;
            ObjectiveClicked(imp.owner);
        }
Пример #2
0
        public NewImperative AddImperative(string name)
        {
            NewImperative init = new NewImperative(this, name);

            MakeImperativeLabel(init);

            imperatives.Add(init);
            return init;
               // init.Name = name;
        }
Пример #3
0
        public NewImperative AddImperative(string name)
        {
            NewImperative init = new NewImperative(this, name);


            MakeImperativeLabel(init);


            imperatives.Add(init);
            return(init);
            // init.Name = name;
        }
Пример #4
0
        public void ObjectiveClicked(NewObjective obj)
        {
            int heightBetween = 30;

            seperatorLabel.Text = "View Data: " + obj.ObjName;
            ClearDetailPanel();
            for (int i = 0; i < obj.Imperatives.Count; i++)
            {
                NewImperative init = obj.Imperatives[i];
                CreateDataLabels(55 + (i * heightBetween), init);
            }

            categoryNames.Text  = obj.owner.name;
            objectiveNames.Text = obj.ObjName;
        }
Пример #5
0
        public void ReDrawImperatives(NewImperative removedImp)
        {
            Point p = new Point(10, 30);

            foreach (Label lab in Controls)
            {
                if (lab.Location.Y == 0)
                {
                    continue;
                }
                lab.Location = p;
                p.Y         += 30;
            }
            UpdateHeight();
            this.Refresh();
        }
Пример #6
0
 private void CheckColor(NewImperative init)
 {
     if (init.ScoreState1 == NewImperative.ScoreState.None)
     {
         imperativeToLabelDict[init].BackColor = Color.LightSlateGray;
     }
     else if (init.ScoreState1 == NewImperative.ScoreState.High)
     {
         imperativeToLabelDict[init].BackColor = Color.IndianRed;
     }
     else if (init.ScoreState1 == NewImperative.ScoreState.Medium)
     {
         imperativeToLabelDict[init].BackColor = Color.Yellow;
     }
     else if (init.ScoreState1 == NewImperative.ScoreState.Low)
     {
         imperativeToLabelDict[init].BackColor = Color.LawnGreen;
     }
 }
Пример #7
0
        private void MakeImperativeLabel(NewImperative init)
        {
            Label imperativeLabel = new Label();

            imperativeLabel.Click       += new EventHandler(imperativeLabel_Click);
            imperativeToLabelDict[init]  = imperativeLabel;
            imperativeLabel.MouseDown   += new MouseEventHandler(imperativeLabel_MouseDown);
            imperativeLabel.Location     = FindImperativeLocation();
            imperativeLabel.Height       = baseHeight;
            imperativeLabel.BackColor    = Color.White;
            imperativeLabel.AutoEllipsis = true;
            imperativeLabel.Text         = init.Name;

            Controls.Add(imperativeLabel);

            imperativeLabel.Width  = owner.Width;
            imperativeLabel.Height = 25;

            imperativeLabel.BorderStyle = BorderStyle.FixedSingle;
        }
Пример #8
0
        private void imperativeLabel_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Label label = (Label)sender;
                foreach (NewImperative imp in this.imperatives)
                {
                    if (imp.Name == label.Text)
                    {
                        currentImperative = imp;
                    }
                }

                ContextMenuStrip  strip  = new ContextMenuStrip();
                ToolStripMenuItem delete = new ToolStripMenuItem();
                delete.Text   = "Delete Imperative";
                delete.Click += new EventHandler(delete_Click);
                strip.Items.Add(delete);
                strip.Show(label, e.Location, ToolStripDropDownDirection.BelowRight);
            }
        }
Пример #9
0
        private void CreateDataLabels(int yValue, NewImperative init)
        {
            int nameXValue          = 25;
            int effectivenessXValue = 351;
            int critXValue          = 509;
            int diffXValue          = 624;

            Label nameLabel = new Label();

            detailInfoPanel.Controls.Add(nameLabel);
            nameLabel.AutoEllipsis = true;
            nameLabel.Width        = 270;
            //removableControls.Add(nameLabel);
            nameLabel.Text     = init.Name;
            nameLabel.Location = new Point(nameXValue, yValue);

            //removableControls.Add(totalScoreLabel);

            // detailInfoPanel.Controls.Add(totalScoreLabel);
            TextBox effectbox = new TextBox();

            // effectbox.TextChanged +=new EventHandler(effectbox_TextChanged);
            effectbox.DataBindings.Add(new Binding("Text", init, "Effectiveness"));
            effectbox.Location   = new Point(effectivenessXValue, yValue);
            effectbox.LostFocus += new System.EventHandler(this.TextBoxLostFocus);
            //effectbox.TextChanged +=new EventHandler(effectbox_TextChanged);
            detailInfoPanel.Controls.Add(effectbox);
            TextBox critBox = new TextBox();

            critBox.DataBindings.Add(new Binding("Text", init, "Criticality"));
            critBox.Location   = new Point(critXValue, yValue);
            critBox.LostFocus += new System.EventHandler(this.TextBoxLostFocus);
            detailInfoPanel.Controls.Add(critBox);
            TextBox diffBox = new TextBox();

            diffBox.DataBindings.Add(new Binding("Text", init, "Differentiation"));
            diffBox.Location   = new Point(diffXValue, yValue);
            diffBox.LostFocus += new System.EventHandler(this.TextBoxLostFocus);
            detailInfoPanel.Controls.Add(diffBox);
        }
Пример #10
0
        public void RemoveImperative(NewImperative imp)
        {
            Controls.RemoveByKey(imp.Name);
            NewObjective obj = imp.owner;

            obj.Imperatives.Remove(imp);
            if (obj.Imperatives.Count == 0)
            {
                Controls.RemoveByKey(obj.ObjName);
                NewCategory cat = obj.owner;
                if (cat.Objectives.Count == 0)
                {
                    Controls.Remove(cat);
                    categories.Remove(cat);
                    catWorkspace.TabPages.RemoveByKey(cat.name);
                }
                obj.Visible = false;
            }

            ClientDataControl.db.RemoveBOM(imp.Name, ClientDataControl.Client.EntityObject);
            ClientDataControl.db.SaveChanges();
            Refresh();
        }
Пример #11
0
        public void RemoveImperative(NewImperative imp)
        {
            Controls.RemoveByKey(imp.Name);
            NewObjective obj = imp.owner;
            obj.Imperatives.Remove(imp);
            if (obj.Imperatives.Count == 0)
            {
                Controls.RemoveByKey(obj.ObjName);
                NewCategory cat = obj.owner;
                if (cat.Objectives.Count == 0)
                {
                    Controls.Remove(cat);
                    categories.Remove(cat);
                    catWorkspace.TabPages.RemoveByKey(cat.name);
                }
                obj.Visible = false;
            }

            ClientDataControl.db.RemoveBOM(imp.Name, ClientDataControl.Client.EntityObject);
            ClientDataControl.db.SaveChanges();
            Refresh();
        }
Пример #12
0
 public abstract bool UpdateBOM(object clientObj, NewImperative ini);
Пример #13
0
        private void MakeImperativeLabel(NewImperative init)
        {
            Label imperativeLabel = new Label();
            imperativeLabel.Click +=new EventHandler(imperativeLabel_Click);
            imperativeToLabelDict[init] = imperativeLabel;
            imperativeLabel.MouseDown +=new MouseEventHandler(imperativeLabel_MouseDown);
            imperativeLabel.Location = FindImperativeLocation();
            imperativeLabel.Height = baseHeight;
            imperativeLabel.BackColor = Color.White;
            imperativeLabel.AutoEllipsis = true;
            imperativeLabel.Text = init.Name;

            Controls.Add(imperativeLabel);

            imperativeLabel.Width = owner.Width;
            imperativeLabel.Height = 25;

            imperativeLabel.BorderStyle = BorderStyle.FixedSingle;
        }
Пример #14
0
        private void imperativeLabel_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Label label = (Label)sender;
                foreach (NewImperative imp in this.imperatives)
                {
                    if (imp.Name == label.Text)
                        currentImperative = imp;
                }

                ContextMenuStrip strip = new ContextMenuStrip();
                ToolStripMenuItem delete = new ToolStripMenuItem();
                delete.Text = "Delete Imperative";
                delete.Click += new EventHandler(delete_Click);
                strip.Items.Add(delete);
                strip.Show(label, e.Location, ToolStripDropDownDirection.BelowRight);
            }
        }
Пример #15
0
 private void CheckColor(NewImperative init)
 {
     if (init.ScoreState1 == NewImperative.ScoreState.None)
         imperativeToLabelDict[init].BackColor = Color.LightSlateGray;
     else if (init.ScoreState1 == NewImperative.ScoreState.High)
         imperativeToLabelDict[init].BackColor = Color.IndianRed;
     else if (init.ScoreState1 == NewImperative.ScoreState.Medium)
         imperativeToLabelDict[init].BackColor = Color.Yellow;
     else if (init.ScoreState1 == NewImperative.ScoreState.Low)
         imperativeToLabelDict[init].BackColor = Color.LawnGreen;
 }
Пример #16
0
 public void ReDrawImperatives(NewImperative removedImp)
 {
     Point p = new Point(10, 30);
     foreach(Label lab in Controls)
     {
         if (lab.Location.Y == 0)
         {
             continue;
         }
         lab.Location = p;
         p.Y += 30;
     }
     UpdateHeight();
     this.Refresh();
 }
Пример #17
0
 public abstract bool UpdateBOM(object clientObj, NewImperative ini);
Пример #18
0
        private void CreateDataLabels(int yValue, NewImperative init)
        {
            int nameXValue = 25;
            int effectivenessXValue = 351;
            int critXValue = 509;
            int diffXValue = 624;

            Label nameLabel = new Label();
            detailInfoPanel.Controls.Add(nameLabel);
            nameLabel.AutoEllipsis = true;
            nameLabel.Width = 270;
            //removableControls.Add(nameLabel);
            nameLabel.Text = init.Name;
            nameLabel.Location = new Point(nameXValue, yValue);

            //removableControls.Add(totalScoreLabel);

               // detailInfoPanel.Controls.Add(totalScoreLabel);
            TextBox effectbox = new TextBox();
               // effectbox.TextChanged +=new EventHandler(effectbox_TextChanged);
            effectbox.DataBindings.Add(new Binding("Text", init, "Effectiveness"));
            effectbox.Location = new Point(effectivenessXValue, yValue);
            effectbox.LostFocus += new System.EventHandler(this.TextBoxLostFocus);
            //effectbox.TextChanged +=new EventHandler(effectbox_TextChanged);
            detailInfoPanel.Controls.Add(effectbox);
            TextBox critBox = new TextBox();
            critBox.DataBindings.Add(new Binding("Text", init, "Criticality"));
            critBox.Location = new Point(critXValue, yValue);
            critBox.LostFocus += new System.EventHandler(this.TextBoxLostFocus);
            detailInfoPanel.Controls.Add(critBox);
            TextBox diffBox = new TextBox();
            diffBox.DataBindings.Add(new Binding("Text", init, "Differentiation"));
            diffBox.Location = new Point(diffXValue, yValue);
            diffBox.LostFocus += new System.EventHandler(this.TextBoxLostFocus);
            detailInfoPanel.Controls.Add(diffBox);
        }
Пример #19
0
        public override bool UpdateBOM(object clientObj, NewImperative ini)
        {
            CLIENT client = clientObj as CLIENT;
            Console.WriteLine(ini.Effectiveness.ToString());
            try
            {
                BOM bom = (from ent in client.BOM
                           where ent.IMPERATIVE.NAME.TrimEnd() == ini.Name
                           select ent).Single();

                bom.EFFECTIVENESS = (float)ini.Effectiveness;

                bom.CRITICALITY = (float)ini.Criticality;
                bom.DIFFERENTIAL = (float)ini.Differentiation;
            }

            catch
            {
                return false;
            }

            return true;
        }
Пример #20
0
        public override bool UpdateBOM(object clientObj, NewImperative ini)
        {
            XElement client = clientObj as XElement;
            try
            {
                XElement bom = (from ent in client.Element("BOMS").Elements("BOM")
                                where ent.Element("IMPERATIVE").Value == ini.Name
                                select ent).Single();

                bom.Element("EFFECTIVENESS").Value = ini.Effectiveness.ToString();
                bom.Element("CRITICALITY").Value = ini.Criticality.ToString();
                bom.Element("DIFFERENTIAL").Value = ini.Differentiation.ToString();

                changeLog.Add("UPDATE BOM " + client.Element("NAME").Value.Replace(' ', '~') + " " + ini.Name.Replace(' ', '~') + " " +
                                ini.Effectiveness + " " + ini.Criticality + " " + ini.Differentiation);
            }

            catch
            {
                return false;
            }

            return true;
        }