Ejemplo n.º 1
0
        private void AddSelection(Transaction trn, LevelElement levelElement)
        {
            levelElement.Selection = new SelectionElement();

            string plulralDescription = trn.Description; // (Pluralizer.IsNounPlural(trn.Description) ? trn.Description : Pluralizer.ToPlural(trn.Description));
            levelElement.Selection.Description = FormatString(levelElement.Instance.Settings.Labels.WorkWithTitle, plulralDescription);
            levelElement.Selection.Page = SelectionElement.PageValue.Default;
            levelElement.Selection.MasterPage = SelectionElement.MasterPageValue.Default;
            levelElement.Selection.Modes.InsertCondition = levelElement.Instance.Settings.StandardActions.Insert.Condition;
            levelElement.Selection.Modes.UpdateCondition = levelElement.Instance.Settings.StandardActions.Update.Condition;
            levelElement.Selection.Modes.DeleteCondition = levelElement.Instance.Settings.StandardActions.Delete.Condition;
            levelElement.Selection.Modes.DisplayCondition = levelElement.Instance.Settings.StandardActions.Display.Condition;
            levelElement.Selection.Modes.ExportCondition = levelElement.Instance.Settings.StandardActions.Export.Condition;

            foreach (TransactionAttribute ta in trn.Structure.Root.PrimaryKey)
            {
                levelElement.Selection.Identifier = ta.Name;

                bool sai = true;
                foreach (SettingsDefaultFilterElement filter in levelElement.Instance.Settings.DefaultFilters.DefaultFilters)
                {
                    if (filter.Selection && !filter.InGridSelection)
                    {
                        if (filter.Attribute != null)
                        {
                            if (filter.Attribute.Name == ta.Name)
                            {
                                sai = false;
                            }
                        }
                        if (!String.IsNullOrEmpty(filter.PartName))
                        {
                            if (ta.Name.IndexOf(filter.PartName, StringComparison.CurrentCultureIgnoreCase) >= 0)
                            {
                                sai = false;
                            }
                        }
                    }
                }

                if (sai)
                    break;

            }

            AddSuggestParameters(levelElement.Selection.Parameters, false, true);

            AddSuggestActions(levelElement.Selection.Actions, levelElement.Instance.Settings);

            string tmpn = HPatternBuildProcess.GetSugestName(trn.Name, levelElement.Instance.Settings);
            if (!String.IsNullOrEmpty(tmpn))
                levelElement.Selection.ObjName = tmpn;

            AddTransactionAttributes(levelElement.Selection.Attributes, trn.Structure.Root, trn.Structure.Root.Attributes, AttributeTitle.Column);
            AddGridOrders(levelElement.Selection, trn, trn.Structure.Root);
            AddGridFilter(levelElement.Selection, trn, trn.Structure.Root);
        }
Ejemplo n.º 2
0
 private void AddDescriptionAttribute(LevelElement levelElement, TransactionAttribute da)
 {
     if (da != null)
     {
         DescriptionAttributeElement daElement = new DescriptionAttributeElement();
         daElement.Attribute = da.Attribute;
         daElement.Description = da.Attribute.ContextualTitleProperty;
         levelElement.DescriptionAttribute = daElement;
     }
 }
Ejemplo n.º 3
0
        private void AddPrompt(Transaction trn, LevelElement levelElement)
        {
            PromptElement prompt = new PromptElement();
            levelElement.Prompts.Add(prompt);
            string plulralDescription = trn.Description; //(Pluralizer.IsNounPlural(trn.Description) ? trn.Description : Pluralizer.ToPlural(trn.Description));
            if (String.IsNullOrEmpty(levelElement.Instance.Settings.Objects.Prompt))
            {
                prompt.Name = String.Format("Prompt{0}", trn.Name);
            }
            else
            {
                prompt.Name = levelElement.Instance.Settings.Objects.Prompt.Replace("<Object>", trn.Name);
            }
            prompt.Description = FormatString(levelElement.Instance.Settings.Labels.PromptTitle, plulralDescription);
            prompt.Page = PromptElement.PageValue.Default;
            prompt.MasterPage = PromptElement.MasterPageValue.Default;
            prompt.Modes.InsertCondition = levelElement.Instance.Settings.StandardActions.Insert.Condition;
            prompt.Modes.UpdateCondition = levelElement.Instance.Settings.StandardActions.Update.Condition;
            prompt.Modes.DeleteCondition = levelElement.Instance.Settings.StandardActions.Delete.Condition;
            prompt.Modes.DisplayCondition = levelElement.Instance.Settings.StandardActions.Display.Condition;
            prompt.Modes.ExportCondition = levelElement.Instance.Settings.StandardActions.Export.Condition;

            AddSuggestActions(prompt.Actions, levelElement.Instance.Settings);

            AddPromptParameter(prompt, trn.Structure.Root);
            AddPromptAttributes(prompt.Attributes, trn.Structure.Root, trn.Structure.Root.Attributes, AttributeTitle.Column);
            AddGridOrders(prompt, trn, trn.Structure.Root);
            AddGridFilter(prompt, trn, trn.Structure.Root);
        }
Ejemplo n.º 4
0
        private void AddView(Transaction trn, LevelElement levelElement, bool backToSelection, IList<TransactionAttribute> pk, TransactionLevel level, string viewName, string description, bool needActions, IList<TransactionAttribute> fixedAttris)
        {
            levelElement.View = new ViewElement();
            levelElement.View.Description = FormatString(levelElement.Instance.Settings.Labels.ViewDescription, description);
            levelElement.View.BackToSelection = backToSelection;
            levelElement.View.MasterPage = ViewElement.MasterPageValue.Default;

            string trnCaption = (level.DescriptionAttribute != null ? String.Format("{0}.ToString()", level.DescriptionAttribute.Name) : String.Format("\"{0}\"", trn.Description));
            levelElement.View.Caption = trnCaption;

            AddParameters(levelElement.View, false, pk);

            if (level.DescriptionAttribute != null)
                fixedAttris.Add(level.DescriptionAttribute);
            levelElement.View.FixedData = new FixedDataElement();
            AddFixedDataAttributes(levelElement.View.FixedData, level, fixedAttris);

            AddTabs(trn, levelElement.View, viewName, description, level, needActions);
        }