Exemplo n.º 1
0
        public void SetDataSource(XsdDataBaseDesign nDtsDataBase, int nId_Object)
        {
            try
            {
                _Id_Object = nId_Object;
                _DtsDataBase = nDtsDataBase;

                var rowObject = nDtsDataBase.TBL_Object.FindByid_Object(nId_Object);
                CatalogNameTextBox.Text = rowObject.Catalog_Name;
                ObjectTypeTextBox.Text = rowObject.Generic_Type;
                SchemaNameTextBox.Text = rowObject.Schema_Name;
                ObjectNameTextBox.Text = rowObject.Object_Name;

                var fieldRows =
                    (CMData.Schemas.XsdDataBase.TBL_FieldRow[])(nDtsDataBase.TBL_Field.Select("fk_Object = " + nId_Object));

                // Agregar los filtros
                var filterRows = rowObject.GetTBL_FilterRows();
                foreach (var filterRow in filterRows)
                {
                    var newMapFilter = dtsMap.TBL_Map_Filter.AddTBL_Map_FilterRow(filterRow.id_Filter,
                                                                                  filterRow.fk_Object,
                                                                                  "Find_" + _FindNumber);
                    _FindNumber += 1;

                    // Agregar los campos incluyendo los previamente mapeados
                    foreach (var f in fieldRows)
                    {
                        // Buscar si ya existe el campo mapeado
                        var filterField =
                            ((CMData.Schemas.XsdDataBase.TBL_Filter_FieldRow[])
                             (nDtsDataBase.TBL_Filter_Field.Select("fk_Filter = " + filterRow.id_Filter +
                                                                   " AND Field_Name = '" + f.Field_Name + "'")));

                        // Agregar la columna para mapear
                        var newMapFilterColumn = dtsMap.TBL_Map_Filter_Column.NewTBL_Map_Filter_ColumnRow();

                        newMapFilterColumn.fk_Map_Filter = newMapFilter.id_Map_Filter;
                        newMapFilterColumn.fk_Object = f.fk_Object;
                        newMapFilterColumn.Field_Name = f.Field_Name;
                        newMapFilterColumn.Field_Type = f.Field_Type;
                        newMapFilterColumn.Specific_Type = f.Specific_Type;
                        newMapFilterColumn.Is_Nullable = f.Is_Nullable;
                        newMapFilterColumn.Max_Length = f.Max_Length;
                        newMapFilterColumn.Precision = f.Precision;
                        newMapFilterColumn.Scale = f.Scale;
                        newMapFilterColumn.PrimaryKey_Order = f.PrimaryKey_Order;

                        if (filterField.Length > 0)
                        {
                            newMapFilterColumn.Filter_Order = filterField[0].Filter_Order;
                            newMapFilterColumn.Selected = true;
                        }
                        else
                        {
                            newMapFilterColumn.Filter_Order = 100;
                            newMapFilterColumn.Selected = false;
                        }

                        dtsMap.TBL_Map_Filter_Column.AddTBL_Map_Filter_ColumnRow(newMapFilterColumn);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al enlazar los datos, " + ex.Message, Program.AssemblyTitle, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 public void SetDataSource(XsdDataBaseDesign nDataBase, CMData.Schemas.XsdDataBase.TBL_ConnectionRow nSelectedConnection, CMData.Schemas.XsdDataBase.TBL_ObjectRow nSelectedObject)
 {
     _dtsDataBase = nDataBase;
     _selectedConnection = nSelectedConnection;
     _selectedObject = nSelectedObject;
 }