public static StringCollection LoadUsedClasses() { StringCollection UsedClasses = new StringCollection(); foreach (KBObject obj in UIServices.KB.CurrentModel.Objects.GetAll()) { //ShowSomeMessages("Processing " + obj.Name); if (((obj is Transaction) || (obj is WebPanel)) && (obj.GetPropertyValue <bool>(Properties.TRN.GenerateObject))) { WebFormPart webForm = obj.Parts.Get <WebFormPart>(); foreach (IWebTag tag in WebFormHelper.EnumerateWebTag(webForm)) { if (tag.Properties != null) { PropertyDescriptor prop = tag.Properties.GetPropertyDescriptorByDisplayName("Class"); if (prop != null) { var val = prop.GetValue(tag); string miclstr = val.ToString(); if (!UsedClasses.Contains(miclstr)) { KBDoctorOutput.Message("Class : " + miclstr + " in " + obj.Name + " Tag: " + tag.Type.ToString()); UsedClasses.Add(miclstr); } } } } } } return(UsedClasses); }
public static void LoadAndCheckUsedClasses(IKBService kbserv, IOutputService output, StringCollection UsedClasses, StringCollection ThemeClasses, KBDoctorXMLWriter writer) { int cant = 0; foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { if ((cant % 100) == 0) { KBDoctorOutput.Message("Procesing.." + cant.ToString() + " objects "); } cant += 1; if (((obj is Transaction) || (obj is WebPanel)) && (obj.GetPropertyValue <bool>(Properties.TRN.GenerateObject))) { WebFormPart webForm = obj.Parts.Get <WebFormPart>(); foreach (IWebTag tag in WebFormHelper.EnumerateWebTag(webForm)) { if (tag.Properties != null) { PropertyDescriptor prop = tag.Properties.GetPropertyDescriptorByDisplayName("Class"); if (prop != null) { //arreglar acan cancela con la Evo3. ThemeClassReferenceList miclasslist = new ThemeClassReferenceList(); // try // { // miclasslist = (ThemeClassReferenceList)prop.GetValue(new object()); // } // catch (Exception e) { // KBDoctorOutput.Error("LoadAndCheckUsedClasses:" + e.Message + " " + e.InnerException); // throw e; // }; foreach (ThemeClass miclass in miclasslist.GetThemeClasses(obj.Model)) { if (miclass != null) { string miclstr = miclass.Name.ToLower(); if (!UsedClasses.Contains(miclstr)) { UsedClasses.Add(miclstr); } if (!ThemeClasses.Contains(miclstr)) { bool classEstaEnElTheme = VeoSiClassEstaContenidaEnAlgunaClassDelTheme(ThemeClasses, miclstr); if (!classEstaEnElTheme) { string objName = obj.Name; KBDoctorOutput.Message(" Object : " + obj.Name + " reference class " + miclstr + " which not exist in Theme"); string objNameLink = Functions.linkObject(obj); writer.AddTableData(new string[] { objNameLink, miclstr, " does not exist in theme" }); } } } } } } } } } }
public static void LoadUsedClasses(IKBService kbserv, IOutputService output, StringCollection UsedClasses) { int cant = 0; foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { if ((cant % 100) == 0) { output.AddLine("Procesing.." + cant.ToString() + " objects "); } cant += 1; if (((obj is Transaction) || (obj is WebPanel) || obj is ThemeClass) && (obj.GetPropertyValue <bool>(Properties.TRN.GenerateObject))) { WebFormPart webForm = obj.Parts.Get <WebFormPart>(); output.AddLine(" Object : " + obj.Name); foreach (IWebTag tag in WebFormHelper.EnumerateWebTag(webForm)) { if (tag.Properties != null) { PropertyDescriptor prop = tag.Properties.GetPropertyDescriptorByDisplayName("Class"); if (prop != null) { ThemeClassReferenceList miclasslist = new ThemeClassReferenceList(); try { miclasslist = (ThemeClassReferenceList)prop.GetValue(new object()); } catch (Exception e) { Console.WriteLine(e.InnerException); }; foreach (ThemeClass miclass in miclasslist.GetThemeClasses(obj.Model)) { if (miclass != null) { string miclstr = miclass.Root.Description + '-' + miclass.Name.ToLower(); if (!UsedClasses.Contains(miclstr)) { UsedClasses.Add(miclstr); } } } } } } } } }
public static void ListDynamicCombo() { IKBService kbserv = UIServices.KB; string title = "KBDoctor - List objects with dynamic combobox in grid columns"; try { string outputFile = Functions.CreateOutputFile(kbserv, title); IOutputService output = CommonServices.Output; output.StartSection("KBDoctor", title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Object", "Description", "Control Name", "Col Visible", "Suggest" }); //All useful objects are added to a collection foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { string objName = obj.Name; if (obj is WebPanel) { //KBDoctorOutput.Message( "Procesing.." + obj.Name); WebFormPart webForm = obj.Parts.Get <WebFormPart>(); foreach (IWebTag current in WebFormHelper.EnumerateWebTag(webForm)) { if (current.Node.ParentNode.Name == "gxGrid" && current.Type == WebTagType.Column) { string controlName = current.Properties.GetPropertyValueString("ControlName"); string controltype = current.Properties.GetPropertyValueString("ControlType"); bool hidden = current.Properties.GetPropertyValue <bool>("ColVisible"); // string att = current.Properties.GetPropertyValueString("Attribute"); if (controltype == "Dynamic Combo Box") { KBDoctorOutput.Message(">>>>Procesing.." + obj.Name + "-" + current.Type); writer.AddTableData(new string[] { Functions.linkObject(obj), obj.Description, controlName, hidden.ToString(), "N/A" }); } string suggest = current.Properties.GetPropertyValueString("EditAutocomplete"); object suggest_obj = current.Properties.GetPropertyValue("EditAutocomplete"); string read_only = current.Properties.GetPropertyValueString("ColReadOnly"); if (controltype == "Edit" && suggest != "No" && read_only == "True") { current.Properties.SilentSetPropertyValue("EditAutocomplete", 0); webForm.Save(); writer.AddTableData(new string[] { Functions.linkObject(obj), obj.Description, controlName, hidden.ToString(), suggest }); } } } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection("KBDoctor", title, success); } catch { bool success = false; KBDoctor.KBDoctorOutput.EndSection(title, success); } }
public static void ObjectsWithVarNotBasedOnAtt() { IKBService kbserv = UIServices.KB; string title = "KBDoctor - Object with variables not based on attribute/domain"; string outputFile = Functions.CreateOutputFile(kbserv, title); IOutputService output = CommonServices.Output; output.StartSection(title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Type", "Name", "Variable", "Attribute", "Domain" }); //All useful objects are added to a collection foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { output.AddLine("Procesing.." + obj.Name); if ((obj is Transaction) || (obj is WebPanel)) { WebFormPart webForm = obj.Parts.Get <WebFormPart>(); foreach (IWebTag current in WebFormHelper.EnumerateWebTag(webForm)) { output.AddLine("Procesing.." + obj.Name + "-"); } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); /* * type = obj.TypeDescriptor.Description; * name = obj.Name; * primerVarObj = true; * if (isGenerated(obj)) * { * VariablesPart vp = obj.Parts.Get<VariablesPart>(); * if (vp != null) * { * foreach (Variable v in vp.Variables) * { * if ((!v.IsStandard) && (v.AttributeBasedOn == null) && (v.DomainBasedOn) == null) * { * varName = v.Name; * if (primerVarObj) * { * primerVarObj = false; * writer.AddTableData(new string[] { type, name, "", "", "" }); * } * string suggestedDomains = ""; * foreach (Domain d in Domain.GetAll(kbserv.CurrentModel)) * { * if ((v.Type == d.Type) && (v.Length == d.Length) && (v.Decimals == d.Decimals) && (v.Signed == d.Signed)) * { * if (suggestedDomains != "") * { * suggestedDomains += ", "; * } * suggestedDomains += "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;AssignDomainToVariable&objName=" + obj.Name + "&objtype=" + type + "&varId=" + v.Id.ToString() + "&domainName=" + d.Name + "\">" + d.Name + "</a>"; * } * } * string suggestedAttribute = ""; * foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel)) * { * if ((v.Type == a.Type) && (v.Length == a.Length) && (v.Decimals == a.Decimals) && (v.Signed == a.Signed)) * { * if (suggestedAttribute != "") * { * suggestedAttribute += ", "; * } * suggestedAttribute += "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;AssignAttributeToVariable&objName=" + obj.Name + "&objtype=" + type + "&varId=" + v.Id.ToString() + "&attId=" + a.Id.ToString() + "\">" + a.Name + "</a>"; * } * } * writer.AddTableData(new string[] { "", "", varName, suggestedAttribute, suggestedDomains }); * } * } * } * } * } * * * */ }