Ejemplo n.º 1
0
        /// <summary>
        /// Launches the add attribute form.
        /// </summary>
        /// <param name="dimensionName">Name of the dimension.</param>
        /// <param name="parentName">Name of the parent.</param>
        private void LaunchAddAttribute(string dimensionName, string parentName)
        {
            string          businessProcess = this.tabControlArea.SelectedTab.Text;
            BusinessProcess b = this.cmodel.GetBusinessProcess(businessProcess);

            using (AddAttribute am = new AddAttribute(b, dimensionName, parentName))
            {
                Point location = new Point((this.Left + (this.Width / 2)) - am.Width / 2, (this.Top + (this.Height / 2)) - am.Height / 2);
                am.StartPosition = FormStartPosition.Manual;
                am.Location      = location;
                var result = am.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Level l = new Level();

                    if (am.IsSharedNode.Checked)
                    {
                        Level sh = b.GetSharedNodeLevelByUID(am.SharedNodeName.SelectedValue.ToString());
                        if (am.ConvergedKey.Checked)
                        {
                            l.ConvergedKey = sh.Key;
                        }
                        else if (am.CDAKey.Checked)
                        {
                            l.CDAKey = sh.Key;
                        }
                        else
                        {
                            l.Key = sh.Key;
                        }
                    }
                    else
                    {
                        l.Name                 = am.AttributeName.Text;
                        l.Type                 = (LevelType)Enum.Parse(typeof(LevelType), am.AttributeType.Text);
                        l.OptionalLevel        = am.OptionalLevel.Checked;
                        l.OptionalRelationship = am.OptionalBranch.Checked;
                        l.MultipleRelationship = am.ManyToMany.Checked;
                        l.Recursive            = am.Recursive.Checked;
                    }
                    Dimension d = b.GetDimension(am.Dimension.Text);
                    if (am.Parent.Text.ToString() == "n/a" && am.Parent.SelectedValue == null)
                    {
                        d.Level = l;
                    }
                    else
                    {
                        Level parent = d.GetLevelByUID(am.Parent.SelectedValue.ToString());
                        if (parent.Level1 == null)
                        {
                            parent.Level1 = new List <Level>();;
                        }
                        parent.Level1.Add(l);
                    }

                    this.Draw();
                    tabControlArea.SelectTab(businessProcess);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Validates the form.
        /// </summary>
        /// <returns></returns>
        private bool ValidateForm()
        {
            if (DimensionName.Text == "")
            {
                return(false);
            }
            else if (businessProcess.GetDimension(DimensionName.Text) != null)
            {
                return(false);
            }
            Regex r = new Regex(@"\\");

            if (r.IsMatch(DimensionName.Text))
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Validates the form.
 /// </summary>
 /// <returns></returns>
 private bool ValidateForm()
 {
     if (this.process == null || process.GetDimension(this.Dimension.Text) == null)
     {
         return(false);
     }
     if (IsSharedNode.Checked == false)
     {
         if (this.AttributeName.Text == "")
         {
             return(false);
         }
     }
     else if (this.SharedNodeName.Text == "")
     {
         return(false);
     }
     return(true);
 }