public override void Generate(KBObject baseObject, PatternInstance instance)
        {
            if (baseObject is Transaction)
            {

                //modMain.SetGXPath(Artech.Common.Helpers.IO.PathHelper.StartupPath);

                pinstance = instance;
                Transaction transaction = (Transaction)baseObject;
                HPatternInstance wwInstance = new HPatternInstance(transaction.Model);

                settings = wwInstance.Settings;

                //Dictionary<string, object> propertiesg = new Dictionary<string, object>();
                //propertiesg[Properties.HTMLATT.ReadOnly] = true;
                //settings.Grid.Rules

                //Dictionary<string, object> propertiesg = new Dictionary<string, object>();
                //propertiesg[Properties.HTMLSFL.Rules] = Properties.HTMLSFL.Rules_Values.Rows;

                //System.Text.Encoding.w
                // string template = System.Text.Encoding.Default.GetString(file.BlobPart.Data);

                // testes
                /*
                KBModel model = Artech.Architecture.UI.Framework.Services.UIServices.KB.CurrentModel;
                foreach (WikiFileKBObject file in WikiFileKBObject.GetAll(model)) {
                    System.Windows.Forms.MessageBox.Show("File: " + file.Name);
                    byte[] b = file.BlobPart.Data;
                    string saida = System.Text.StringBuilder .GetString(b);
                    System.Text.StringBuilder sb = System.Text.StringBuilder();

                }
                */

                //Antlr.StringTemplate.FileSystemTemplateLoader st = new Antlr.StringTemplate.FileSystemTemplateLoader("");

                Generate(transaction, wwInstance);
                wwInstance.SaveTo(instance);
            }
            else if (baseObject is WebPanel)
            {
                HPatternInstance wwInstance = new HPatternInstance(instance);
                if (wwInstance.WebPanelRoot == null)
                {
                    wwInstance.WebPanelRoot = new WebPanelRootElement();
                }
                wwInstance.SaveTo(instance);
            } else {
                throw new PatternException(Messages.ParentMustBeTransaction);
            }
        }
Esempio n. 2
0
        public static HPatternSettings Get(KBModel model)
        {
            PatternSettings current = PatternSettings.Get(model, HPatternPattern.Definition);
            HPatternSettings cached = model.GetPropertyValue<HPatternSettings>(k_ModelProperty);

            if (cached == null || cached.VersionId != current.VersionId)
            {
                cached = new HPatternSettings(current);
                cached.VersionId = current.VersionId;
                model.SilentSetPropertyValue(k_ModelProperty, cached);
            }

            return cached;
        }
Esempio n. 3
0
        public static void AddStandardVariables(List<string> lista,HPatternSettings settings)
        {
            lista.Add("IsAuthorized");

            if(!settings.Grid.DefaultPagingButtons)
            {
                lista.Add("CurrentPage");
                lista.Add("pagec");
            }

            if(settings.Grid.MaxPage)
            {
                lista.Add("MaxPage");
            }

            if(settings.Grid.MaxRecords) {
                lista.Add("MaxRecords");
            }

            if (settings.Grid.PageRecordsCombo)
            {
                lista.Add("RecordPage");
            }
        }
        private void AddSuggestActions(ActionsElement actions, HPatternSettings settings,bool trn,bool prt,bool tab)
        {
            foreach (SettingsSuggestActionElement act in settings.SuggestActions)
            {
                if ((act.SuggestSelection && trn == false && prt == false && tab == false)
                    || (act.SuggestTransaction && trn == true)
                    || (act.SuggestPrompt && prt == true)
                    || (act.SuggestViewTab && tab == true))
                {
                    ActionElement action = new ActionElement();
                    action.Name = act.Name;
                    action.Caption = act.Caption;
                    action.Legend = act.Legend;
                    action.Gxobject = act.Gxobject;
                    action.InGrid = act.InGrid;
                    action.MultiRowSelection = act.MultiRowSelection;
                    action.Image = act.Image;
                    action.DisabledImage = act.DisabledImage;
                    action.Tooltip = act.Tooltip;
                    action.Condition = act.Condition;
                    action.ButtonClass = act.ButtonClass;
                    action.EventCode = act.EventCode;
                    action.CodeEnable = act.CodeEnable;
                    action.Position = act.Position;
                    action.Width = act.Width;
                    action.GridHeight = act.GridHeight;
                    action.GridWidth = act.GridWidth;

                    // Parametros
                    foreach (SettingsSuggestParameterElement par in act.Parameters)
                    {
                        ParameterElement pare = new ParameterElement();
                        pare.Name = par.Name;
                        pare.Domain = par.Domain;
                        pare.Null = par.Null;
                        action.Parameters.Add(pare);
                    }

                    actions.Add(action);
                }
            }
        }
 private void AddSuggestActions(ActionsElement actions, HPatternSettings settings, bool trn)
 {
     AddSuggestActions(actions, settings, trn,false,false);
 }
Esempio n. 6
0
        private static string GridActions(IGridObject GridObject, bool actionsModes, bool geraBC, HPatternSettings settings)
        {
            StringBuilder sgrid = new StringBuilder();
            if (actionsModes)
            {
                if (GridObject.Actions.MultiRowActions.Count > 0)
                {
                    // Checkbox is first column.
                    sgrid.Append(WebForm.GridVariable("Selected", null, ""));
                }

                foreach (ActionElement inGridAction in GridObject.Actions.GridActions)
                {
                    // InGrid actions go next.
                    if (geraBC && settings.StandardActions.FindAction(inGridAction.Name) != null)
                    {
                        Dictionary<String, Object> dict = new Dictionary<string, object>();
                        switch (inGridAction.Name)
                        {
                            case StandardAction.Insert:
                                dict[Properties.HTMLSFLCOL.OnClickEvent] = "'DoInsert'";
                                break;
                            case StandardAction.Update:
                                dict[Properties.HTMLSFLCOL.OnClickEvent] = "'Atualiza'";
                                break;
                            case StandardAction.Delete:
                                dict[Properties.HTMLSFLCOL.OnClickEvent] = "'Apaga'";
                                break;
                            case StandardAction.Display:
                                dict[Properties.HTMLSFLCOL.OnClickEvent] = "'DoDisplay'";
                                break;
                        }
                        sgrid.Append(WebForm.GridVariable(inGridAction.ControlName(), null, String.Empty, true, null, dict));
                    }
                    else
                    {
                        sgrid.Append(inGridAction.ToHtml());
                    }
                }
            }
            return sgrid.ToString();
        }
        private static void UpdateProperties(HPatternInstance instance, HPatternSettings settings, Transaction transaction)
        {
            WebPanel mTransaction = settings.MasterPages.Transaction;
            string AMP = SettingsThemeElement.SetObjectThemeValue.True;
            string ATema = settings.Theme.SetObjectTheme;
            Theme tTema = null;
            if (ATema != SettingsThemeElement.SetObjectThemeValue.False)
                tTema = settings.Theme.Theme;

            foreach (SettingsThemeMasterPageElement sis in settings.CustomThemeMasterPage)
            {
                if (transaction.Name.IndexOf(sis.Name, StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    if (sis.SetMasterPage != SettingsThemeMasterPageElement.SetMasterPageValue.False)
                    {
                        mTransaction = sis.Transaction;
                        AMP = sis.SetMasterPage;
                    }
                    if (sis.SetTheme != SettingsThemeMasterPageElement.SetThemeValue.False)
                    {
                        tTema = sis.Theme;
                        ATema = sis.SetTheme;
                    }
                    break;
                }
            }

            if (transaction.IsPropertyDefault(Properties.TRN.MasterPage) || AMP == SettingsThemeElement.SetObjectThemeValue.Force)
            {
                if (mTransaction == null)
                {
                    transaction.SetPropertyValue(Properties.TRN.MasterPage, new WebPanelReference());
                }
                else
                {
                    transaction.SetPropertyValue(Properties.TRN.MasterPage, new WebPanelReference(mTransaction));
                }
            }

            if (tTema != null)
            {
                if (transaction.IsPropertyDefault(Properties.TRN.Theme) || ATema == SettingsThemeElement.SetObjectThemeValue.Force)
                {
                    transaction.SetPropertyValue(Properties.TRN.Theme, new KBObjectReference(tTema));
                }
            }

            if (instance.Levels.Count > 0 && instance.Levels[0].View != null)
            {
                if (instance.Levels[0].View.UseAsSearchViewer)
                {
                    try
                    {

                        PropertyManager.PropertySpecDescriptor searchViewerProperty = transaction.GetPropertyDescriptor(Properties.TRN.SearchViewer);
                        if (searchViewerProperty.IsApplicable && searchViewerProperty.IsBrowsable && searchViewerProperty.IsDefaultValue)
                        {
                            WebPanel viewObject = WebPanel.Get(transaction.Model, instance.Levels[0].View.ObjectName);
                            if (viewObject != null)
                                transaction.SetPropertyValue(Properties.TRN.SearchViewer, new KBObjectReference(viewObject));
                        }

                    }
                    catch (Exception e) {
                        LogLicense.LogEmpty(e.Message + e.StackTrace);
                    }
                }
            }
        }
        private static string UpdateEvents(HPatternInstance instance, HPatternSettings settings, Transaction transaction)
        {
            BasicParser parser = new BasicParser("");

            DeleteGeneratedBlocks(parser);

            UpdateEventCodes(instance.Settings, parser);

            parser.InsertBefore(0, MenuContext.get(instance.WebObject.Actions).Events());

            // Se não vou gerar BC e tenho abas
            if (!instance.Transaction.WebBC && instance.Transaction.Form.Tabs.Count > 0)
            {
                Tab tabs = Tab.getTab(instance.Transaction.Form, transaction);
                parser.InsertBefore(0, tabs.Subs());
                //parser.InsertBefore(0, TemplateAbas.EventsExtra(instance.Transaction.Form));
            }
            UpdateEventActions(instance, settings, parser);
            UpdateEventPrompts(instance, settings,parser);
            UpdateEventAfterTrn(instance, transaction, parser);
            UpdateEventStart(instance, settings, transaction, parser);

            return parser.Text;
        }
Esempio n. 9
0
 private static void LinkBuild(StringBuilder atts, IHPatternInstanceElement ele,HPatternSettings settings)
 {
     if (settings.Template.TemPrompt)
     {
         if (ele is AttributeElement)
         {
             AttributeElement att = (AttributeElement)ele;
             if (att.Links != null)
             {
                 foreach (LinkElement link in att.Links)
                 {
                     LinkImage(atts, link, att.AttributeName, settings);
                 }
             }
         }
         if (ele is VariableElement)
         {
             VariableElement att = (VariableElement)ele;
             if (att.Links != null)
             {
                 foreach (LinkElement link in att.Links)
                 {
                     LinkImage(atts, link, att.Name, settings);
                 }
             }
         }
     }
 }
Esempio n. 10
0
        public static string GetSugestName(string trnNameB, HPatternSettings settings)
        {
            string trnName = trnNameB.ToLower();

            if (ftname == null)
            {
                try
                {
                    ftname = settings.Template.ObjectsNamesName;
                }
                catch (System.Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message + e.StackTrace);
                    ftname = null;
                }

                if (ftname != null)
                {
                    file = WikiFileKBObject.Get(Artech.Architecture.UI.Framework.Services.UIServices.KB.CurrentModel, ftname);
                }
            }

            if (file != null && trns.Count == 0)
            {
                nomes = System.Text.Encoding.Default.GetString(file.BlobPart.Data);

                foreach (string nomel in nomes.Split(Environment.NewLine.ToCharArray()))
                {
                    string[] nomef = nomel.Split(';');
                    if (nomef.Length > 0)
                    {
                        if (!String.IsNullOrEmpty(nomef[0]))
                        {
                            trns.Add(nomef[0].ToLower());
                            if (nomef.Length > 1)
                            {
                                if (String.IsNullOrEmpty(nomef[1]))
                                {
                                    objs.Add("");
                                }
                                else
                                {
                                    objs.Add(nomef[1]);
                                }
                            }
                            else
                            {
                                objs.Add("");
                            }
                        }
                    }
                }
            }

            if (trns.Count > 0 && sugname == null)
            {
                int achou = trns.IndexOf(trnName);
                if (achou >= 0)
                {
                    if (!String.IsNullOrEmpty((string)objs[achou]))
                    {
                        sugname = (string)objs[achou];
                    }
                }
                else
                {
                    if (trnName.Substring(0, 1) == "t")
                    {
                        string tmpName = trnName.Substring(1, trnName.Length - 1);
                        achou = trns.IndexOf(tmpName);
                        if (achou >= 0)
                        {
                            if (!String.IsNullOrEmpty((string)objs[achou]))
                            {
                                sugname = (string)objs[achou];
                            }
                        }
                    }
                }
            }

            string tmpn = null;

            if (!String.IsNullOrEmpty(sugname))
            {
                tmpn = sugname;
                if (usados.IndexOf(tmpn) < 0)
                {
                    usados.Add(tmpn);
                }
                else
                {
                    if (String.IsNullOrEmpty(sigla))
                    {
                        sigla = "a";
                    }
                    else
                    {
                        byte[] caracteres = new byte[System.Text.Encoding.ASCII.GetByteCount(sigla)];
                        caracteres = System.Text.Encoding.ASCII.GetBytes(sigla);
                        if (caracteres.Length > 0)
                        {
                            sigla = char.ConvertFromUtf32(caracteres[0] + 1);
                        }
                    }
                    tmpn = sugname + sigla;
                    usados.Add(tmpn);
                }
            }

            return tmpn;
        }
Esempio n. 11
0
        public static string PromptRules(IHPatternInstanceElement objele, HPatternSettings settings, string prefix)
        {
            StringBuilder ret = new StringBuilder();
            if (settings.Template.TemPrompt)
            {
                if (objele is FormElement)
                {
                    FormElement form = (FormElement)objele;
                    foreach (IHPatternInstanceElement ele in form.Items)
                    {
                        if (ele is TabFormElement)
                        {
                            TabFormElement tab = (TabFormElement)ele;
                            foreach (RowElement row in tab.Rows)
                            {
                                PromptRulesRow(ret, row, settings,prefix);
                            }
                        }
                        if (ele is RowElement)
                        {
                            RowElement row = (RowElement)ele;
                            PromptRulesRow(ret, row, settings,prefix);
                        }
                    }
                }
                if (objele is TabFormElement)
                {
                    TabFormElement tab = (TabFormElement)objele;
                    foreach (RowElement row in tab.Rows)
                    {
                        PromptRulesRow(ret, row, settings,prefix);
                    }

                }
            }
            return ret.ToString();
        }
Esempio n. 12
0
 public static string PromptRules(IHPatternInstanceElement objele, HPatternSettings settings)
 {
     return PromptRules(objele, settings, "");
 }
Esempio n. 13
0
        public static string LinksEventStart(Artech.Common.Collections.IBaseCollection<LinkElement> links)
        {
            StringBuilder ret = new StringBuilder();
            if (links != null)
            {
                if (links.Count > 0) {

                    if (sett == null) sett = links[0].Instance.Settings;
                    if (sett.Template.TemPrompt)
                    {
                        if (links != null)
                        {
                            if (links.Count > 0)
                            {
                                foreach (LinkElement link in links)
                                {
                                    ret.Append(link.EventStart);
                                }
                            }
                        }
                    }
                }
            }
            return ret.ToString();
        }
Esempio n. 14
0
 public static void LinkImage(StringBuilder atts, LinkElement link, string name, HPatternSettings settings)
 {
     string imagename = settings.Template.PromptImageName;
     string eventname = null;
     if (link.Image != null)
     {
         if (!String.IsNullOrEmpty(link.ImageName))
             imagename = link.ImageName;
     }
     // Se não temos imagem de prompt definido, vamos procurar uma na kb
     if (String.IsNullOrEmpty(imagename))
     {
         imagename = ImageDefault(link.Instance.Model);
     }
     if (link.Type == LinkElement.TypeValue.Event)
         eventname = String.Format("'{0}'", link.EventName);
     atts.AppendLine(WebForm.Image(link.ControlName, settings.Template.PromptClass, imagename, eventname, link.Tooltip));
 }
Esempio n. 15
0
 private static void PromptRulesRow(StringBuilder ret, RowElement row, HPatternSettings settings, string prefix)
 {
     // Percorre as colunas
     foreach (ColumnElement col in row.Columns)
     {
         // Percorre os elementos
         foreach (IHPatternInstanceElement ele in col.Items)
         {
             if (ele is AttributeElement || ele is VariableElement)
             {
                 PromptRulesElement(ret, ele, settings,prefix);
             }
             if (ele is GroupElement)
             {
                 GroupElement grp = (GroupElement)ele;
                 foreach (RowElement row2 in grp.Rows)
                 {
                     PromptRulesRow(ret, row2, settings, prefix);
                 }
             }
         }
     }
 }
Esempio n. 16
0
 private static void PromptRulesElement(StringBuilder ret, IHPatternInstanceElement ele, HPatternSettings settings, string prefix)
 {
     if (ele is AttributeElement)
     {
         AttributeElement att = (AttributeElement)ele;
         if (att.Links != null)
         {
             foreach (LinkElement link in att.Links)
             {
                 RulePrompt(ret, link, att.AttributeName, settings, prefix);
             }
         }
     }
     if (ele is VariableElement)
     {
         VariableElement att = (VariableElement)ele;
         if (att.Links != null)
         {
             foreach (LinkElement link in att.Links)
             {
                 RulePrompt(ret, link, att.Name, settings, prefix);
             }
         }
     }
 }
