Esempio n. 1
0
        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" });
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        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);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }