static void PrintCategories(AFDatabase database) { try { Console.WriteLine("Print Categories"); AFCategories elemCategories = database.ElementCategories; AFCategories attrCategories = database.AttributeCategories; Console.WriteLine("Element Categories"); foreach (AFCategory category in elemCategories) { Console.WriteLine("{0}", category.Name); } Console.WriteLine(); Console.WriteLine("Attribute Categories"); foreach (AFCategory category in attrCategories) { Console.WriteLine(category.Name); } Console.WriteLine(); } catch (Exception ex) { Logs Err = new Logs(); Err.MyLogFile(ex); Console.WriteLine("An Error has occured for details please check the Log File: '" + ex.Message + "'"); Console.ReadLine(); } }
public RollupDRConfig(RollupDR dataReference, bool bReadOnly) { this.InitializeComponent(); this.dataReference = dataReference; if (bReadOnly) { this.cboCategories.Enabled = false; this.cboCalculations.Enabled = false; this.btnOK.Visible = false; this.btnOK.Enabled = false; this.btnCancel.Left = (this.btnOK.Left + this.btnCancel.Left) / 2; this.btnCancel.Text = "Close"; base.AcceptButton = this.btnCancel; } AFCategories aFCategories = null; if (dataReference.Attribute != null) { aFCategories = dataReference.Attribute.Database.AttributeCategories; } else { if (dataReference.Template != null) { aFCategories = dataReference.Template.Database.AttributeCategories; } } foreach (AFCategory current in aFCategories) { this.cboCategories.Items.Add(current.Name); } if (this.cboCategories.Items.Count > 0) { this.cboCategories.SelectedIndex = 0; } this.cboCalculations.Items.Add("Avg"); this.cboCalculations.Items.Add("Max"); this.cboCalculations.Items.Add("Min"); this.cboCalculations.Items.Add("Sum"); if (this.cboCalculations.Items.Count > 0) { this.cboCalculations.SelectedIndex = 0; } if (dataReference.CategoryName != null && this.cboCategories.Items.Contains(dataReference.CategoryName)) { this.cboCategories.Text = dataReference.CategoryName; } if (dataReference.Calculation != null && this.cboCalculations.Items.Contains(dataReference.Calculation)) { this.cboCalculations.Text = dataReference.Calculation; } }
private AFCategory CreateCategory(AFCategories categories, string categoryName, int number = 1) { string compl = string.Empty; if (number > 1) { compl = number.ToString(); } AFCategory category = categories[categoryName + compl]; if (category == null) { category = categories.Add(categoryName + compl); } category.Description = "Original description"; return(category); }
static void PrintCategories(AFDatabase database) { Console.WriteLine("Print Categories\n"); AFCategories elemCategories = database.ElementCategories; AFCategories attrCategories = database.AttributeCategories; Console.WriteLine("Element Categories"); foreach (AFCategory category in elemCategories) { Console.WriteLine(category.Name); } Console.WriteLine(); Console.WriteLine("Attribute Categories"); foreach (AFCategory category in attrCategories) { Console.WriteLine(category.Name); } Console.WriteLine(); }