Esempio n. 17
0
 private void AddSuggestActionsTab(ActionsElement actions, HPatternSettings settings)
 {
     AddSuggestActions(actions, settings, false,false,true);
 }
        private static void UpdateVariables(HPatternInstance instance, HPatternSettings settings, Transaction transaction)
        {
            foreach (RowElement row in instance.Transaction.GetRows(""))
            {
                foreach (ColumnElement col in row.Columns)
                {
                    foreach (VariableElement vare in col.Variables)
                    {
                        if (vare.Domain != null) {
                            Variable var = AddVariable(transaction,vare.Name);
                            if (var != null)
                                var.DomainBasedOn = vare.Domain;

                        }
                        if (vare.Attribute != null)
                        {
                            Variable var = AddVariable(transaction, vare.Name);
                            if (var != null)
                                var.AttributeBasedOn = vare.Attribute;
                        }
                    }
                }
            }

            Tab tabs = Tab.getTab(instance.Transaction.Form, transaction);

            tabs.VariablesTrn();

            /*
            Variable var2 = AddVariable(transaction, "MenuData");
            if (var2 != null)
                DataType.ParseInto(transaction.Model, "MenuData", var2);

            var2 = AddVariable(transaction, "MenuDataItem");
            if (var2 != null)
                DataType.ParseInto(transaction.Model, "MenuData.MenuDataItem", var2);
            */

            Variable var2 = AddVariable(transaction, "HTTPRequest");
            if (var2 != null)
                DataType.ParseInto(transaction.Model, "HttpRequest", var2);

            var2 = AddVariable(transaction, "n");
            if (var2 != null)
            {
                var2.Type = eDBType.NUMERIC;
                var2.Length = 1;
                var2.Decimals = 0;
                var2.Signed = false;
            }

            // Add variables for primary key.
            foreach (TransactionAttribute trnAtt in transaction.Structure.Root.PrimaryKey)
                AddBasedOnVariable(transaction, trnAtt.Name, trnAtt);

            // Add variables for Context.
            foreach (SettingsContextVariableElement contextVar in settings.Context)
            {
                Variable var = AddVariable(transaction, contextVar.Name);
                if (var != null)
                    contextVar.SetType(var);
            }

            // Add variables for Security.
            //if (settings.Security.Enabled)
            //{
                var2 = AddVariable(transaction, "IsAuthorized");
                if (var2 != null)
                    var2.Type = eDBType.Boolean;
            //}

            if (instance.Transaction.Parameters != null)
            {
                if (instance.Transaction.Parameters.Count > 0) {

                    foreach (ParameterElement pare in instance.Transaction.Parameters)
                    {
                        if (pare.IsAttribute)
                        {
                            TransactionAttribute ta = transaction.Structure.Root.GetAttribute(pare.Name);
                            if (ta != null)
                            {
                                AddBasedOnVariable(transaction, pare.Name, ta);
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(pare.DomainName))
                            {
                                Variable var = AddVariable(transaction, pare.Name.Replace("&",""));
                                if (var != null)
                                    var.DomainBasedOn = pare.Domain;
                            }
                        }
                    }
                }
            }

            /*
            if (instance.Transaction.Form.HasConditionalTabs())
            {
                Variable var = AddVariable(transaction, "conta");
                if (var != null)
                {
                    var.Type = eDBType.NUMERIC;
                    var.Length = 4;
                    var.Decimals = 0;
                    var.Signed = false;
                }
            }
            */

            if (settings.Template.UseTransactionContext)
            {
                Variable var = AddVariable(transaction, "TrnContext");
                if (var != null)
                    DataType.ParseInto(transaction.Model, "TransactionContext", var);

                var = AddVariable(transaction, "WebSession");
                if (var != null)
                    DataType.ParseInto(transaction.Model, "WebSession", var);

                if (HasContextAttributes(transaction))
                {
                    // Add variables for Context Attributes (FKs excluding PKs atts)
                    foreach (TransactionAttribute trnAtt in ContextAttributes(transaction))
                        AddBasedOnVariable(transaction, "Insert_" + trnAtt.Name, trnAtt);

                    var = AddVariable(transaction, "TrnContextAtt");
                    if (var != null)
                        DataType.ParseInto(transaction.Model, "TransactionContext.Attribute", var);
                }
            }
            addLinkCallBack(instance,transaction.Variables);

            MenuContext.get(instance.WebObject.Actions).Variables(transaction.Variables);
        }
Esempio n. 19
0
 private void ChangeDocumentation(DocumentationPart docp, KBObject obj, HPatternInstance wwInstance, HPatternSettings settings)
 {
     TemplateInternal.DocumentationSave(docp, obj, wwInstance, settings);
 }
        private static void UpdateEventCodes( HPatternSettings settings, BasicParser parser)
        {
            string codes = TemplateInternal.EventCodes(TemplateInternal.CodeType.Transaction, settings);
            if (!String.IsNullOrEmpty(codes))
            {

                StringBuilder eventBuilder = new StringBuilder();
                //eventBuilder.AppendLine(k_GeneratedMarkerStart);
                eventBuilder.AppendLine(codes);
                //eventBuilder.AppendLine(k_GeneratedMarkerEnd);
                eventBuilder.Append(Environment.NewLine);
                parser.InsertBefore(0, eventBuilder.ToString());

            }
        }
Esempio n. 21
0
 public static void RulePrompt(StringBuilder ret, LinkElement link,string name, HPatternSettings settings,string prefix)
 {
     if (link.Type == LinkElement.TypeValue.Prompt && !String.IsNullOrEmpty(link.WebpanelObjectName))
     {
         ret.AppendLine(String.Format("Prompt({0},{1}) on {2};", link.WebpanelObjectName, link.Parameters.ConcatenatePrompt(prefix,false), link.ControlName));
     }
 }
