private static void ListItem(SDTItem item, int tabs, System.IO.StreamWriter file)
        {
            WriteTabs(tabs, file);
            string dataType = item.Type.ToString().Substring(0, 1) + "(" + item.Length.ToString() + (item.Decimals > 0 ? "." + item.Decimals.ToString() : "") + ")" + (item.Signed ? "-" : "");

            file.WriteLine("{0}, {1}, {2} {3}", item.Name, dataType, item.Description, (item.IsCollection ? ", collection " + item.CollectionItemName : ""));
        }
Exemple #2
0
        private static void CleanSDT(Artech.Genexus.Common.Objects.Attribute a, IOutputService output, KBObject objRef)
        {
            if (objRef is SDT)
            {
                output.AddLine("Cleaning SDT references to " + a.Name + " in " + objRef.Name);
                SDTStructurePart sdtstruct = objRef.Parts.Get <SDTStructurePart>();

                foreach (IStructureItem structItem in sdtstruct.Root.Items)
                {
                    SDTItem sdtItem = (SDTItem)structItem;
                    if (sdtItem.BasedOn.Key == a.Key)
                    {
                        output.AddLine("..." + sdtItem.Name + " based on  " + a.Name);
                        eDBType type   = sdtItem.Type;
                        int     length = sdtItem.Length;
                        bool    signed = sdtItem.Signed;
                        string  desc   = sdtItem.Description;
                        int     dec    = sdtItem.Decimals;

                        //Modifico la variable, para que no se base en el atributo.
                        sdtItem.AttributeBasedOn = null;
                        sdtItem.Type             = type;
                        sdtItem.Decimals         = dec;
                        sdtItem.Description      = desc;
                        sdtItem.Length           = length;
                        sdtItem.Signed           = signed;
                    }
                }
            }
        }
Exemple #3
0
 internal static void SDTBasedOnAttDomain(List <KBObject> objs, IOutputService output)
 {
     foreach (KBObject obj in objs)
     {
         if (obj is SDT)
         {
             SDTStructurePart sdtstruct         = obj.Parts.Get <SDTStructurePart>();
             bool             hasItemNotBasedOn = false;
             string           itemnames         = "";
             foreach (IStructureItem structItem in sdtstruct.Root.Items)
             {
                 if (structItem is SDTItem)
                 {
                     SDTItem sdtItem = (SDTItem)structItem;
                     if (sdtItem.BasedOn == null && sdtItem.AttributeBasedOn == null && Utility.TypeHasToBeInDomain(sdtItem.Type))
                     {
                         hasItemNotBasedOn = true;
                         itemnames        += sdtItem.Name + " ";
                     }
                 }
             }
             if (hasItemNotBasedOn)
             {
                 OutputError err = new OutputError("SDT with items without domain: " + itemnames, MessageLevel.Warning, new KBObjectAnyPosition(obj));
                 output.Add("KBDoctor", err);
             }
         }
     }
 }
Exemple #4
0
        public static EntityKey KeyOfBasedOn_CompatibleConEvo3(SDTItem sdtItem)
        {
            // esto es para mantener compatibilidad con Evo3 y la 15
            EntityKey myKey = new EntityKey(Guid.Empty, 0);

#if EVO3
            myKey = sdtItem.BasedOn.ObjKey;
#else
            myKey = sdtItem.BasedOn.Key;
#endif
            //Termina compatibilidad Evo3 y 15.
            return(myKey);
        }
Exemple #5
0
        private static SDT GenerateSdt(Table tabla)
        {
            SDT Sdt = SDT.Create(UIServices.KB.CurrentModel);

            Sdt.Name = "SDT_" + tabla.Name;

            Sdt.Description = tabla.Description;

            // Añadir los atributos de la tabla.

            foreach (TableAttribute atr in tabla.TableStructure.Attributes)
            {
                SDTItem item = new SDTItem(Sdt.SDTStructure);
                item.Name             = atr.Name;
                item.Description      = atr.Attribute.Description;
                item.AttributeBasedOn = atr;
                Sdt.SDTStructure.Root.AddItem(item);
            }
            Sdt.Save();
            return(Sdt);
        }
Exemple #6
0
        internal static void CleanSDT(Artech.Genexus.Common.Objects.Attribute a, IOutputService output, KBObject objRef)
        {
            if (objRef is SDT)
            {
                output.AddLine("Cleaning SDT references to " + a.Name + " in " + objRef.Name);
                SDTStructurePart sdtstruct = objRef.Parts.Get <SDTStructurePart>();

                foreach (IStructureItem structItem in sdtstruct.Root.Items)
                {
                    SDTItem sdtItem = (SDTItem)structItem;

                    //Esto es para permitir trabajar con Evo3 y la 15.
                    EntityKey myKey = new EntityKey(a.Key);
#if EVO3
                    myKey = sdtItem.BasedOn.ObjKey;
#else
                    myKey = sdtItem.BasedOn.Key;
#endif
                    //Termina compilacion condicional.

                    if (sdtItem.BasedOn != null && myKey == a.Key)
                    {
                        output.AddLine("..." + sdtItem.Name + " based on  " + a.Name);
                        eDBType type   = sdtItem.Type;
                        int     length = sdtItem.Length;
                        bool    signed = sdtItem.Signed;
                        string  desc   = sdtItem.Description;
                        int     dec    = sdtItem.Decimals;

                        //Modifico la variable, para que no se base en el atributo.
                        sdtItem.AttributeBasedOn = null;
                        sdtItem.Type             = type;
                        sdtItem.Decimals         = dec;
                        sdtItem.Description      = desc;
                        sdtItem.Length           = length;
                        sdtItem.Signed           = signed;
                    }
                }
            }
        }
Exemple #7
0
        private static void CleanSDT(Artech.Genexus.Common.Objects.Attribute a, IOutputService output, KBObject objRef)
        {
            if (objRef is SDT)
            {
                output.AddLine("Cleaning SDT references to " + a.Name + " in " + objRef.Name);
                SDTStructurePart sdtstruct = objRef.Parts.Get <SDTStructurePart>();

                foreach (IStructureItem structItem in sdtstruct.Root.Items)
                {
                    try
                    {
                        SDTItem sdtItem = (SDTItem)structItem;

                        EntityKey myKey = KBDoctorCore.Sources.Utility.KeyOfBasedOn_CompatibleConEvo3(sdtItem);

                        if (sdtItem.BasedOn != null && myKey == a.Key)
                        {
                            output.AddLine("..." + sdtItem.Name + " based on  " + a.Name);
                            eDBType type   = sdtItem.Type;
                            int     length = sdtItem.Length;
                            bool    signed = sdtItem.Signed;
                            string  desc   = sdtItem.Description;
                            int     dec    = sdtItem.Decimals;

                            //Modifico la variable, para que no se base en el atributo.
                            sdtItem.AttributeBasedOn = null;
                            sdtItem.Type             = type;
                            sdtItem.Decimals         = dec;
                            sdtItem.Description      = desc;
                            sdtItem.Length           = length;
                            sdtItem.Signed           = signed;
                        }
                    }
                    catch (Exception e) { output.AddErrorLine(e.Message); };
                }
            }
        }