private void AddSuborTabTrnLevel(ViewElement viewElement, Transaction trn, TransactionLevel subLevel)
        {
            TabElement tabElement = viewElement.AddTab(subLevel.Name);
            tabElement.Name = subLevel.Description;
            tabElement.Wcname = trn.Name + subLevel.Name + "WC";
            tabElement.Description = subLevel.Description;
            tabElement.Type = TabElement.TypeValue.Grid;
            tabElement.Page = TabElement.PageValue.Default;

            AddGridTabAttributes(tabElement, trn, subLevel, subLevel.Attributes);
        }
        private void AddParallelTabs(ViewElement viewElement, Transaction trn, TransactionLevel level)
        {
            foreach (Transaction parallel in level.AssociatedTable.AssociatedTransactions)
            {
                if (!parallel.Equals(trn))
                {
                    TabElement tabElement = viewElement.AddTab(parallel.Name);
                    tabElement.Name = parallel.Description;
                    tabElement.Wcname = trn.Name + parallel.Name;
                    tabElement.Type = TabElement.TypeValue.Tabular;

                    AddTrn(parallel, tabElement);
                    AddTabularTabAttributes(tabElement, parallel, parallel.Structure.Root);
                    AddActions(tabElement);
                }
            }
        }
        private void AddSuborTabTransaction(ViewElement viewElement, string tabId, TransactionLevelRelation relation)
        {
            // Do not include the attributes "known due to context" (for example, when browsing the client's invoices, drop ClientId, ClientName, and ClientAddress).
            BaseCollection<TransactionAttribute> attrisInTab = new BaseCollection<TransactionAttribute>(relation.RelatedTransaction.Structure.Root.Attributes);
            attrisInTab.RemoveAll(delegate(TransactionAttribute trnAtt) { return relation.ContainsRelatedAttribute(trnAtt.Attribute); });

            // This may leave us with nothing to add, actually...
            if (attrisInTab.Count > 0)
            {
                TabElement tabElement = viewElement.AddTab(tabId);
                tabElement.Name = (relation.GroupRelation != null ? relation.GroupRelation.Description : relation.RelatedTransaction.Description);
                tabElement.Wcname = relation.BaseTransaction.Name + tabId + "WC";
                tabElement.Description = (relation.GroupRelation != null ? relation.GroupRelation.Description : relation.RelatedTransaction.Description);
                tabElement.Type = TabElement.TypeValue.Grid;
                tabElement.Page = TabElement.PageValue.Default;

                // If the attribute names in the subordinated tab differ from those in the view, they
                // must be explicitly listed (for "trn level subordination", they are known to be equal).
                bool hasDifferentAttris = false;
                IList<Gx.Attribute> paramAttris = new List<Gx.Attribute>();
                foreach (AttributeRelation subordAttr in relation.KeyAttributes)
                {
                    paramAttris.Add(subordAttr.Related);
                    hasDifferentAttris = hasDifferentAttris || (subordAttr.Base != subordAttr.Related);
                }

                if (hasDifferentAttris)
                {
                    foreach (Gx.Attribute paramAttri in paramAttris)
                        AddParameter(tabElement.Parameters, paramAttri.Name, true);
                }

                AddTrn(relation.RelatedTransaction, tabElement);
                AddGridTabAttributes(tabElement, relation.RelatedTransaction, relation.RelatedTransaction.Structure.Root, attrisInTab);
                tabElement.Modes = new ModesElement();
                tabElement.Modes.InsertCondition = viewElement.Instance.Settings.StandardActions.Insert.Condition;
                tabElement.Modes.UpdateCondition = viewElement.Instance.Settings.StandardActions.Update.Condition;
                tabElement.Modes.DeleteCondition = viewElement.Instance.Settings.StandardActions.Delete.Condition;
                tabElement.Modes.DisplayCondition = viewElement.Instance.Settings.StandardActions.Display.Condition;
                tabElement.Modes.ExportCondition = viewElement.Instance.Settings.StandardActions.Export.Condition;

            }
        }
        private void AddTabularTab(ViewElement viewElement, Transaction trn, TransactionLevel level, string lvlName, string wcDescription, bool needActions)
        {
            string code = "General";

            TabElement tabElement = viewElement.AddTab(code);
            tabElement.Name = viewElement.Instance.Settings.Labels.GeneralTab;
            tabElement.Wcname = lvlName + "General";
            tabElement.Description = wcDescription + " Info";
            tabElement.Type = TabElement.TypeValue.Tabular;

            AddTabularTabAttributes(tabElement, trn, level);

            if (needActions)
                AddActions(tabElement);
        }