Esempio n. 22
0
        private static string GridWebForm2(Artech.Architecture.Common.Objects.KBObject Object,Artech.Architecture.Common.Objects.KBObjectPart Part,Heurys.Patterns.HPattern.HPatternInstance Instance,Heurys.Patterns.HPattern.IGridObject GridObject)
        {
            //modMain.SetGXPath(Artech.Common.Helpers.IO.PathHelper.StartupPath);
            //HPatternBuildProcess.GetLic().CheckC();

            string objtype = TabElement.ObjTypeValue.All;

            StringBuilder ret = new StringBuilder();
            HPatternSettings settings = Instance.Settings;
            sett = settings;

            bool geraBC = false;
            string codeTab = "";
            Transaction transaction = null;
            TransactionElement trnInstance = null;
            bool disabledTabs = false;
            if (GridObject is TabElement) {

                TabElement tabe = (TabElement)GridObject;
                objtype = tabe.ObjType;
                codeTab = tabe.Code;
                transaction = tabe.Transaction.Transaction;
                trnInstance = tabe.Transaction;

                geraBC = Instance.Transaction.WebBC;
                /*
                geraBC = settings.Template.DataEntryWebPanelBC;
                if (Instance.Transaction.DataEntryWebPanelBC.ToLower() == "true")
                    geraBC = true;
                if (Instance.Transaction.DataEntryWebPanelBC.ToLower() == "false")
                    geraBC = false;
                */

                if (geraBC) disabledTabs = tabe.Parent.DisabledTabs;
            }

            if (GridObject is SelectionElement) {
                transaction = Instance.Transaction.Transaction;
            }

            string ident = "";

            if (transaction != null)
            {
                if (GridObject is SelectionElement)
                {
                    ident = (GridObject as SelectionElement).Identifier;
                }
            }

            //Filter filter = null;
            string texto = "";

            string stitle = "";
            string stitleimage = "";
            string sdescription = "";
            ArrayList filters = new ArrayList();
            string sfilterRows = "";
            string sfilterButtons = "";
            string serrorviewer = WebForm.ErrorViewer("ErrorV1","ErrorViewer");
            string sgridPaging = "";
            string sgridPagingFirst = "";
            string sgridPagingPrevious = "";
            string sgridPagingNext = "";
            string sgridPagingLast = "";
            string sgridExport = "";
            string scurrentpage = "";
            string smaxpage = "";
            string sMaxRecords = "";
            string sRecordPage = "";
            string sCheckAll = "";
            string sSelectedRecords = "";
            string sgridButtons = "";
            string sgrid = "";
            string sfooterButtons = "";
            string sfooter = "";
            string sfiltercollapseimage = "";
            string stabs = "";
            string stransaction = "";

            if (objtype == TabElement.ObjTypeValue.Trn)
            {
                ret.AppendLine(String.Format("<Part type=\"{0}\">", PartType.WebForm));
                    ret.AppendLine("<Source><![CDATA[");
                            stransaction = Heurys.Patterns.HPattern.Helpers.Template.TrnWebForm(transaction, settings, Instance, true, "", true, trnInstance);
                            ret.AppendLine(stransaction);
                    ret.AppendLine("]]></Source>");
                ret.AppendLine("</Part>");
                return ret.ToString();
            }

            HTemplate gridWebForm = null; GetTemplate(settings, 2);
            if (GridObject is PromptElement)
            {
                gridWebForm = GetTemplate(settings,ObjTemplate.PromptTemplate);
            }
            if (gridWebForm == null)
                gridWebForm = GetTemplate(settings, 2);

                bool geraDF = false;
                int ch = 0;
                try
                {
                    ch = settings.DynamicFilters.MaxChoices;
                    if (GridObject.Filter != null)
                    {
                        if (GridObject.Filter.Dynamicfilters != null)
                        {
                            geraDF = (GridObject.Filter.Dynamicfilters.Count > 0 && ch > 0) ? true : false;
                        }
                    }
                }
                catch (Exception e) {
                    System.Diagnostics.Debug.WriteLine(e.Message + e.StackTrace);
                }

                bool collapse = GridObject.GetFilterCollapse; //false;

                bool loadOnStart = GridObject.GetLoadOnStart; // true;
                bool requiredFilter = GridObject.GetRequiredFilter; // false;
                string requiredFilterMessage = settings.Grid.RequiredFilterMessage;

                if (GridObject is PromptElement)
                {
                    PromptElement pe = (PromptElement)GridObject;

                    try {
                        if (pe.RequiredFilterMessage.ToLower() != "<default>")
                            requiredFilterMessage = pe.RequiredFilterMessage;

                    } catch(System.Exception e) {
                        System.Diagnostics.Debug.WriteLine(e.Message + e.StackTrace);
                    }

                }
                if (GridObject is SelectionElement)
                {
                    SelectionElement pe = (SelectionElement)GridObject;

                    try {
                        if (pe.RequiredFilterMessage.ToLower() != "<default>")
                            requiredFilterMessage = pe.RequiredFilterMessage;

                    } catch(System.Exception e) {
                        System.Diagnostics.Debug.WriteLine(e.Message + e.StackTrace);
                    }

                }

                if (geraBC && objtype != TabElement.ObjTypeValue.Trn)
                {
                    Dictionary<string, Object> tabprops = new Dictionary<string, Object>();
                    tabprops.Add("MenuData","&amp;MenuData");
                    tabprops.Add("SelectedItem","&amp;MenuDataItem");
                    stabs = WebFormHelper.BeginControl("DolphinStyleMenu","Tabs",tabprops)+WebFormHelper.EndControl("DolphinStyleMenu");
                }

                if (geraBC && objtype == TabElement.ObjTypeValue.All)
                {
                    stransaction = WebForm.BeginTable("tabelaItem", "Table")+"<tr><td>";
                    stransaction +=Heurys.Patterns.HPattern.Helpers.Template.TrnWebForm(transaction,settings,Instance,true,"",true,trnInstance);
                    stransaction += "</td></tr>"+WebForm.EndTable();
                }

                if (collapse && !((GridObject.Filter != null && (GridObject.Filter.FilterAttributes.Count > 0 || geraDF)) || GridObject.Orders.NeedsChoice)) {
                    collapse = false;
                }

                bool actionsModes = true;
                //if (!(GridObject is PromptElement)) {
                //    actionsModes = true;
                //}

                // Dummy vars
                bool needCurrentPage = false;

                if (!settings.Grid.PagingButtons(GridObject))
                {
                    needCurrentPage = true;
                }

                if (GridObject.Description != String.Empty)
                {
                    sdescription = GridObject.Description;

                    if (settings.Template.TitleImage != null) {
                        stitleimage = WebForm.Image("ImgTitleS",settings.Theme.Image,settings.Template.TitleImage.Name);
                        stitle = WebForm.TextBlock("TitleTextS", settings.Template.TitleTextClass, GridObject.Description);
                    } else {
                        stitle = WebForm.TextBlock("TitleTextS", settings.Template.TitleTextClass, GridObject.Description) ;
                    }

                }

                if ((GridObject.Filter != null && (GridObject.Filter.FilterAttributes.Count > 0 || geraDF)) || GridObject.Orders.NeedsChoice)
                {

                    if (GridObject.Orders.Count > 1)
                    {

                        texto = String.Format(settings.DefaultFilters.DefaultTemplateFilter,
                            WebForm.TextBlock("OrderedText", settings.Theme.PlainText, settings.Labels.OrderedBy),
                            WebForm.Variable(OrdersElement.OrderVariable));
                        filters.Add(new Filter(texto));

                    }

                try {
                    if (geraDF) {
                        Dictionary<string, object> properties = new Dictionary<string, object>();
                        properties[Properties.ATT.ControlType] = Properties.ATT.ControlType_Values.ComboBox;
                        string valores = "GX_EmptyItemText:";
                        foreach (AttributeElement ta in GridObject.Filter.Dynamicfilters) {
                            if (ta.Attribute.Type == eDBType.CHARACTER || ta.Attribute.Type == eDBType.VARCHAR || ta.Attribute.Type == eDBType.NUMERIC || ta.Attribute.Type == eDBType.DATE) {
                                valores += ","+ta.Description+":"+ta.AttributeName;
                            }
                        }
                        properties[Properties.ATT.Values] = valores;

                        Dictionary<string, object> properties2 = new Dictionary<string, object>();
                        properties2[Properties.ATT.ControlType] = Properties.ATT.ControlType_Values.ComboBox;
                        string valores2 = "GX_EmptyItemText:";
                        foreach (SettingsFilterElement sfe in settings.DynamicFilters.Filters) {
                            valores2 += ","+sfe.Description+":"+sfe.Name;
                        }

                        properties2[Properties.ATT.Values] = valores2;

                        string imagem = null;
                        if (settings.DynamicFilters.RemoveFilterImage != null) {
                            imagem = settings.DynamicFilters.RemoveFilterImage.Name;
                        }
                        if (imagem == null)
                        {
                            imagem = GetImageDeleteFilter(settings.Model);
                        }

                        for (int i = 1;i<=ch;i++) {

                            texto = String.Format(settings.DynamicFilters.TemplateFilter,
                                WebForm.Variable("Campo" + i.ToString().Trim(), "Attribute", null, properties),
                                WebForm.Variable("CondD" + i.ToString().Trim(), "Attribute", null, properties2),
                                WebForm.Variable("Carac" + i.ToString().Trim()) +
                                WebForm.Variable("Numer" + i.ToString().Trim()) +
                                WebForm.Variable("DataD" + i.ToString().Trim()),
                                WebForm.Image("excluiD" + i.ToString().Trim(), settings.Theme.Image, imagem, null, settings.DynamicFilters.RemoveFilterImageTooltip),
                                "ContainerCampo" + i.ToString().Trim());
                            filters.Add(new Filter(texto));

                        }
                    }

                } catch(System.Exception e) {
                    System.Windows.Forms.MessageBox.Show("Erro web: " + e.Message + Environment.NewLine + e.StackTrace);
                }

                    if (GridObject.Filter != null)
                    {
                        foreach (FilterAttributeElement filterVar in GridObject.Filter.Attributes.FilterAttributes)
                        {
                            // ControlInfo fvControlInfo = new ControlInfo(filterVar);

                            string ftb1 = WebForm.TextBlock("FilterText" + filterVar.Name, settings.Theme.PlainText, filterVar.Description);
                            string fvar1 = "";
                            if (filterVar.AllValue)
                            {
                                Dictionary<string, object> props = new Dictionary<string, object>();
                                GetControlInfo(filterVar, props, true);
                                fvar1= WebForm.Variable(filterVar.Name, null, null, props);
                            }
                            else
                            {
                                Dictionary<string, object> props = new Dictionary<string, object>();
                                GetControlSize(filterVar, props);
                                fvar1= WebForm.Variable(filterVar.Name, null, null, props);
                            }

                            string flink = "";
                            if (filterVar.Link != null)
                            {
                                StringBuilder textob = new StringBuilder();
                                LinkImage(textob, filterVar.Link, filterVar.Name, settings);
                                flink = textob.ToString();
                            }

                            if (filterVar.FilterType == FilterAttributeElement.FilterTypeValue.Interval)
                            {

                                var ftb2 = WebForm.TextBlock("FilterText" + filterVar.Name + "2", settings.Theme.PlainText, settings.Grid.FilterIntervalText);
                                string fvar2 = "";
                                if (filterVar.AllValue)
                                {
                                    Dictionary<string, object> props = new Dictionary<string, object>();
                                    GetControlInfo(filterVar, props, true);
                                    fvar2 = WebForm.Variable(filterVar.Name + "2", null, null, props);
                                }
                                else
                                {
                                    Dictionary<string, object> props = new Dictionary<string, object>();
                                    GetControlSize(filterVar, props);
                                    fvar2 = WebForm.Variable(filterVar.Name + "2", null, null, props);
                                }

                                texto = String.Format(settings.DefaultFilters.IntervalTemplateFilter,
                                    ftb1,
                                    fvar1,
                                    ftb2,
                                    fvar2 + flink);
                            }
                            else
                            {
                                texto = String.Format(settings.DefaultFilters.DefaultTemplateFilter,
                                    ftb1,
                                    fvar1 + flink);
                            }

                            filters.Add(new Filter(texto));

                        }

                        // Agora vamos fazer os filterRows

                        if (GridObject.Filter.Attributes != null )
                        {
                            StringBuilder rows = new StringBuilder();

                            TemplateInternal.ZeraContaGroup();

                            foreach (FRowElement row in GridObject.Filter.Attributes.Rows)
                            {
                                TemplateInternal.AddFilterRow(row, rows,settings);
                            }

                            sfilterRows = rows.ToString();
                        }

                    }

                    if (settings.Grid.SearchButton || settings.Grid.ClearButton) {
                        if (settings.Grid.SearchButton) {
                            string evento = "'Search'";
                            if (GridObject is PromptElement && settings.Template.PromptSearchEvent == SettingsTemplateElement.PromptSearchEventValue.Enter) evento = "Enter";
                            sfilterButtons += WebForm.Button("SearchButton", (String.IsNullOrEmpty(settings.Theme.SearchButton) ? settings.Theme.Button : settings.Theme.SearchButton), settings.Grid.SearchCaption, evento);
                        }
                        if (settings.Grid.ClearButton) {
                            sfilterButtons += WebForm.Button("ClearButton", (String.IsNullOrEmpty(settings.Theme.ClearButton) ? settings.Theme.Button : settings.Theme.ClearButton), settings.Grid.ClearCaption, "'ClearButton'");
                        }
                    }
                }

            bool insexp = true;
            if (actionsModes) {
                insexp = GridObject.Actions.Insert != null || GridObject.Actions.Export != null;
            }

                if (needCurrentPage || insexp)
                {
                    if (!settings.Grid.PagingButtons(GridObject))
                    {
                        sgridPagingFirst = settings.Grid.ImageFirst == null ? "" : WebForm.Image("bFirst",settings.Theme.Image,settings.Grid.ImageFirst.Name,"",settings.Grid.TooltipFirst);
                        sgridPagingPrevious = settings.Grid.ImagePrevious == null ? "" : WebForm.Image("bPrevious",settings.Theme.Image,settings.Grid.ImagePrevious.Name,"",settings.Grid.TooltipPrevious);
                        sgridPagingNext = settings.Grid.ImageNext == null ? "" : WebForm.Image("bNext",settings.Theme.Image,settings.Grid.ImageNext.Name,"",settings.Grid.TooltipNext);
                        sgridPagingLast = settings.Grid.ImageLast == null ? "" : WebForm.Image("bLast",settings.Theme.Image,settings.Grid.ImageLast.Name,"",settings.Grid.TooltipLast);
                        sgridPaging += sgridPagingFirst+sgridPagingPrevious+sgridPagingNext+sgridPagingLast;
                     }

                    if (needCurrentPage)
                    {
                        Dictionary<string, object> propertiesv = new Dictionary<string, object>();
                        //sgridPaging += WebForm.Variable("CurrentPage");
                        if (GridObject.CurrentCombo)
                        {
                            propertiesv[Properties.ATT.ControlType] = Properties.ATT.ControlType_Values.ComboBox;
                        }
                        else
                        {
                            propertiesv[Properties.HTMLATT.ReadOnly] = true;
                        }
                        scurrentpage = WebForm.Variable("CurrentPage",settings.Grid.PagingVariableClass,null,propertiesv);
                        sgridPaging += scurrentpage;

                        if (settings.Grid.GetMaxPage(GridObject))
                        {

                            Dictionary<string, object> propertiesm = new Dictionary<string, object>();
                            propertiesm[Properties.HTMLATT.ReadOnly] = true;
                            //sgridPaging += WebForm.Variable("CurrentPage");
                            smaxpage = WebForm.Variable("MaxPage",settings.Grid.PagingVariableClass,null,propertiesm);

                        }

                        if (settings.Grid.MaxRecords)
                        {
                            Dictionary<string, object> propertiesm = new Dictionary<string, object>();
                            propertiesm[Properties.HTMLATT.ReadOnly] = true;
                            sMaxRecords = WebForm.Variable("MaxRecords", settings.Grid.PagingVariableClass, null, propertiesm);
                        }

                        if (settings.Grid.PageRecordsCombo)
                        {
                            sRecordPage = WebForm.Variable("RecordPage", settings.Grid.PagingVariableClass);
                        }

                    }

                    if (actionsModes) {
                        if (GridObject.Actions.Export != null)
                        {

                            sgridExport = GridObject.Actions.Export.ToHtml();
                            sgridPaging += sgridExport;
                        }

                        foreach (ActionElement action in GridObject.Actions.StandaloneCustomActionsGrid)
                        {
                            if (settings.Template.ButtonHelpApplySelection || action.Name != "Help" || !(GridObject is SelectionElement))
                            {
                                sgridButtons += action.ToHtml();
                            }
                        }

                        if (GridObject.Actions.Insert != null)
                        {
                             sgridButtons += GridObject.Actions.Insert.ToHtml();
                        }
                    }

                }
             string condls = null;
             if (!loadOnStart) {
                condls = "&loadStart = 2;";
             }
             Properties.HTMLSFL.BackColorStyle_Enum bcs = Properties.HTMLSFL.BackColorStyle_Enum.Report;
             if (settings.Grid.BackColorStyle == "None")
                bcs = Properties.HTMLSFL.BackColorStyle_Enum.None;
             if (settings.Grid.BackColorStyle == "Uniform")
                bcs = Properties.HTMLSFL.BackColorStyle_Enum.Uniform;
             if (settings.Grid.BackColorStyle == "Header")
                bcs = Properties.HTMLSFL.BackColorStyle_Enum.Header;

            Dictionary<string, object> propertiesg = new Dictionary<string, object>();
            propertiesg[Properties.HTMLSFL.Rules] = Properties.HTMLSFL.Rules_Values.All;

            if (settings.Grid.Rules == "None")
                propertiesg[Properties.HTMLSFL.Rules] = Properties.HTMLSFL.Rules_Values.None;
            if (settings.Grid.Rules == "Columns")
                propertiesg[Properties.HTMLSFL.Rules] = Properties.HTMLSFL.Rules_Values.Columns;
            if (settings.Grid.Rules == "Rows")
                propertiesg[Properties.HTMLSFL.Rules] = Properties.HTMLSFL.Rules_Values.Rows;

            if (!GridObject.GetAutoResize)
            {
                propertiesg[Properties.HTMLSFL.AutoResize] = false;
                propertiesg[Properties.HTMLSFL.Width] = getSize(GridObject.GetWidth);
                propertiesg[Properties.HTMLSFL.Height] = getSize(GridObject.GetHeight);
            }

            if (GridObject.GetAllowSelection)
            {
                propertiesg[Properties.HTMLSFL.AllowSelection] = true;
            }

            // Grid Custom Render
            if (!String.IsNullOrEmpty(GridObject.GetCustomRender))
            {
                propertiesg[Artech.Genexus.Common.Properties.HTMLSFL.CustomRender] = GridObject.GetCustomRender;
                foreach (GridPropertieElement prop in TemplateGrid.MergeGridProperties(GridObject.GridProperties, settings))
                {
                    TemplateGrid.DefProperty(propertiesg, GridObject.GetCustomRender, prop);

                }
            }

            if (GridObject.GridType == SettingsGridElement.GridTypeValue.Standard) {

                sgrid += WebForm.BeginGrid(GridName, settings.Theme.Grid, condls, GridObject.Orders.Condition, null, bcs, settings.Grid.CellSpacing, settings.Grid.CellPadding, propertiesg);

                // grid Actions
                if (settings.Grid.GridStandardActionOrientation == SettingsGridElement.GridStandardActionOrientationValue.Left)
                {
                    sgrid += GridActions(GridObject, actionsModes, geraBC, settings);
                }

                // Then, grid attributes and variables.
                bool primeiro = true;
                foreach (IAttributesItem gridItem in GridObject.Attributes)
                {
                    if (geraBC)
                    {
                        sgrid += GridColumnBC(gridItem);
                    }
                    else
                    {
                        if (GridObject is PromptElement) {
                            if (settings.Template.ApplyReturnOnClickAll)
                            {
                                sgrid += GridColumnPrompt(gridItem);
                            }
                            else
                            {
                                sgrid += GridColumnPrompt(gridItem, primeiro);
                                primeiro = false;
                            }
                        } else {
                            sgrid += GridColumn(gridItem);
                        }
                    }
                }

                if (settings.Grid.GridStandardActionOrientation == SettingsGridElement.GridStandardActionOrientationValue.Right)
                {
                    sgrid += GridActions(GridObject, actionsModes, geraBC, settings);
                }

                sgrid += WebForm.EndGrid();
            }
            else
            {
                string dotnet = "";

                try
                {
                    GxModel model = settings.Model.KB.DesignModel.Environment.TargetModel.GetAs<GxModel>();
                    if (model.Environment.Generator == 15) // Artech.Genexus.Common.Entities.GeneratorType.CSharpWeb
                    {
                        dotnet = ".aspx";
                    }
                }
                catch (Exception e)
                {
                    LogLicense.LogEmpty(e.Message);
                }

                Dictionary<string, Object> gridprops = new Dictionary<string, Object>();
                gridprops.Add("AnimateCollapse",settings.Grid.AnimateCollapse);
                gridprops.Add("PageSize",settings.Grid.PageSize);
                gridprops.Add("AutoWidth",settings.Grid.AutoWidth);
                gridprops.Add("AutoHeight", false); // Contorno para problema com Scrool no Chrome
                gridprops.Add("ForceFit",settings.Grid.ForceFit);
                gridprops.Add("Width",settings.Grid.Width);
                gridprops.Add("Height",settings.Grid.Height);
                gridprops.Add("RemoteSort",settings.Grid.RemoteSort);
                gridprops.Add("FiltersText",settings.Grid.FiltersText);
                gridprops.Add("FirstText",settings.Grid.FirstText);
                gridprops.Add("PreviousText",settings.Grid.PreviousText);
                gridprops.Add("NextText",settings.Grid.NextText);
                gridprops.Add("LastText",settings.Grid.LastText);
                gridprops.Add("RefreshText",settings.Grid.RefreshText);
                gridprops.Add("BeforePageText",settings.Grid.BeforePageText);
                gridprops.Add("AfterPageText",settings.Grid.AfterPageText);
                gridprops.Add("DisplayMsg",settings.Grid.DisplayMsg);
                gridprops.Add("EmptyMsg",settings.Grid.EmptyMsg);
                gridprops.Add("LoadingMsg",settings.Grid.LoadingMsg);
                gridprops.Add("DataStoreURL",String.Format("aprocgrid{0}{1}",transaction.Name.ToLower(),dotnet));
                gridprops.Add("ToolbarData","&amp;gxuiToolbar");
                gridprops.Add("Identifier",ident);
                gridprops.Add("ColumnModel","&amp;gxuiGridColumnModel");
                if (settings.Grid.TitleVisible)
                {
                    gridprops.Add("Title", GridObject.Description);
                }
                gridprops.Add("SelectedRowData","&amp;SelectedRow");
                gridprops.Add("Record","SDT"+transaction.Name+"Grid");
                gridprops.Add("Data","&amp;SDT"+transaction.Name+"Grid");
                gridprops.Add("MinColumnWidth", settings.Grid.MinColumnWidth);
                sgrid += WebFormHelper.BeginControl("gxui.Grid","gxuiSDTGrid",gridprops)+WebFormHelper.EndControl("gxui.Grid");
            }

            bool insexp2 = true;
            if (actionsModes) {
                insexp2 = GridObject.Actions.Insert != null || GridObject.Actions.Export != null;
            }

            if (geraBC)
            {
                sfooterButtons += WebForm.Button("Savar",settings.Theme.BtnEnter , "GX_BtnEnter", "'Salvar'");
                sfooterButtons += WebForm.Button("btncancel", settings.Theme.BtnCancel, "GX_BtnCancel", "'Fechar'");
            }

            if (actionsModes) {
                if (GridObject.Actions.Count > 0)
                {

                    foreach (ActionElement action in GridObject.Actions.StandaloneCustomActions)
                    {
                        if (settings.Template.ButtonHelpApplySelection || action.Name != "Help" || !(GridObject is SelectionElement))
                        {
                            sfooterButtons += action.ToHtml();
                        }
                    }

                }
            }

                if (!(GridObject is TabElement))
                {
                    foreach (ParameterElement parameter in GridObject.Parameters)
                    {
                        if (!Variables.IsVariableName(parameter.Name) && GridObject.Attributes.FindAttribute(parameter.Name) == null && parameter.Domain == null)
                        {
                            // Always use edits (they are hidden).
                            sfooter += HiddenAttribute(parameter.Name);
                        }
                    }
                }

                if (GridObject is SelectionElement && settings.Template.GenerateCallBackLink)
                {
                    sfooter += WebForm.Variable(HPatternInstance.PARMCALLBACK);
                }

            try {
                if (geraDF) {
                    Dictionary<string, object> prop = new Dictionary<string, object>();
                    prop[Properties.HTMLATT.Format] = Properties.HTMLATT.Format_Values.RawHtml;
                    sfooter += WebForm.TextBlock("js","","js",prop);
                    sfooter += WebFormHelper.BeginControl("JSHandler","JSHandler1",null)+WebFormHelper.EndControl("JSHandler");
                }
            } catch(System.Exception e) {
                System.Windows.Forms.MessageBox.Show("Erro web2: " + e.Message + Environment.NewLine + e.StackTrace);
            }

            if (collapse) {
                sfooter += WebForm.Variable("collapse");
            }

            if (!loadOnStart)
            {
                sfooter += WebForm.Variable("loadStart");
            }

            if (geraBC)
            {
                sfooter += WebForm.Variable("editando");
                sfooter += WebForm.Variable("ModeI");
            }

            if (GridObject.Actions.isMultiRowActions && settings.Grid.CheckAll)
            {
                sCheckAll = WebForm.Variable("CheckAll");
            }

            if (GridObject.Actions.isMultiRowActions && settings.Grid.SelectedRecords)
            {
                Dictionary<string, object> props = new Dictionary<string, object>();
                props[Properties.HTMLATT.ReadOnly] = true;
                sSelectedRecords = WebForm.Variable("SelectedRecords",null,null,props);
                if (GridObject.GetCustomRender != null && GridObject.GetCustomRender.ToLower().IndexOf("gxui") >= 0) {
                    sfooter += WebFormHelper.BeginControl("HTools", "HTools1", null) + WebFormHelper.EndControl("HTools");
                }
            }

            sfooter += MenuContext.get(GridObject.Actions).WebForm();

            if (sCheckAll != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.CheckAll, sCheckAll);
            if (sSelectedRecords != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.SelectedRecords, sSelectedRecords);

            //gridWebForm.SetAttribute("header", sheader);
            if (stitle != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Title,stitle);
            if (stitleimage != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.TitleImage,stitleimage);
            if (sdescription != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Description, sdescription);

            StringBuilder mfilters = new StringBuilder(WebForm.BeginTable("TableHFilters",null));
            foreach (Filter filter in filters)
            {
                mfilters.Append( filter.FilterRow);
            }
            if (sfilterRows != String.Empty)
                mfilters.Append(sfilterRows);
            mfilters.Append(WebForm.EndTable());
            gridWebForm.SetAttribute(SelTemplate.Filters, mfilters.ToString());

            if (sfilterButtons != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.FilterButtons, sfilterButtons);

            //if (serrorviewer != String.Empty)
            //    gridWebForm.SetAttribute("errorviewer", serrorviewer);

            if (sgridPaging != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridPaging, sgridPaging);

            if (sgridPagingFirst != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridPagingFirst, sgridPagingFirst);
            if (sgridPagingPrevious != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridPagingPrevious, sgridPagingPrevious);
            if (sgridPagingNext != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridPagingNext, sgridPagingNext);
            if (sgridPagingLast != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridPagingLast, sgridPagingLast);

            if (sgridExport != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridExport, sgridExport);

            if (scurrentpage != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Currentpage, scurrentpage);
            if (smaxpage != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.MaxPage, smaxpage);

            if (sMaxRecords != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.MaxRecords, sMaxRecords);

            if (sRecordPage != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.PageRecords, sRecordPage);

            if (sgridButtons != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.GridButtons, sgridButtons);
            if (sgrid != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Grid, sgrid);
            if (sfooterButtons != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.FooterButtons, sfooterButtons);
            if (sfooter != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Footer, sfooter);

            if (sfiltercollapseimage != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.FilterCollapseImage, sfiltercollapseimage);

            if (stabs != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Tabs, stabs);

            if (stransaction != String.Empty)
                gridWebForm.SetAttribute(SelTemplate.Transaction, stransaction);

            //gridWebForm.SetAttribute("type"+stype, stype);

            string tsaida = "";
            try {
                tsaida = gridWebForm.ToString();
            } catch(System.Exception e) {
                tsaida = "";
                System.Windows.Forms.MessageBox.Show("Error processing the Selection Template:" + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace);

            }

            if (settings.Template.SelectionTemplateDebug != String.Empty) {

                System.IO.StreamWriter file2 = new System.IO.StreamWriter(settings.Template.SelectionTemplateDebug);
                file2.WriteLine(tsaida);
                file2.Close();

            }

            ret.AppendLine(String.Format("<Part type=\"{0}\">",PartType.WebForm));
                ret.AppendLine("<Source><![CDATA[");
                    //ret.AppendLine("<BODY>");
                        ret.AppendLine(tsaida);
                    //ret.AppendLine("</BODY>]]>");
                ret.AppendLine("]]></Source>");
            ret.AppendLine("</Part>");
            return ret.ToString();
        }
 private static void UpdateAttributes(HPatternInstance instance, HPatternSettings settings, Transaction transaction)
 {
     string picturedefault = settings.Template.PictureCharacterDefault;
     foreach (RowElement row in instance.Transaction.GetRows(""))
     {
         foreach (ColumnElement col in row.Columns)
         {
             foreach (AttributeElement att in col.Attributes)
             {
                 if (att.Attribute != null)
                 {
                     string picture = "";
                     if (att.Picture.ToLower() == "default")
                     {
                         picture = picturedefault;
                         if (picture != String.Empty && (att.Attribute.Type == eDBType.CHARACTER || att.Attribute.Type  == eDBType.VARCHAR))
                         {
                             att.Attribute.SetPropertyValue(Properties.ATT.Picture, picture);
                             att.Attribute.Save();
                         }
                     }
                     else
                     {
                         picture = att.Picture;
                         if (picture != String.Empty)
                         {
                             att.Attribute.SetPropertyValue(Properties.ATT.Picture, picture);
                             att.Attribute.Save();
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 24
0
        internal static HTemplate GetTemplate(HPatternSettings settings, ObjTemplate tipo)
        {
            templateModel = settings.Model;
            switch (tipo)
            {
                case ObjTemplate.TransactionTemplate:
                    return CacheHTemplate.Cache.getTemplate(settings.Template.TransactionTemplate, tipo, templateModel);
                case ObjTemplate.SelectionTemplate:
                    return CacheHTemplate.Cache.getTemplate(settings.Template.SelectionTemplate, tipo, templateModel);
                case ObjTemplate.DocTemplate:
                    return CacheHTemplate.Cache.getTemplate(settings.Documentation.Template, tipo, templateModel);
                case ObjTemplate.ViewTemplate:
                    return CacheHTemplate.Cache.getTemplate(settings.Template.ViewTemplate, tipo, templateModel);
                case ObjTemplate.PromptTemplate:
                    return CacheHTemplate.Cache.getTemplate(settings.Template.PromptTemplate, tipo, templateModel);
            }

            return null;
        }
 private static void UpdateEventPrompts(HPatternInstance instance,HPatternSettings settings, BasicParser parser)
 {
     string tmp = Helpers.Template.PromptEvents(instance.Transaction.Form, settings);
     if (!String.IsNullOrEmpty(tmp))
     {
         StringBuilder eventCode = new StringBuilder();
         //eventCode.AppendLine(Indentation.Indent(k_GeneratedMarkerStart, 1));
         eventCode.Append(tmp);
         eventCode.Append(Environment.NewLine);
         //eventCode.AppendLine(Indentation.Indent(k_GeneratedMarkerEnd, 1));
         parser.InsertBefore(0, eventCode.ToString());
     }
 }
Esempio n. 26
0
        private static void AddGridFreeStyle(StringBuilder atts, GridFreeStyleElement grid, HPatternSettings settings)
        {
            if (!grid.Instance.IsWebPanel)
            {
                atts.AppendLine("<br/>");
                atts.AppendLine(WebForm.BeginTable("Table" + grid.Name, "Table95"));
                atts.AppendLine("<tr><td class='SubTitle'>");
                atts.AppendLine(WebForm.TextBlock("Title" + grid.Name, "", grid.Description));
                atts.AppendLine("</td></tr>");
                atts.AppendLine(WebForm.EndTable());
                atts.AppendLine("<hr class='HRDefault' />");
            }
            atts.AppendLine("<gxFreeStyle border='1' freestyle='1' gxProp='ControlName=" + grid.Name + ";class=FreeStyleGrid'>");

            //atts.AppendLine(Heurys.Patterns.HPattern.Helpers.Template.InnerLevel(subLevel, Counters));
            atts.AppendLine("<tr>");
                atts.AppendLine("<td>");
                    atts.AppendLine(WebForm.BeginTable("Table2" + grid.Name, "Table"));

                    foreach (IHPatternInstanceElement item in grid.Items)
                    {
                        if (item is GridFreeStyleElement)
                        {
                            atts.AppendLine("<tr>");
                                atts.AppendLine("<td colspan=\"2\">");
                                    GridFreeStyleElement grid2 = item as GridFreeStyleElement;
                                    AddGridFreeStyle(atts, grid2, settings);
                                atts.AppendLine("</td>");
                            atts.AppendLine("</tr>");
                        }
                        if (item is GridStandardElement)
                        {
                            atts.AppendLine("<tr>");
                                atts.AppendLine("<td colspan=\"2\">");
                                    GridStandardElement grid2 = item as GridStandardElement;
                                    AddGridStandard(atts, grid2, settings);
                                atts.AppendLine("</td>");
                            atts.AppendLine("</tr>");
                        }
                        if (item is AttributeElement)
                        {
                            AttributeElement att = item as AttributeElement;

                            string themeClass = null;
                            if (!String.IsNullOrEmpty(att.ThemeClass))
                                themeClass = att.ThemeClass;
                            Dictionary<string, object> properties = new Dictionary<string, object>();
                            if (att.Readonly)
                            {
                                properties[Properties.HTMLATT.ReadOnly] = true;
                            }

                            atts.AppendLine("<tr>");
                                atts.AppendLine("<td class=\"td5\" valign=\"top\" nowrap=\"nowrap\">");
                                    atts.AppendLine(WebForm.TextBlock("TextBlock" + att.AttributeName, null, att.Description));
                                atts.AppendLine("</td>");
                                atts.AppendLine("<td nowrap=\"nowrap\">");
                                    atts.AppendLine(WebForm.Attribute(att.AttributeName, themeClass, null, properties));
                                atts.AppendLine("</td>");
                            atts.AppendLine("</tr>");
                        }
                    }

                    atts.AppendLine(WebForm.EndTable());
                atts.AppendLine("</td>");
            atts.AppendLine("</tr>");

            atts.AppendLine("</gxFreeStyle>");
        }
        private static void UpdateEventStart(HPatternInstance instance, HPatternSettings settings, Transaction transaction, BasicParser parser)
        {
            StringBuilder eventCodeStart = new StringBuilder(100);

            eventCodeStart.AppendLine(Messages.VersionHPattern());

            Generator.GeneratorParameters parameters = new Generator.GeneratorParameters();
            DefaultProvider.PrepareTemplateParameters(parameters);
            parameters.Properties["Settings"] = settings;
            parameters.Properties["tipo"] = 0;

            AppendTemplateOutput(eventCodeStart, "SubLoadContext", parameters);

            //if (settings.Security.Enabled)
            //{

            eventCodeStart.AppendLine("[web]");
            eventCodeStart.AppendLine("{");

            parameters.Properties["Instance"] = instance;
            parameters.Properties["IsTransaction"] = true;

            AppendTemplateOutput(eventCodeStart, "SubCheckSecurity", parameters);

            //}

            if (settings.Security.EventStart != String.Empty)
            {
                eventCodeStart.AppendLine("");
                eventCodeStart.AppendLine(settings.Security.EventStart);
            }

            eventCodeStart.AppendLine();
            eventCodeStart.Append("}");

            if (settings.Template.UseTransactionContext)
            {
                if (eventCodeStart.Length > 0)
                    eventCodeStart.AppendLine();

                eventCodeStart.AppendLine("&TrnContext.FromXml(&WebSession.Get(!\"TrnContext\"))");

                if (HasContextAttributes(transaction))
                {
                    eventCodeStart.AppendLine("If (&TrnContext.TransactionName = &Pgmname and &Mode = TrnMode.Insert)");
                    eventCodeStart.AppendLine("\tFor &TrnContextAtt in &TrnContext.Attributes");

                    bool first = true;
                    foreach (TransactionAttribute icAtt in ContextAttributes(transaction))
                    {
                        if (first)
                        {
                            eventCodeStart.AppendLine("\t\tDo Case");
                            first = false;
                        }
                        eventCodeStart.AppendFormat("\t\t\t// When inserting with instantiated {0}\r\n", icAtt.Name);
                        eventCodeStart.AppendFormat("\t\t\tCase &TrnContextAtt.AttributeName = !\"{0}\"\r\n", icAtt.Name);
                        eventCodeStart.AppendFormat("\t\t\t\t&Insert_{0}.FromString(&TrnContextAtt.AttributeValue)\r\n", icAtt.Name);
                    }
                    if (!first)
                        eventCodeStart.AppendLine("\t\tEndcase");

                    eventCodeStart.AppendLine("\tEndfor");
                    eventCodeStart.Append("Endif");
                }
            }

            if (settings.Template.EventStart != String.Empty) {
                eventCodeStart.AppendLine("");
                eventCodeStart.AppendLine(settings.Template.EventStart);
            }

            eventCodeStart.AppendLine("");
            eventCodeStart.AppendLine("[web]");
            eventCodeStart.AppendLine("{");

                IBaseCollection<RowElement> lista = instance.Transaction.GetRows("",true,true);

                foreach (RowElement row in lista)
                {

                    foreach (ColumnElement col in row.Columns)
                    {
                        foreach (VariableElement var in col.Variables)
                        {
                            if (var.Domain != null || var.Attribute != null)
                            {
                                if (!var.Visible || !row.Visible)
                                {
                                    eventCodeStart.AppendLine("");
                                    eventCodeStart.AppendFormat("&{0}.Visible = false", var.Name);
                                }
                                if (!String.IsNullOrEmpty(var.LoadCode))
                                {
                                    eventCodeStart.AppendLine("");
                                    eventCodeStart.AppendLine(var.LoadCode);
                                }
                                if (!String.IsNullOrEmpty(var.LinksEventStart))
                                {
                                    eventCodeStart.AppendLine("");
                                    eventCodeStart.AppendLine(var.LinksEventStart);
                                }

                            }
                        }

                        foreach (AttributeElement att in col.Attributes)
                        {
                            if (att.Attribute != null)
                            {
                                if (!att.Visible || !row.Visible)
                                {
                                    eventCodeStart.AppendLine("");
                                    eventCodeStart.AppendFormat("{0}.Visible = false", att.AttributeName);

                                }
                                if (!String.IsNullOrEmpty(att.LinksEventStart))
                                {
                                    eventCodeStart.AppendLine("");
                                    eventCodeStart.AppendLine(att.LinksEventStart);
                                }
                                if (!String.IsNullOrEmpty(att.EventStart))
                                {
                                    eventCodeStart.AppendLine("");
                                    eventCodeStart.AppendLine(String.Format(att.EventStart, att.AttributeName, att.AttributeName));
                                }
                            }
                        }

                        foreach (TextElement text in col.Texts)
                        {

                            if (!text.Visible || !row.Visible)
                            {
                                eventCodeStart.AppendLine("");
                                eventCodeStart.AppendFormat("{0}.Visible = false", text.Name);
                            }
                        }
                    }
                }
            //}

            bool setFocus = instance.Transaction.GetSetFocus;
            /*
                settings.Template.TransactionSetFocus;
            if (instance.Transaction.SetFocus.ToLower() == "true")
                setFocus = true;
            if (instance.Transaction.SetFocus.ToLower() == "true")
                setFocus = false;
            */

            Artech.Genexus.Common.Objects.Attribute setFocusAtt = instance.Transaction.SetFocusAttribute;
            if (setFocusAtt == null && transaction.Structure.Root.DescriptionAttribute != null)
            {
                setFocusAtt = transaction.Structure.Root.DescriptionAttribute.Attribute;
            }

            if (setFocus && setFocusAtt != null)
            {
                eventCodeStart.AppendLine();
                eventCodeStart.AppendLine(setFocusAtt.Name + ".SetFocus()");
            }

            eventCodeStart.AppendLine("");

            // Se não vou gerar BC e tenho abas
            if (!instance.Transaction.WebBC && instance.Transaction.Form.Tabs.Count > 0)
            {
                Tab tabs = Tab.getTab(instance.Transaction.Form, transaction);
                eventCodeStart.Append(tabs.Events());
                //eventCodeStart.Append( TemplateAbas.Start(instance.Transaction.Form));
            }

            eventCodeStart.AppendLine(Helpers.Template.HMaskEventStart(instance.Transaction, "", false));

            eventCodeStart.AppendLine("}");

            if (!String.IsNullOrEmpty(instance.Transaction.EventStart))
            {
                eventCodeStart.AppendLine(Indentation.Indent(instance.Transaction.EventStart, 1));
            }

            if (eventCodeStart.Length > 0)
                UpdateEventCode(parser, new string[] { "Start" }, eventCodeStart.ToString());
        }
Esempio n. 28
0
        internal static string getCondition(Gx.Attribute att, HPatternSettings settings)
        {
            string comparison;

            if (att.Type == eDBType.CHARACTER || att.Type == eDBType.VARCHAR || att.Type == eDBType.LONGVARCHAR)
                comparison = settings.Grid.DefaultConditionCharacter;
            else if (att.Type == eDBType.Boolean)
                comparison = settings.Grid.DefaultConditionBoolean;
            else
                comparison = settings.Grid.DefaultCondition;

            return String.Format(comparison, att.Name, "&" + att.Name);
        }
        private static string UpdateRules(HPatternInstance instance, HPatternSettings settings, Transaction transaction)
        {
            StringBuilder rules = new StringBuilder();

            StringBuilder eventCodeAfterTrn = new StringBuilder();
            //if (transaction.IsBusinessComponent)
            //{
            rules.AppendLine("[web]");
            rules.AppendLine("{");
            //}

            // Add 'parm' rule
            rules.Append(instance.Transaction.GeraParm(false));

            // Add Prompts rule
            rules.Append(Helpers.Template.PromptRules(instance.Transaction.Form, settings));

            // Add 'primary key rules'
            foreach (TransactionAttribute trnAtt in transaction.Structure.Root.PrimaryKey)
            {
                rules.AppendFormat("\r\n{0} = &{0} if not &{0}.IsEmpty();", trnAtt.Name);

                bool edita = false;
                bool sai = false;

                foreach (RowElement row in Helpers.Template.GetRows(instance.Transaction, ""))
                {
                    foreach (ColumnElement col in row.Columns)
                    {
                        foreach (AttributeElement att in col.Attributes)
                        {
                            if (att.AttributeName == trnAtt.Name)
                            {
                                if (att.Readonly || att.Visible == false || row.Visible == false)
                                {
                                    edita = true;

                                }
                                sai = true;
                                break;
                            }
                        }

                        if (sai)
                            break;

                    }

                    if (sai)
                        break;
                }

                if (edita || (transaction.Structure.Root.PrimaryKey.Count == 1 && trnAtt.Attribute.GetPropertyValue<bool>(Properties.ATT.Autonumber)))
                    rules.AppendFormat("\r\nnoaccept({0});", trnAtt.Name);
                else
                    rules.AppendFormat("\r\nnoaccept({0}) if not &{0}.IsEmpty();", trnAtt.Name);
            }

            // Add 'noprompt' rule.
            rules.AppendFormat("\r\nnoprompt({0});", GetList(transaction.Structure.Root.PrimaryKey));

            // Add context rules if applicable.
            if (settings.Template.UseTransactionContext)
            {
                rules.AppendLine();
                foreach (TransactionAttribute trnAtt in ContextAttributes(transaction))
                {
                    rules.AppendFormat("\r\n{0} = &Insert_{0} if &Mode = TrnMode.Insert and not &Insert_{0}.IsEmpty();", trnAtt.Name);
                    rules.AppendFormat("\r\nnoaccept({0}) if &Mode = TrnMode.Insert and not &Insert_{0}.IsEmpty();", trnAtt.Name);
                }
            }

            if (settings.Security.RuleCode != String.Empty) {
                rules.AppendLine(settings.Security.RuleCode);
            }

            rules.AppendLine();
            rules.Append(Helpers.Template.HMaskRuleSave(instance.Transaction, "", ""));
            rules.AppendLine();

            //if (transaction.IsBusinessComponent)
            //{
            rules.AppendLine("}");
            //}

            string ruledate = settings.Template.RuleDate;
            string valueruledate = settings.Template.ValueRuleDate;
            string ruledatetime = settings.Template.RuleDateTime;
            string valueruledatetime = settings.Template.ValueRuleDateTime;
            string defaultvalue = "";
            string defaultrule = "";

                IBaseCollection<RowElement> lista = new BaseCollection<RowElement>();
                lista = instance.Transaction.GetRows("",true,true);

                foreach (RowElement row in lista)
                {

                    foreach (ColumnElement col in row.Columns)
                    {
                        foreach (AttributeElement att in col.Attributes)
                        {
                            if (att.Attribute != null)
                            {

                                // Atributo Requerido

                                bool required = att.getRequired(transaction);

                                if (required)
                                {
                                    string message = settings.Template.RequiredNotNullMessage;
                                    if (att.RequiredMessage != String.Empty && att.RequiredMessage.ToLower() != "default")
                                    {
                                        message = att.RequiredMessage;
                                    }

                                    message = String.Format(message, (att.Description.Substring(0,1) == "=" ? att.Attribute.Description : att.Description ));

                                    if (att.RequiredAfterVal)
                                    {
                                        rules.AppendLine(String.Format("Error('{0}') if {1}.IsEmpty() on AfterValidate;", message, att.AttributeName));
                                    }
                                    else
                                    {
                                        rules.AppendLine(String.Format("Error('{0}') if {1}.IsEmpty();", message, att.AttributeName));
                                    }

                                }

                                // Regra para o atributo
                                defaultvalue = att.ValueRule;
                                if (defaultvalue == "<default>" || defaultvalue == String.Empty)
                                {
                                    defaultvalue = "";
                                    switch (att.Attribute.Type)
                                    {
                                        case eDBType.DATE:
                                            defaultvalue = valueruledate;
                                            break;

                                        case eDBType.DATETIME:
                                            defaultvalue = valueruledatetime;
                                            break;

                                    }
                                }

                                defaultrule = att.Rule;
                                if (defaultrule.ToLower() == "<default>")
                                {
                                    defaultrule = "";
                                    switch (att.Attribute.Type)
                                    {
                                        case eDBType.DATE:
                                            defaultrule = ruledate;
                                            break;

                                        case eDBType.DATETIME:
                                            defaultrule = ruledatetime;
                                            break;

                                    }
                                }

                                if (defaultvalue != String.Empty && defaultrule != String.Empty)
                                {

                                    switch (defaultrule)
                                    {
                                        case AttributeElement.RuleValue.DefaultRule: // "defaultrule":
                                            rules.AppendLine(String.Format("Default({0},{1});", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterValidate: // "aftervalidate":
                                            rules.AppendLine(String.Format("{0} = {1} On AfterValidate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterInsert:
                                            rules.AppendLine(String.Format("{0} = {1} On AfterInsert;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterUpdate:
                                            rules.AppendLine(String.Format("{0} = {1} On AfterUpdate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterDelete:
                                            rules.AppendLine(String.Format("{0} = {1} On AfterDelete;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeValidate:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeValidate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeInsert:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeInsert;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeUpdate:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeUpdate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeDelete:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeDelete;", att.AttributeName, defaultvalue));
                                            break;
                                    }
                                }

                            }
                        }
                    }
                }
            //}

            string codes = TemplateInternal.RuleCodes(TemplateInternal.CodeType.Transaction, settings);
            if (!String.IsNullOrEmpty(codes))
            {
                rules.Append(codes);
            }

            return AppendRules(transaction, rules.ToString());
        }
Esempio n. 30
0
        private static HTemplate GetTemplate(HPatternSettings settings, int tipo)
        {
            switch (tipo)
            {
                case 1:
                    return GetTemplate(settings, ObjTemplate.TransactionTemplate);
                case 2:
                    return GetTemplate(settings, ObjTemplate.SelectionTemplate);
                case 3:
                    return GetTemplate(settings, ObjTemplate.DocTemplate);
                case 4:
                    return GetTemplate(settings, ObjTemplate.ViewTemplate);
                case 5:
                    return GetTemplate(settings, ObjTemplate.PromptTemplate);
            }

            return null;
        }