コード例 #1
0
ファイル: frmASFlattener.cs プロジェクト: japj/bidshelper
        private void btnOptions_Click(object sender, EventArgs e)
        {
            Options.lbHierarchies.Items.Clear();
            Options.lbAttributes.Items.Clear();
            if (VerifySelections())
            {
                if (dim != null)
                {
                    foreach (Hierarchy hier in dim.Hierarchies)
                    {
                        Options.lbHierarchies.Items.Add(new ctlFancyCheckedListBoxItem(hier.Name, true));
                    }
                    foreach (DimensionAttribute attr in dim.Attributes)
                    {
                        if (attr.Usage == AttributeUsage.Regular)
                        {
                            if (ASPCDimNaturalizer.IsAttributeRelated(attr, dim.KeyAttribute))
                            {
                                Options.lbAttributes.Items.Add(attr.Name);
                            }
                            Options.lbHierarchies.Items.Add(new ctlFancyCheckedListBoxItem(attr.Name, false));
                        }
                    }
                }
            }

            for (int i = 0; i < Options.lbAttributes.Items.Count; i++)
            {
                if (PCAttributesToInclude.Contains((string)Options.lbAttributes.Items[i]) || AddAllPCAttributes)
                {
                    Options.lbAttributes.SetItemChecked(i, true);
                }
            }
            for (int i = 0; i < Options.lbHierarchies.Items.Count; i++)
            {
                if (NonPCHierarchiesToInclude.Contains(((ctlFancyCheckedListBoxItem)Options.lbHierarchies.Items[i]).Text) || AddAllNonPCHierarchies)
                {
                    Options.lbHierarchies.SetItemChecked(i, true);
                }
            }
            Options.tabControl1.SelectedIndex = 0;
            Options.numMinLevels.Value        = MinLevels;
            Options.trkActionLevel.Value      = ActionLevel;
            Options.ShowDialog();
        }
コード例 #2
0
ファイル: frmASFlattener.cs プロジェクト: japj/bidshelper
 public bool VerifySelections()
 {
     try
     {
         if (VerifyServer())
         {
             if (srv.Databases.ContainsName(cmbDatabase.Text))
             {
                 db = srv.Databases.GetByName(cmbDatabase.Text);
             }
             else
             {
                 return(false);
             }
             if (db == null || !db.Dimensions.ContainsName(cmbDimension.Text))
             {
                 return(false);
             }
             dim = db.Dimensions.GetByName(cmbDimension.Text);
             for (int i = 0; i < PCAttributesToInclude.Count; i++)
             {
                 if (!dim.Attributes.ContainsName(PCAttributesToInclude[i]))
                 {
                     PCAttributesToInclude.RemoveAt(i);
                     i--;
                 }
             }
             for (int i = 0; i < NonPCHierarchiesToInclude.Count; i++)
             {
                 if (!dim.Attributes.ContainsName(NonPCHierarchiesToInclude[i]))
                 {
                     NonPCHierarchiesToInclude.RemoveAt(i);
                     i--;
                 }
             }
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }