示例#1
0
        public static void ListObjDiffMasterPage2()
        {
            IKBService kbserv = UIServices.KB;

            Dictionary <string, KBObjectCollection> dic = new Dictionary <string, KBObjectCollection>();

            string title      = "KBDoctor - Objects";
            string outputFile = Functions.CreateOutputFile(kbserv, title);


            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);

            output.AddLine("Listing objects...");
            writer.AddTableHeader(new string[] { "Tipo", "Object", "Description", "Last Update", "Timestamp" });
            foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll())
            {
                writer.AddTableData(new string[] { obj.TypeDescriptor.Name, obj.Name, obj.Description, obj.LastUpdate.ToString(), obj.Timestamp.ToString() });
            }
            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#2
0
        public static void ListAttWithoutDescription()
        {
            IKBService kbserv = UIServices.KB;

            string title      = "KBDoctor - Attributes with incomplete description";
            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[] { "Table", "Attribute", "Description", "Data type", "Title", "Column Title" });
            string description;
            string titlesuggested;
            string columnTitle;

            foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel))
            {
                description    = a.Description;
                titlesuggested = a.Title;
                columnTitle    = a.ColumnTitle;
                string Picture = Functions.ReturnPicture(a);

                if ((a.Description.Replace(" ", "") == a.Name) || (a.Title == a.Description) || (a.ColumnTitle == a.Description))
                {
                    string attNameLink = Functions.linkObject(a); // "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;OpenObject&name=" + a.Guid.ToString() + "\">" + a.Name + "</a>";

                    if (a.Title == a.Description)
                    {
                        titlesuggested = "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;AssignTitleToAttribute&attName=" + a.Name + "\">" + a.Title + "</a>";
                    }

                    if (a.Description.Replace(" ", "") == a.Name)
                    {
                        description = "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;AssignDescriptionToAttribute&attName=" + a.Name + "\">" + a.Description + "</a>";
                        Table t = TablesHelper.TableOfAttribute(a);
                        writer.AddTableData(new string[] { Functions.linkObject(t), attNameLink, description, Picture, titlesuggested, columnTitle });
                    }

                    if (a.ColumnTitle == a.Description)
                    {
                        columnTitle = "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;AssignColumnTitleToAttribute&attName=" + a.Name + "\">" + a.ColumnTitle + "</a>";
                    }

                    //                    writer.AddTableData(new string[] { attNameLink, description, Picture, titlesuggested, columnTitle });
                }
            }

            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#3
0
        public static void RemoveAttributeWithoutTable()
        {
            IKBService kbserv = UIServices.KB;

            string title      = "KBDoctor - Remove attributes without table";
            string outputFile = Functions.CreateOutputFile(kbserv, title);

            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            List <string[]> lineswriter;

            KBDoctorCore.Sources.API.RemoveAttributesWithoutTable(kbserv.CurrentModel, output, out lineswriter);
            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "", "Attribute", "Description", "Data type" });
            foreach (string[] line in lineswriter)
            {
                writer.AddTableData(line);
            }
            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#4
0
        public static void GenerateGraph()
        {
            IKBService kbserv     = UIServices.KB;
            string     title      = "KBDoctor - Generate Graph ";
            string     outputFile = Functions.CreateOutputFile(kbserv, title);

            KBModel model       = kbserv.CurrentKB.DesignModel;
            int     ATTNAME_LEN = model.GetPropertyValue <int>("ATTNAME_LEN");
            int     TBLNAME_LEN = model.GetPropertyValue <int>("TBLNAME_LEN");
            int     OBJNAME_LEN = model.GetPropertyValue <int>("OBJNAME_LEN");


            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Check", "File" });

            string Check    = "";
            string Name     = "";
            string FileName = "";

            /*
             * Check = "KB Table Graph";
             * Name = Functions.CleanFileName(Check);
             * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".gexf";
             * GenerateKBTableGraph(Name, FileName);
             * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) });
             *
             * Check = "KB Object Graph";
             * Name = Functions.CleanFileName(Check);
             * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".gexf";
             * GenerateKBObjectGraph(Name, FileName);
             * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) });
             */
            Check    = "KB Object Edges txt";
            Name     = Functions.CleanFileName(Check);
            FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".txt";
            GenerateKBObjectEdgesTxt(Name, FileName);
            writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) });

            /*
             * Check = "KB Module Graph";
             * Name = Functions.CleanFileName(Check);
             * FileName = kbserv.CurrentKB.UserDirectory + @"\kbdoctor." + Name + ".gexf";
             * GenerateKBModuleGraph(Name, FileName);
             * writer.AddTableData(new string[] { Check, Functions.linkFile(FileName) });
             */
            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#5
