public static string ViewWebForm(Artech.Architecture.Common.Objects.KBObject Object, Artech.Architecture.Common.Objects.KBObjectPart Part, Heurys.Patterns.HPattern.HPatternInstance Instance, ViewElement view) { string ret = ""; HPatternSettings settings = Instance.Settings; SelectionElement selection = view.Parent.Selection; string sdescription = view.Description; string stitle = String.Empty; string sviewall = WebForm.TextBlock("ViewAll", settings.Theme.TextToLink, selection.Description); string sviewheader = String.Empty; string stabs = String.Empty; string stransaction = String.Empty; if (view.BackToSelection && selection != null) { stitle = WebForm.TextBlock("ViewTitle", "" , view.Description); } else { stitle = WebForm.TextBlock("ViewTitle", settings.Theme.Subtitle, view.Description); } if (view.FixedData != null) { StringBuilder sb = new StringBuilder(); sb.AppendLine(WebForm.BeginTable("TableView",null)); foreach (AttributeElement fixedAtt in view.FixedData.Attributes.Attributes) { sb.AppendLine("<TR><TD>"); sb.AppendLine(WebForm.TextBlock("FixText" + fixedAtt.Attribute.Name, settings.Theme.Label, fixedAtt.Description)); sb.AppendLine("</TD><TD>"); sb.AppendLine( WebForm.Attribute(fixedAtt.Attribute.Name)); sb.AppendLine("</TD></TR>"); } sb.AppendLine( WebForm.EndTable()); sviewheader = sb.ToString(); } Tab tab = Tab.getTab(view,Object); if (tab != null) { stabs = tab.WebForm(); stransaction = tab.WebFormCmp(); } HTemplate viewTemplate = Template.GetTemplate(settings, ObjTemplate.ViewTemplate); if (stitle != String.Empty) viewTemplate.SetAttribute(SelTemplate.Title, stitle); if (sdescription != String.Empty) viewTemplate.SetAttribute(SelTemplate.Description, sdescription); if (sviewall != String.Empty) viewTemplate.SetAttribute(SelTemplate.ViewAll, sviewall); if (stabs != String.Empty) viewTemplate.SetAttribute(SelTemplate.Tabs, stabs); if (sviewheader != String.Empty) viewTemplate.SetAttribute(SelTemplate.ViewHeader, sviewheader); if (!String.IsNullOrEmpty(stransaction)) viewTemplate.SetAttribute(SelTemplate.Transaction, stransaction); ret = viewTemplate.ToString(); return ret; }
internal static string TrnWebForm2(Artech.Architecture.Common.Objects.KBObject Object, Heurys.Patterns.HPattern.HPatternSettings Settings, Heurys.Patterns.HPattern.HPatternInstance Instance, Boolean geraBC, String tabBC, Boolean Component, Code.WebObject trnInstance) { //modMain.SetGXPath(Artech.Common.Helpers.IO.PathHelper.StartupPath); //HPatternBuildProcess.GetLic().CheckC(); bool _webPanel = ((trnInstance is WebPanelRootElement) ? true : false); StringBuilder ret = new StringBuilder(); if (Messages.Debug()) { CommonServices.Output.AddLine(String.Format(">>> TrnDefaultWebForm Begin {0}",DateTime.Now.ToString())); CommonServices.Output.AddLine(String.Format(">>> geraBC = {0}",geraBC)); CommonServices.Output.AddLine(String.Format(">>> tabBC = {0}",tabBC)); CommonServices.Output.AddLine(String.Format(">>> Component = {0}",Component)); string nome = (trnInstance is TransactionElement ? ((TransactionElement)trnInstance).TransactionName : ""); CommonServices.Output.AddLine(String.Format(">>> trnInstance.TransactionName = {0}", nome)); CommonServices.Output.AddLine(String.Format(">>> Instance.Transaction.TransactionName = {0}",Instance.Transaction.TransactionName)); } WebFormPart wform = null; Transaction transaction = null; if (Object is Transaction) { transaction = Object as Transaction; wform = transaction.WebForm; if (transaction == null) throw new ArgumentNullException("Object"); } if (Object is WebPanel) { wform = ((WebPanel)Object).WebForm; } HPatternSettings settings = Settings; HTemplate gridWebForm = GetTemplate(settings, 1); string stitle = ""; string stitleimage = ""; string sdescription = Object.Description; string stoolbar = ""; string serrorviewer = ""; string sattributes = ""; string sbuttonEnter = ""; string sbuttonCancel = ""; string sbuttonHelp = ""; string sbuttonDelete = ""; string sbuttonAction = ""; string sfooter = ""; string stabs = ""; //Transaction transaction bool GenerateToolbar = false; bool GenerateDelete = false; bool overwrite = trnInstance.UpdateObject == TransactionElement.UpdateObjectValue.Overwrite; if (!Component) { serrorviewer = WebForm.ErrorViewer("ctlError", null); } if (GenerateToolbar) { stoolbar = Heurys.Patterns.HPattern.Helpers.Template.Toolbar(); } if (settings.Template.TrnTitleImage != null) { stitleimage = WebForm.Image("ImgTitle",settings.Theme.Image,settings.Template.TrnTitleImage.Name); stitle = WebForm.TextBlock("TitleText", settings.Template.TrnTitleTextClass, Object.Description); } else { stitle = WebForm.TextBlock("TitleText", settings.Template.TrnTitleTextClass, Object.Description); } Tab tabs = null; if (trnInstance.Form.Tabs.Count > 0 && !Component) { tabs = Tab.getTab(trnInstance.Form, Object); } if (tabs != null) { stabs = tabs.WebForm(); sfooter = tabs.WebFormCmp(); //Dictionary<string, Object> tabprops = new Dictionary<string, Object>(); //tabprops.Add("MenuData","&MenuData"); //tabprops.Add("SelectedItem","&MenuDataItem"); //stabs = WebFormHelper.BeginControl("DolphinStyleMenu","Tabs",tabprops)+WebFormHelper.EndControl("DolphinStyleMenu"); } Dictionary<string, int> Counters = new Dictionary<string, int>(); Counters.Add("TextBlockCounter", 1); Counters.Add("TableCounter", 2); Counters.Add("GridCounter", 1); // Vamos montar os atributos que estão na tela StringBuilder atts = new StringBuilder(); //int contaAtts = 0; string sigla = ""; if (geraBC) { if (Component) { sigla = "BC"; } else { sigla = "SDT"; } } if (tabs != null) { atts.AppendLine(tabs.WebFormStart()); } atts.AppendLine(WebForm.BeginTable("Table1", "Table")); contaGroup = 0; foreach (IHPatternInstanceElement objele in trnInstance.Form.Items) { if (objele is RowElement) { RowElement row = (RowElement)objele; ApplyRow(atts, row, Object, geraBC, sigla, settings, overwrite); } if (objele is TabFormElement) { TabFormElement tab = (TabFormElement)objele; if (tabBC == String.Empty || tab.Name == tabBC) { TabItem tabit = Tab.getTabItem(tabs, tab); atts.AppendLine(tabit.WebFormStart()); //atts.AppendLine("<tr><td>"+WebForm.BeginTable("Tab"+tab.Name, settings.Theme.TabTable)); foreach (RowElement row in tab.Rows) { ApplyRow(atts, row, Object, geraBC, sigla, settings, overwrite); } atts.AppendLine(tabit.WebFormEnd()); //atts.AppendLine(WebForm.EndTable()+"</td></tr>"); } } if (objele is UserTableElement) { AddUserTable((UserTableElement)objele, atts, wform, overwrite); } } bool InstanceGrid = false; if (trnInstance is TransactionElement) { InstanceGrid = ((TransactionElement)trnInstance).InstanceGrid; } if (!geraBC && !InstanceGrid && transaction != null) { foreach (Artech.Common.Helpers.Structure.IStructureItem structureItem in transaction.Structure.Root.Items) { if (structureItem is TransactionLevel) { atts.AppendLine("<tr><td colspan='2'>"); TransactionLevel subLevel = structureItem as TransactionLevel; bool hasMoreLevels = (subLevel.Levels.Count > 0); if (hasMoreLevels) { atts.AppendLine("<br/>"); atts.AppendLine(WebForm.BeginTable("Table" + (Counters["TableCounter"]++).ToString(), "Table95")); atts.AppendLine("<tr><td class='SubTitle'>"); atts.AppendLine(WebForm.TextBlock("Title" + subLevel.Name, "", subLevel.Description)); atts.AppendLine("</td></tr>"); atts.AppendLine(WebForm.EndTable()); atts.AppendLine("<hr class='HRDefault' />"); atts.AppendLine("<gxFreeStyle border='1' freestyle='1' gxProp='ControlName=Grid"+(Counters["GridCounter"]++).ToString()+";class=FreeStyleGrid'>"); atts.AppendLine(Heurys.Patterns.HPattern.Helpers.Template.InnerLevel(subLevel,Counters)); atts.AppendLine("</gxFreeStyle>"); } else { atts.AppendLine("<br/>"); atts.AppendLine(WebForm.BeginTable("Table" + (Counters["TableCounter"]++).ToString(), "Table95")); atts.AppendLine("<tr><td class='SubTitle'>"); atts.AppendLine(WebForm.TextBlock("Title" + subLevel.Name, "", subLevel.Description)); atts.AppendLine("</td></tr>"); atts.AppendLine(WebForm.EndTable()); atts.AppendLine("<hr class='HRDefault' />"); atts.AppendLine(Heurys.Patterns.HPattern.Helpers.Template.LeafLevel(subLevel,Counters)); } atts.AppendLine("</td></tr>"); } } } atts.AppendLine(WebForm.EndTable()); if (tabs != null) { atts.AppendLine(tabs.WebFormEnd()); } sattributes = atts.ToString(); // fim dos atributos em tela foreach (ActionElement act in trnInstance.Actions) { string tclass = act.ButtonClass; if (String.IsNullOrEmpty(tclass)) { tclass = settings.Theme.Button; } sbuttonAction += Button(act.Name, act.Caption, tclass, String.Format("'{0}'", act.Name), ""); } if (_webPanel == false) { sbuttonEnter = Heurys.Patterns.HPattern.Helpers.Template.Button("btn_enter", ((geraBC && Component) ? settings.Labels.SaveItem : "GX_BtnEnter"), settings.Theme.BtnEnter, ((geraBC && Component) ? "'SalvarItem'" : (geraBC ? "'Salvar'" : "Enter")), ""); if (settings.Template.GenerateCallBackLink) { sbuttonCancel = Heurys.Patterns.HPattern.Helpers.Template.Button("btn_cancel", "GX_BtnCancel", settings.Theme.BtnCancel, "'Fechar'" , ""); } else { sbuttonCancel = Heurys.Patterns.HPattern.Helpers.Template.Button("btn_cancel", ((geraBC && Component) ? settings.Labels.CloseItem : "GX_BtnCancel"), settings.Theme.BtnCancel, ((geraBC && Component) ? "'FecharItem'" : ((geraBC) ? "'Fechar'" : "Cancel")), ""); } if (GenerateDelete) { sbuttonDelete = Heurys.Patterns.HPattern.Helpers.Template.Button("btn_delete", "GX_BtnDelete", "BtnDelete", "Delete", ""); } } if (settings.Template.ButtonHelp && !Component) { sbuttonHelp = Heurys.Patterns.HPattern.Helpers.Template.Button("BtnHelp", settings.Template.ButtonHelpCaption, settings.Template.ButtonHelpClass, "Help", ""); } sfooter += MenuContext.get(trnInstance.Actions).WebForm(); 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); if (stoolbar != String.Empty) gridWebForm.SetAttribute(SelTemplate.Toolbar,stoolbar); //if (serrorviewer != String.Empty) //gridWebForm.SetAttribute(SelTemplate"errorviewer",serrorviewer); if (sattributes != String.Empty) gridWebForm.SetAttribute(SelTemplate.Attributes,sattributes); if (sbuttonEnter != String.Empty) gridWebForm.SetAttribute(SelTemplate.ButtonEnter,sbuttonEnter); if (sbuttonCancel != String.Empty) gridWebForm.SetAttribute(SelTemplate.ButtonCancel,sbuttonCancel); if (sbuttonHelp != String.Empty) gridWebForm.SetAttribute(SelTemplate.ButtonHelp,sbuttonHelp); if (sbuttonDelete != String.Empty) gridWebForm.SetAttribute(SelTemplate.ButtonDelete,sbuttonDelete); if (sfooter != String.Empty) gridWebForm.SetAttribute(SelTemplate.Footer,sfooter); if (stabs != String.Empty) gridWebForm.SetAttribute(SelTemplate.Tabs,stabs); if (sbuttonAction != String.Empty) gridWebForm.SetAttribute(SelTemplate.ButtonAction, sbuttonAction); string tsaida = ""; try { tsaida = gridWebForm.ToString(); } catch(System.Exception e) { tsaida = ""; System.Windows.Forms.MessageBox.Show("Error processing the Transaction Template:" + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace); } if (settings.Template.TransactionTemplateDebug != String.Empty) { System.IO.StreamWriter file2 = new System.IO.StreamWriter(settings.Template.TransactionTemplateDebug); file2.WriteLine(tsaida); file2.Close(); } //if (!Component) { ret.AppendLine("<body>");} ret.AppendLine(tsaida); //if (!Component) { ret.AppendLine("</body>");} if (Messages.Debug()) { CommonServices.Output.AddLine(String.Format(">>> TrnDefaultWebForm End {0}",DateTime.Now.ToString())); } return ret.ToString(); }
public static string GridWebForm(Artech.Architecture.Common.Objects.KBObject Object, Artech.Architecture.Common.Objects.KBObjectPart Part, Heurys.Patterns.HPattern.HPatternInstance Instance, Heurys.Patterns.HPattern.IGridObject GridObject) { return GridWebForm2(Object, Part, Instance, GridObject); }
public static string TrnWebForm(Artech.Architecture.Common.Objects.KBObject Object, Heurys.Patterns.HPattern.HPatternSettings Settings, Heurys.Patterns.HPattern.HPatternInstance Instance, Boolean geraBC, String tabBC, Boolean Component, Code.WebObject trnInstance) { return TrnWebForm2(Object,Settings,Instance,geraBC,tabBC,Component,trnInstance); }
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","&MenuData"); tabprops.Add("SelectedItem","&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","&gxuiToolbar"); gridprops.Add("Identifier",ident); gridprops.Add("ColumnModel","&gxuiGridColumnModel"); if (settings.Grid.TitleVisible) { gridprops.Add("Title", GridObject.Description); } gridprops.Add("SelectedRowData","&SelectedRow"); gridprops.Add("Record","SDT"+transaction.Name+"Grid"); gridprops.Add("Data","&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(); }