示例#1
0
        public void RefreshStoredProcedure(ref XsdDataBase.TBL_ObjectRow nOriginalStoredProcedure)
        {
            // Consultar la nueva configuracion
            var newMapStoredProcedure = LoadAndRestoreStoredProcedure(nOriginalStoredProcedure, Log);

            //Restaurar informacion basica
            nOriginalStoredProcedure.Generic_Type = newMapStoredProcedure.Generic_Type;
            nOriginalStoredProcedure.Object_Type = newMapStoredProcedure.Object_Type;
            nOriginalStoredProcedure.Catalog_Name = newMapStoredProcedure.Catalog_Name;
            nOriginalStoredProcedure.Schema_Name = newMapStoredProcedure.Schema_Name;
            nOriginalStoredProcedure.Object_Name = newMapStoredProcedure.Object_Name;

            // Restaurar parametros
            var fields = nOriginalStoredProcedure.GetTBL_FieldRows();

            foreach (var field in fields)
            {
                MapDataBase.TBL_Field.RemoveTBL_FieldRow(field);
            }

            try
            {
                fields = newMapStoredProcedure.GetTBL_FieldRows();

                foreach (var parameter in fields)
                {
                    MapDataBase.TBL_Field.AddTBL_FieldRow(nOriginalStoredProcedure,
                        parameter.Field_Name,
                        parameter.Field_Type,
                        parameter.Specific_Type,
                        parameter.Is_Nullable,
                        parameter.Max_Length,
                        parameter.Precision,
                        parameter.Scale,
                        parameter.PrimaryKey_Order,
                        parameter.Direction);
                }
            }
            catch (Exception ex)
            {
                Log.AppendLine(ex.Message);
            }
        }
示例#2
0
        public List<Parameter> GetTableColumns(XsdDataBase.TBL_ObjectRow table)
        {
            var param = new List<Parameter>();
            var fields = table.GetTBL_FieldRows();

            foreach (var field in fields)
            {
                var direction = (ParameterDirection)(Enum.Parse(typeof(ParameterDirection), field.Direction));
                var fType = (DbType)(Enum.Parse(typeof(DbType), field.Field_Type));

                param.Add(new Parameter(field.Field_Name, fType, field.Specific_Type, "", field.Is_Nullable, field.Max_Length, field.Precision, field.Scale, direction));
            }

            return param;
        }
示例#3
0
        public void RefreshObjectTable(ref XsdDataBase.TBL_ObjectRow nOriginalTable)
        {
            // Consultar la nueva configuracion
            var newMapTable = LoadAndRestoreObjectTable(nOriginalTable, Log);

            // Restaurar informacion basica
            nOriginalTable.Generic_Type = newMapTable.Generic_Type;
            nOriginalTable.Object_Type = newMapTable.Object_Type;
            nOriginalTable.Catalog_Name = newMapTable.Catalog_Name;
            nOriginalTable.Schema_Name = newMapTable.Schema_Name;
            nOriginalTable.Object_Name = newMapTable.Object_Name;

            nOriginalTable.Selected = newMapTable.Selected;
            nOriginalTable.Mapped = newMapTable.Mapped;

            // Restaurar columnas
            var fields = nOriginalTable.GetTBL_FieldRows();

            foreach (var field in fields)
            {
                field.Delete();
            }

            try
            {
                fields = newMapTable.GetTBL_FieldRows();

                foreach (var newMapField in fields)
                {
                    var field = MapDataBase.TBL_Field.AddTBL_FieldRow(nOriginalTable,
                        newMapField.Field_Name,
                        newMapField.Field_Type,
                        newMapField.Specific_Type,
                        newMapField.Is_Nullable,
                        newMapField.Max_Length,
                        newMapField.Precision,
                        newMapField.Scale,
                        newMapField.PrimaryKey_Order,
                        newMapField.Direction);
                    try
                    {
                        var relations = newMapField.GetTBL_RelationRows();

                        foreach (var newMapRelation in relations)
                        {
                            MapDataBase.TBL_Relation.AddTBL_RelationRow(field,
                                newMapRelation.Relation_Name,
                                newMapRelation.Table_Name,
                                newMapRelation.Column_Name);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.AppendLine(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.AppendLine(ex.Message);
            }

            // Restaurar filtros
            var filters = nOriginalTable.GetTBL_FilterRows();

            foreach (var nFilter in filters)
            {
                nFilter.Delete();
            }

            try
            {
                filters = newMapTable.GetTBL_FilterRows();

                foreach (var newMapFilter in filters)
                {
                    var nFilter = MapDataBase.TBL_Filter.AddTBL_FilterRow(nOriginalTable, newMapFilter.Name);

                    try
                    {
                        var filterFields = newMapFilter.GetTBL_Filter_FieldRows();

                        foreach (var newFilterField in filterFields)
                        {
                            MapDataBase.TBL_Filter_Field.AddTBL_Filter_FieldRow(nFilter,
                                newFilterField.Filter_Order,
                                newFilterField.Field_Name);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.AppendLine(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.AppendLine(ex.Message);
            }
        }
示例#4
0
        public List<Parameter> GetPrimaryKeys(XsdDataBase.TBL_ObjectRow table)
        {
            var param = new List<Parameter>();
            var fields = table.GetTBL_FieldRows();

            foreach (var field in fields)
            {
                //Si es una llave primaria y no es columna de una llave foranea
                if (field.PrimaryKey_Order != "")
                {
                    var direction = (ParameterDirection)(Enum.Parse(typeof(ParameterDirection), field.Direction));
                    var fType = (DbType)(Enum.Parse(typeof(DbType), field.Field_Type));

                    param.Add(new Parameter(field.Field_Name, fType, field.Specific_Type, null, field.Is_Nullable, field.Max_Length, field.Precision, field.Scale, direction));
                }
            }

            return param;
        }