0
        public static void ClassNotInTheme()
        {
            IKBService kbserv = UIServices.KB;

            string title      = "KBDoctor - Class not in Theme";
            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[] { "Object", "Class", "Error" });

            //Cargo todas las clases de todos los theme de la KB.
            StringCollection ThemeClasses = new StringCollection();

            LoadThemeClasses(kbserv, output, ThemeClasses);

            StringCollection UsedClasses = new StringCollection();

            //Reviso todos los objeto para ver las class usadas en cada control
            LoadAndCheckUsedClasses(kbserv, output, UsedClasses, ThemeClasses, writer);


            foreach (string sd in UsedClasses)
            {
                if (!ThemeClasses.Contains(sd))
                {
                    writer.AddTableData(new string[] { "", sd, "Application Class not in theme" });
                    output.AddLine("Application Class not in theme " + sd);
                }
                else
                {
                    ThemeClasses.Remove(sd);
                }
            }


            writer.AddTableData(new string[] { "-----------------", "--------------", "---" });
            foreach (string ss in ThemeClasses)
            {
                if (!UsedClasses.Contains(ss))
                {
                    writer.AddTableData(new string[] { "", ss, "Class not referenced" });
                    output.AddLine("Class not referenced in application " + ss);
                }
            }
            writer.AddTableData(new string[] { "-------", "-----------------", "--------------" });
            writer.AddFooter();
            writer.Close();
            output.EndSection(title, true);

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
示例#6
0
        internal static void ListObjectsWithTableInOtherModule()
        {
            IKBService kbserv = UIServices.KB;
            KBModel    model  = kbserv.CurrentModel.GetDesignModel();

            string         title  = "KBDoctor - List Objects with table in other module";
            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            string outputFile = Functions.CreateOutputFile(kbserv, title);

            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] {
                "Name", "Description", "Object Module", "Table ", "Table Module"
            });

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;

            foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                string modulename = ModulesHelper.ObjectModuleName(obj);

                foreach (EntityReference reference in obj.GetReferences())

                {
                    KBObject objref = KBObject.Get(obj.Model, reference.To);

                    if (objref != null && objref is Table && !ObjectsHelper.isGeneratedbyPattern(obj))
                    {
                        Table  t = (Table)objref;
                        string tablemodulename = TablesHelper.TableModule(t.Model, t).Name;

                        if (tablemodulename != modulename)
                        {
                            string objNameLink = Functions.linkObject(obj);

                            output.AddLine("Processing... " + obj.Name + " reference table " + t.Name + " Object module:" + modulename + " Table module:" + tablemodulename);

                            writer.AddTableData(new string[] { objNameLink, obj.Description, modulename, t.Name, tablemodulename });
                        }
                    }
                }
            }


            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#7
0
        public static void ListObjWarningsErrors()
        {
            IKBService    kbserv     = UIServices.KB;
            List <string> objWarnErr = new List <string>();

            string title = "KBDoctor - Warnings and Errors";

            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);
                GxModel gxModel = kbserv.CurrentKB.DesignModel.Environment.TargetModel.GetAs <GxModel>();

                var fileWildcardsArg = new[] { "*.xml" };
                var directoryArg     = KBDoctorHelper.SpcDirectory(kbserv);
                var searchSubDirsArg = System.IO.SearchOption.AllDirectories;
                var ignoreCaseArg    = true;

                writer.AddTableHeader(new string[] { "Error Type", "ObjClass", "Object", "Description", "UserName", "Observation" });

                SearchNVGFiles(output, writer, fileWildcardsArg, directoryArg, searchSubDirsArg, "<Error>", ignoreCaseArg, objWarnErr);
                SearchNVGFiles(output, writer, fileWildcardsArg, directoryArg, searchSubDirsArg, "deprecated", ignoreCaseArg, objWarnErr);
                SearchNVGFiles(output, writer, fileWildcardsArg, directoryArg, searchSubDirsArg, "<Warning>", ignoreCaseArg, objWarnErr);
                SearchNVGFiles(output, writer, fileWildcardsArg, directoryArg, searchSubDirsArg, "<Icon>client<", ignoreCaseArg, objWarnErr);
                SearchNVGFiles(output, writer, fileWildcardsArg, directoryArg, searchSubDirsArg, "<JoinLocation>0</JoinLocation>", ignoreCaseArg, objWarnErr);


                writer.AddFooter();
                //agrego lista de objetos para que sea facil hacerle un BUILD WITH THIS ONLY
                string lstObjWarn = "";
                string puntoycoma = "";
                foreach (string objstr in objWarnErr)
                {
                    lstObjWarn += puntoycoma + Path.GetFileNameWithoutExtension(objstr);
                    puntoycoma  = ";";
                }
                writer.AddTableData(new string[] { lstObjWarn });
                writer.AddTableData(new string[] { "  " + objWarnErr.Count.ToString() });

                writer.Close();


                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                output.EndSection("KBDoctor", title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#8
0
        public static void ListLastReports()
        {
            IKBService kbserv = UIServices.KB;

            Dictionary <string, KBObjectCollection> dic = new Dictionary <string, KBObjectCollection>();

            string title      = "KBDoctor - List last Reports";
            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[] { "Report", "", "Date Generated" });

            string[] fileEntries = Directory.GetFiles(kbserv.CurrentKB.UserDirectory, "kbdoctor*.html");

            foreach (string fileName in fileEntries)
            {
                string dateFilename = "";
                int    days         = (int)(DateTime.Now - File.GetLastWriteTime(fileName)).TotalDays;
                int    hours        = (int)(DateTime.Now - File.GetLastWriteTime(fileName)).TotalHours;
                int    mins         = (int)(DateTime.Now - File.GetLastWriteTime(fileName)).TotalMinutes;

                if (days > 0)
                {
                    dateFilename = days.ToString() + " day(s) ago";
                }
                else
                if (hours > 0)
                {
                    dateFilename = hours.ToString() + " hour(s) ago";
                }
                else
                {
                    dateFilename = mins.ToString() + " minutes(s) ago";
                }

                string shortFilename = Path.GetFileName(fileName);
                shortFilename = shortFilename.Replace("kbdoctor.", "");
                shortFilename = shortFilename.Replace(".html", "");
                shortFilename = Regex.Replace(shortFilename, "(\\B[A-Z])", " $1");

                string fileLink = "<a href=\"file:///" + fileName + "\">" + shortFilename + "</a>";
                writer.AddTableData(new string[] { fileLink, dateFilename, File.GetLastWriteTime(fileName).ToString() });
            }
            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#9
0
        internal static void RenameVariables()
        {
            IKBService kbserv = UIServices.KB;
            string     title  = "KBDoctor - Object with variables not based on attribute/domain";

            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[] { "Type", "Name", "Variable", "Attribute", "Domain" });

                Domain dom = Functions.DomainByName("Fecha");

                //All useful objects are added to a collection
                foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll())
                {
                    KBDoctorOutput.Message("Procesing.... " + obj.Name + " - " + obj.Type.ToString());
                    Boolean SaveObj = false;

                    if (Utility.isGenerated(obj) && !ObjectsHelper.isGeneratedbyPattern(obj) && (obj is Transaction || obj is WebPanel || obj is WorkPanel))
                    {
                        Functions.AddLine("RenameVariables.txt", "##" + obj.Name);
                        List <Variable> lstVariables = VariablesToRename(obj);
                    }
                }

                string inputFile = kbserv.CurrentKB.UserDirectory + @"\RenameVariables.txt";

                // Input
                List <String> data = File.ReadAllLines(inputFile).Distinct(StringComparer.CurrentCultureIgnoreCase).ToList();

                // Processing
                data.Sort();

                // Output
                string outputFile2 = kbserv.CurrentKB.UserDirectory + @"\RenameVariables2.txt";
                File.WriteAllLines(outputFile2, data.ToArray());


                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                output.EndSection("KBDoctor", title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#10
0
        public static void ListMainObj()
        {
            IKBService kbserv = UIServices.KB;


            Dictionary <string, KBObjectCollection> dic = new Dictionary <string, KBObjectCollection>();

            string title = "KBDoctor - Main Objects";

            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[] { "Type", "Object", "Description", "Module", "Public", "Generator", "Protocol", "Last Update" });

                KBCategory mainCategory = Functions.MainCategory(kbserv.CurrentModel);
                foreach (KBObject obj in mainCategory.AllMembers)
                {
                    if (obj != null)
                    {
                        string desc = obj.Description.Replace(",", " ");
                        desc = desc.Replace(">", "");
                        desc = desc.Replace("<", "");
                        string objAppGenerator = obj.GetPropertyValueString("AppGenerator");
                        string objProtocol     = obj.GetPropertyValueString("CALL_PROTOCOL");


                        string isGenerated = KBDoctorCore.Sources.Utility.isGenerated(obj) ? "Yes" : "";


                        writer.AddTableData(new string[] { obj.TypeDescriptor.Name + " ", Functions.linkObject(obj), desc,
                                                           obj.Module.Name, obj.IsPublic.ToString(), objAppGenerator, objProtocol, obj.LastUpdate.ToShortDateString() });


                        KBDoctorOutput.Message(obj.TypeDescriptor.Name + "," + obj.Name + "," + obj.Description);  //+ "," + obj.Timestamp.ToString());
                    }
                }
                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                output.EndSection("KBDoctor", title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#11
0
        public static void ListProc()
        {
            IKBService kbserv = UIServices.KB;


            Dictionary <string, KBObjectCollection> dic = new Dictionary <string, KBObjectCollection>();

            string title = "KBDoctor - Procedure";

            try
            {
                string  outputFile = Functions.CreateOutputFile(kbserv, title);
                KBModel kbmodel    = kbserv.CurrentModel;


                IOutputService output = CommonServices.Output;
                output.StartSection("KBDoctor", title);

                KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);
                writer.AddHeader(title);

                writer.AddTableHeader(new string[] { "Type", "Object", "Commit ", "Module", "Public", "Generator", "Protocol", "Last Update" });
                string commitOnExit = "";

                foreach (KBObject obj in kbmodel.Objects.GetAll())
                {
                    commitOnExit = "";
                    if (obj is Procedure)
                    {
                        if (obj.VersionDate >= DateTime.Now.AddDays(-45))
                        {
                            object aux = obj.GetPropertyValue("CommitOnExit");
                            if (aux != null)
                            {
                                commitOnExit = aux.ToString();
                            }
                        }
                        writer.AddTableData(new string[] { obj.TypeDescriptor.Name + " ", Functions.linkObject(obj), commitOnExit,
                                                           obj.Module.Name, obj.IsPublic.ToString(), "", "", obj.LastUpdate.ToShortDateString() });


                        KBDoctorOutput.Message(obj.TypeDescriptor.Name + "," + obj.Name + "," + obj.Description);  //+ "," + obj.Timestamp.ToString());
                    }
                }
                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                output.EndSection("KBDoctor", title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#12
0
        private static void CompareLastDirectory(string tipo)
        {
            string dirAppData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DiffDotNet");

            if (!File.Exists(Path.Combine(dirAppData, "DiffDotNet.exe")))
            {
                Directory.CreateDirectory(dirAppData);
                File.WriteAllBytes(Path.Combine(dirAppData, "MeneesDiffUtils.dll"), Comparer.MeneesDiffUtils);
                File.WriteAllBytes(Path.Combine(dirAppData, "Menees.dll"), Comparer.Menees);
                File.WriteAllBytes(Path.Combine(dirAppData, "DiffDotNet.exe"), Comparer.DiffDotNet);
            }

            // Start the child process.
            Process p = new Process();

            p.StartInfo.UseShellExecute = false;

            p.StartInfo.FileName = Path.Combine(dirAppData, "DiffDotNet.exe");

            //Saco directorio donde se guardan las comparaciones.
            IKBService kbserv = UIServices.KB;
            string     dir    = "";

            if (tipo == "NVG")
            {
                dir = KBDoctorHelper.NvgComparerDirectory(kbserv);
            }
            if (tipo == "OBJ")
            {
                dir = KBDoctorHelper.ObjComparerDirectory(kbserv);
            }

            //Me quedo con los ultimos dos directorios
            string d1 = "";
            string d2 = "";

            foreach (string d in Directory.GetDirectories(dir, "*", SearchOption.TopDirectoryOnly))
            {
                d2 = d1;
                d1 = d;
            }
            if (d2 == "" || d1 == "")
            {
                string         title  = "KBDoctor - Compare files";
                IOutputService output = CommonServices.Output;
                output.StartSection(title);
                output.AddErrorLine("There isn't two directory to compare in " + dir + ". You must generate files first and then compare ");
                output.EndSection(title, true);
            }
            else
            {
                p.StartInfo.Arguments = d2 + " " + d1;
                p.Start();
            }
        }
示例#13
0
        public static void RecomendedModule()
        {
            IKBService kbserv = UIServices.KB;

            Dictionary <string, KBObjectCollection> dic = new Dictionary <string, KBObjectCollection>();

            string title      = "KBDoctor - Recomended module";
            string outputFile = Functions.CreateOutputFile(kbserv, title);

            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            string            sw     = "";
            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            int numObj = 0;

            writer.AddTableHeader(new string[] { "Type", "Object", "Module", "List of modules" });


            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = false;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>());
            // Module module2 = new Module(kbModel);
            foreach (Module module in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                foreach (KBObject obj in module.GetAllMembers())
                {
                    if (Functions.hasModule(obj))
                    {
                        output.AddLine(obj.Name);
                        string moduleListString = "";
                        foreach (Module mod in ListModulesOfReferencedTables(obj))
                        {
                            moduleListString += mod.Name + " ";
                        }

                        if (obj.Module.Name != moduleListString.Trim() && moduleListString.Trim() != "")
                        {
                            writer.AddTableData(new string[] { obj.TypeDescriptor.Name + " ", Functions.linkObject(obj), obj.Module.Name, moduleListString });
                        }
                    }
                }
            }
            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#14
0
        public static void ListDomain()
        {
            IKBService kbserv = UIServices.KB;

            string title = "KBDoctor - Domains";

            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[] { "Domain", "Description", "Data type", "Att references", "Other References" });
                string description;
                string titlesuggested;
                string columnTitle;
                foreach (Domain d in Domain.GetAll(kbserv.CurrentModel))
                {
                    description = d.Description;
                    string Picture         = Utility.FormattedTypeDomain(d);
                    int    attReferences   = 0;
                    int    otherReferences = 0;
                    foreach (EntityReference r in d.GetReferencesTo())
                    {
                        KBObject objRef = KBObject.Get(UIServices.KB.CurrentModel, r.From);
                        if (objRef is Artech.Genexus.Common.Objects.Attribute)
                        {
                            attReferences += 1;
                        }
                        else
                        {
                            otherReferences += 1;
                        }
                    }
                    writer.AddTableData(new string[] { Functions.linkObject(d), description, Picture, attReferences.ToString(), otherReferences.ToString() });
                }
                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#15
0
        public static void ListWithoutDomain()
        {
            IKBService kbserv = UIServices.KB;
            Dictionary <string, string> myDict = new Dictionary <string, string>();

            string title      = "KBDoctor - Attributes without 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[] { "Attribute", "Description", "Data type", "Suggested Domains" });

            foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel))
            {
                string Picture   = Functions.ReturnPicture(a);
                bool   isSubtype = Functions.AttIsSubtype(a);
                if ((a.DomainBasedOn == null) && !isSubtype)
                {
                    // search for domains with the same data type
                    output.AddLine("Procesing " + a.Name);
                    string suggestedDomains = "";
                    string value            = "";

                    /*
                     * //busco el
                     * if (myDict.TryGetValue(Picture, out value))
                     * {
                     *  suggestedDomains = value;
                     * }
                     * else
                     * {
                     *  suggestedDomains = SuggestedDomains(kbserv, a);
                     * }
                     */
                    string attNameLink = Functions.linkObject(a); // "<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;OpenObject&name=" + a.Guid.ToString() + "\">" + a.Name + "</a>";
                    writer.AddTableData(new string[] { attNameLink, a.Description, Picture, suggestedDomains });
                }
            }

            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#16
0
        public static void AttFormula()
        {
            IKBService kbserv = UIServices.KB;


            string title      = "KBDoctor - Attributes Formula";
            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[] { "Attribute", "Description", "DataType", "Formula", "Tables", "Redundant in Tables" });
            string description;
            string titlesuggested;
            string columnTitle;

            foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel))
            {
                description    = a.Description;
                titlesuggested = a.Title;
                columnTitle    = a.ColumnTitle;
                Formula formula = a.Formula;
                if (formula == null)
                {
                    //  output.AddLine(a.Name);
                }
                else
                {
                    output.AddLine("Formula " + a.Name);
                    string Picture           = Functions.ReturnPicture(a);
                    string attNameLink       = Functions.linkObject(a);
                    string redundantInTables = "";
                    string tables            = "";
                    GetTablesAttIsRedundant(kbserv.CurrentModel, a, out tables, out redundantInTables);
                    writer.AddTableData(new string[] { attNameLink, description, Picture, formula.ToString(), tables, redundantInTables });
                }
            }

            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#17
0
        public static void AddINParmRule()
        {
            // Object with parm() rule without in: out: or inout:
            IKBService     kbserv = UIServices.KB;
            IOutputService output = CommonServices.Output;
            string         title  = "KBDoctor - ADD IN: to Parm() rule";

            output.StartSection("KBDoctor", title);
            try
            {
                string outputFile = Functions.CreateOutputFile(kbserv, title);


                KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);
                writer.AddHeader(title);
                writer.AddTableHeader(new string[] { "Object", "Description", "Tipo" });
                int cantObjChanged = 0;

                SelectObjectOptions selectObjectOption = new SelectObjectOptions
                {
                    MultipleSelection = true
                };
                //   selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get<Procedure>());
                // selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get<WebPanel>());

                foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
                {
                    if (obj.Description.StartsWith("Work With"))
                    {
                        writer.AddTableData(new string[] { obj.Name, obj.Description, obj.TypeDescriptor.Name });
                        obj.Description = obj.Description.Replace("Work With ", "Trabajar con ");
                        obj.Save();
                    }
                }

                writer.AddFooter();
                writer.Close();

                bool success = true;
                KBDoctorOutput.EndSection(title, success);
                KBDoctorOutput.Message("Object changed " + cantObjChanged.ToString());

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#18
0
        public static void ListTableAttributesUsingDomain()
        {
            // Object with parm() rule without in: out: or inout:
            IKBService     kbserv = UIServices.KB;
            IOutputService output = CommonServices.Output;
            string         title  = "KBDoctor - Domain to change";

            output.StartSection(title);
            string outputFile = Functions.CreateOutputFile(kbserv, title);


            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Domain", "Table", "Description", "Attribute", "Descripcion" });
            int cantObjChanged = 0;

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Domain>());

            foreach (KBObject dom in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                foreach (EntityReference reference in dom.GetReferencesTo())
                {
                    KBObject att = KBObject.Get(dom.Model, reference.From);

                    if ((att != null) && (att is Artech.Genexus.Common.Objects.Attribute))
                    {
                        foreach (EntityReference reference2 in att.GetReferencesTo())
                        {
                            KBObject tbl = KBObject.Get(att.Model, reference2.From);

                            if ((tbl != null) && (tbl is Table))
                            {
                                writer.AddTableData(new string[] { Functions.linkObject(dom), Functions.linkObject(tbl), tbl.Description, Functions.linkObject(att), att.Description });
                            }
                        }
                    }
                }
            }

            writer.AddFooter();
            writer.Close();

            bool success = true;

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
示例#19
0
        /*
         *
         * Dependencias Entrantes
         * Dependencias Salientes
         * IE = Salientes / (Entrantes + Salientes)
         #Componentes Conexos dentro del módulo.
         * Tiene dependencia cíclicla ?
         * Largo máximo de dependencias en la que participa.
         * El módulo tiene objetos públicos no referenciados por externos?
         */

        public static void ListModulesStatistics()
        {
            IKBService     kbserv     = UIServices.KB;
            IOutputService output     = CommonServices.Output;
            bool           success    = true;
            int            objInRoot  = 0;
            int            objSinRoot = 0;
            string         title      = "KBDoctor - List Modules Statistics";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Module", "Description", "Tables", "Public Tables", "Objects", "Public Obj", "Obj/Publ %", "In References", "Out References" });

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>());
            foreach (Module mdl in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                output.AddLine(mdl.Name + "....");
                string[] mdlStat = ModuleStats2(mdl);

                if (mdl.Name == "Root Module")
                {
                    objInRoot = Int32.Parse(mdlStat[4]);
                }
                else
                {
                    if (Int32.Parse(mdlStat[2]) != 0)
                    {
                        objSinRoot = objSinRoot + Int32.Parse(mdlStat[4]);
                    }
                }
                writer.AddTableData(mdlStat);
            }
            output.AddLine("");
            output.EndSection(title, success);
            int    ratio   = (objInRoot == 0) ? 0 : (objSinRoot * 100) / objInRoot;
            string Resumen = "Obj in Modules, Obj Root, Ratio  " + objSinRoot.ToString() + "," + objInRoot.ToString() + "," + ratio.ToString();

            writer.AddTableData(new string[] { Resumen });
            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            Functions.AddLineSummary("moduleStats.txt", Resumen);
        }
示例#20
0
        public static void ListKeyVarchar()
        {
            IKBService kbserv = UIServices.KB;

            string title      = "KBDoctor - Attributes Varchar that is Primary Key in some table";
            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[] { "Attribute", "Description", "Data type", "Domain", "Tables" });

            foreach (Table t in Table.GetAll(kbserv.CurrentModel))
            {
                output.AddLine("Processing... " + t.Name);
                string objNameLink = Functions.linkObject(t); //"<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;OpenObject&name=" + t.Guid.ToString() + "\">" + t.Name + "</a>";


                foreach (TableAttribute attr in t.TableStructure.PrimaryKey)
                {
                    if ((attr.Attribute.Type == Artech.Genexus.Common.eDBType.VARCHAR) || (attr.Attribute.Type == Artech.Genexus.Common.eDBType.LONGVARCHAR))
                    {
                        output.AddLine("Processing " + attr.Name);
                        if (!Functions.AttIsSubtype(attr))
                        {
                            string domLink     = DomainLinkFromAttribute(attr);
                            string attNameLink = Functions.linkObject(attr); //"<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;OpenObject&name=" + attr.Guid.ToString() + "\">" + attr.Name + "</a>";
                            string Picture     = Functions.ReturnPicture(attr);
                            writer.AddTableData(new string[] { attNameLink, attr.Attribute.Description, Picture, domLink, t.Name });
                        }
                    }
                }
            }

            writer.AddFooter();
            writer.Close();

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
            bool success = true;

            output.EndSection(title, success);
        }
示例#21
0
        public static void ListVarcharToChar()
        {
            IKBService kbserv = UIServices.KB;

            string title = "KBDoctor - Attributes Varchar that shoud be Char";

            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[] { "Attribute", "Description", "Data type", "Domain" });

                foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel))
                {
                    string Picture = Utility.FormattedTypeAttribute(a);
                    if (((a.Type == Artech.Genexus.Common.eDBType.VARCHAR) || (a.Type == Artech.Genexus.Common.eDBType.LONGVARCHAR)) && (a.Length <= 25) && !Functions.AttIsSubtype(a))
                    {
                        string domLink = DomainLinkFromAttribute(a);

                        string attNameLink = "";

                        attNameLink = Functions.linkObject(a); //"<a href=\"gx://?Command=fa2c542d-cd46-4df2-9317-bd5899a536eb;OpenObject&name=" + a.Guid.ToString() + "\">" + a.Name + "</a>";
                        writer.AddTableData(new string[] { attNameLink, a.Description, Picture, domLink });
                    }
                }

                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#22
0
        public static void BuildModule()
        {
            IKBService     kbserv  = UIServices.KB;
            KBModel        kbModel = UIServices.KB.CurrentModel;
            IOutputService output  = CommonServices.Output;

            bool   success = true;
            string title   = "KBDoctor - Build Module";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Object", "Description", "Visibility" });

            KBObjectCollection objToBuild = new KBObjectCollection();

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;

            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>());
            foreach (Module mdl in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                foreach (KBObject o in CreateListObjectsModuleAndReferences(kbModel, mdl, writer))
                {
                    objToBuild.Add(o);
                }
            }

            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);

            GenexusUIServices.Build.BuildWithTheseOnly(objToBuild.Keys);

            do
            {
                Application.DoEvents();
            } while (GenexusUIServices.Build.IsBuilding);

            output.EndSection("KBDoctor", true);
        }
示例#23
0
        public static void AddINParmRule()
        {
            // Object with parm() rule without in: out: or inout:
            IKBService     kbserv = UIServices.KB;
            IOutputService output = CommonServices.Output;
            string         title  = "KBDoctor - ADD IN: to Parm() rule";

            output.StartSection(title);
            string outputFile = Functions.CreateOutputFile(kbserv, title);


            KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Object", "Description", "Param rule" });
            int cantObjChanged = 0;

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Procedure>());

            foreach (KBObject obj in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                string oldParm = Functions.ExtractRuleParm(obj);
                string newParm = ChangeRuleParmWithIN(obj);
                if (newParm != "")
                {
                    cantObjChanged += 1;
                    PrintNewRuleParm(writer, obj, oldParm, newParm);
                }
            }

            writer.AddFooter();
            writer.Close();

            bool success = true;

            output.EndSection(title, success);
            output.AddLine("Object changed " + cantObjChanged.ToString());

            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
示例#24
0
        internal static void ListAttributes()
        {
            IKBService kbserv = UIServices.KB;
            // Dictionary<string, string> myDict = new Dictionary<string, string>();

            string title = "KBDoctor - List Attributes";

            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[] { "Attribute", "Description", "Data type", "Domain", "ControlType", "Subtype", "Title", "Column Title", "Contextual", "IsFormula" });

                foreach (Artech.Genexus.Common.Objects.Attribute a in Artech.Genexus.Common.Objects.Attribute.GetAll(kbserv.CurrentModel))
                {
                    string Picture       = Utility.FormattedTypeAttribute(a);
                    string domlink       = a.DomainBasedOn == null ? " " : Functions.linkObject(a.DomainBasedOn);
                    string superTypeName = a.SuperTypeKey == null ? " " : a.SuperType.Name;
                    string controlType   = a.GetPropertyValueString("ControlType");
                    KBDoctorOutput.Message("Procesing " + a.Name);
                    string isFormula = a.Formula == null ? "" : "*";
                    writer.AddTableData(new string[] { Functions.linkObject(a), a.Description, Picture, domlink, controlType, superTypeName, a.Title, a.ColumnTitle, a.ContextualTitleProperty, isFormula });
                }

                writer.AddFooter();
                writer.Close();

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
                bool success = true;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#25
0
        public static void MarkPublicObjects()
        {
            IKBService     kbserv  = UIServices.KB;
            IOutputService output  = CommonServices.Output;
            bool           success = true;
            string         title   = "KBDoctor - Mark Public Object";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Object", "Type", "Description", "Visibility" });

            MakeAllObjectPublic(kbserv, output);

            foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll())
            {
                output.AddLine("Object " + obj.Name);
                ICallableObject callableObject = obj as ICallableObject;
                if (((callableObject != null) || obj is ExternalObject || obj is SDT || obj is DataSelector) && (!(obj is Transaction)))
                {
                    ObjectVisibility objVisibility = obj.GetPropertyValue <ObjectVisibility>("ObjectVisibility");

                    ObjectVisibility newObjVisibility = RecoverVisibility(obj);

                    if (objVisibility != newObjVisibility)
                    {
                        obj.SetPropertyValue("ObjectVisibility", newObjVisibility);
                        Functions.SaveObject(output, obj);
                        string objNameLink = Functions.linkObject(obj);
                        writer.AddTableData(new string[] { objNameLink, obj.TypeDescriptor.Name, obj.Description, newObjVisibility.ToString() });
                        output.AddLine("....Change Object " + obj.Name);
                    }
                }
            }
            output.AddLine("");
            output.EndSection(title, success);
            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
示例#26
0
        public static void MoveTransactions()
        {
            IKBService     kbserv     = UIServices.KB;
            IOutputService output     = CommonServices.Output;
            bool           success    = true;
            int            objInRoot  = 0;
            int            objSinRoot = 0;
            string         title      = "KBDoctor - Move Transaction";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] { "Transaction", "Description", "Table", "Most referenced in Folder" });

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Transaction>());
            foreach (Transaction trn in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                foreach (TransactionLevel lvl in trn.Structure.GetLevels())
                {
                    Table         tbl      = lvl.AssociatedTable;
                    List <string> fldlist  = MostReferencedInFolder(tbl);
                    string        listatxt = "";
                    foreach (string s in fldlist)
                    {
                        listatxt += s + "<br>";
                    }

                    writer.AddTableData(new string[] { Functions.linkObject(trn), trn.Description, Functions.linkObject(tbl), listatxt });
                }
            }


            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
示例#27
0
        /*
         * public static void LoadUsedClasses(ollection UsedClasses)
         * {
         *
         *  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 is ThemeClass) && (obj.GetPropertyValue<bool>(Properties.TRN.GenerateObject)))
         *      {
         *          WebFormPart webForm = obj.Parts.Get<WebFormPart>();
         *
         *          KBDoctorOutput.Message( " 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 ClassUsed()
        {
            IKBService kbserv = UIServices.KB;

            string title = "KBDoctor - Classes Used";

            try
            {
                string outputFile = Functions.CreateOutputFile(kbserv, title);

                // IOutputService output = CommonServices.Output;
                KBDoctorOutput.StartSection(title);

                KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);
                writer.AddHeader(title);
                writer.AddTableHeader(new string[] { "Class", "Error" });

                StringCollection UsedClasses  = LoadUsedClasses();
                StringCollection ThemeClasses = new StringCollection();
                //Reviso todos los objeto para ver las class usadas en cada control

                foreach (string sd in UsedClasses)
                {
                    writer.AddTableData(new string[] { sd, "" });
                    KBDoctorOutput.Message("Application Class used " + sd);
                }

                writer.AddTableData(new string[] { "-----------------", "--------------", "---" });

                writer.AddFooter();
                writer.Close();
                KBDoctorOutput.EndSection(title, true);

                KBDoctorHelper.ShowKBDoctorResults(outputFile);
            }
            catch
            {
                bool success = false;
                KBDoctor.KBDoctorOutput.EndSection(title, success);
            }
        }
示例#28
0
        public static void PrepareComparerNavigation()
        {
            string         title  = "KBDoctor - Prepare Comparer Navigation Files";
            IOutputService output = CommonServices.Output;

            output.StartSection(title);

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            IKBService kbserv       = UIServices.KB;
            string     directoryArg = KBDoctorHelper.NvgComparerDirectory(kbserv);
            string     fechahora    = String.Format("{0:yyyy-MM-dd-HHmm}", DateTime.Now);
            string     newDir       = directoryArg + @"\NVG-" + fechahora + @"\";

            Directory.CreateDirectory(newDir);
            WriteXSLTtoDir();
            foreach (string d in Directory.GetDirectories(KBDoctorHelper.SpcDirectory(kbserv), "NVG", System.IO.SearchOption.AllDirectories))
            {
                string generator = d.Replace(KBDoctorHelper.SpcDirectory(kbserv), "");
                generator = generator.Replace("NVG_", "");
                generator = @"\" + generator.Replace(@"\", "_") + "_";
                generator = generator.Replace("NVG_", "");

                ProcesoDir(d, newDir, generator, output);
            }


            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;

            // Format and display the TimeSpan value.
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                               ts.Hours, ts.Minutes, ts.Seconds,
                                               ts.Milliseconds / 10);

            output.AddLine(title + " elepsed time: " + elapsedTime);
            output.EndSection(title, true);
        }
示例#29
0
        public static void ListModulesErrors()
        {
            IKBService     kbserv  = UIServices.KB;
            IOutputService output  = CommonServices.Output;
            bool           success = true;

            string title = "KBDoctor - List Modules Errors";

            output.StartSection(title);
            string            outputFile = Functions.CreateOutputFile(kbserv, title);
            KBDoctorXMLWriter writer     = new KBDoctorXMLWriter(outputFile, Encoding.UTF8);

            writer.AddHeader(title);
            writer.AddTableHeader(new string[] {
                "Module", "Warning Public Objects not referenced", "ERROR Private Objects Referenced", "ERROR  Reference private Tables", "ERROR Update outside Module", "Object to Move"
            });

            SelectObjectOptions selectObjectOption = new SelectObjectOptions();

            selectObjectOption.MultipleSelection = true;
            selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>());
            foreach (Module mdl in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption))
            {
                if (mdl is Module)
                {
                    output.AddLine(mdl.Name + "....");
                    string[] mdlStat = ModuleStats((Module)mdl);

                    writer.AddTableData(mdlStat);
                }
            }
            output.AddLine("");
            output.EndSection(title, success);

            writer.AddFooter();
            writer.Close();
            KBDoctorHelper.ShowKBDoctorResults(outputFile);
        }
示例#30
0
        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);
            }
        }