Exemplo n.º 1
0
        private void form_DeleteInputColumn(object sender, SetInputColumnArgs args)
        {
            Debug.Assert(args.VirtualColumn != null, "Invalid arguments passed from the UI");

            this.ClearErrors();
            try
            {
                // Grab the used input columns from the Component.
                IDTSInput input = this.ComponentMetadata.InputCollection[0];

                // Get the Virtual column from the args.
                IDTSVirtualInputColumn virtualInputColumn = args.VirtualColumn.Tag as IDTSVirtualInputColumn;
                if (virtualInputColumn == null)
                {
                    throw new ApplicationException(Properties.Resources.UIisInconsistentState);
                }

                // Get the lineageId, so we can use it to disable this column as an input column...
                int lineageId = virtualInputColumn.LineageID;

                this.DesigntimeComponent.SetUsageType(input.ID, this.VirtualInput, lineageId, DTSUsageType.UT_IGNORED);
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
                args.CancelAction = true;
            }
        }
Exemplo n.º 2
0
        private void form_SetInputColumn(object sender, SetInputColumnArgs args)
        {
            Debug.Assert(args.VirtualColumn != null, "Invalid arguments passed from the UI");

            this.ClearErrors();
            try
            {
                // Grab the used input collection.  This component can only have one...
                IDTSInput input = this.ComponentMetadata.InputCollection[0];

                // Get the virtual column from the args...
                IDTSVirtualInputColumn virtualInputColumn = args.VirtualColumn.Tag as IDTSVirtualInputColumn;
                if (virtualInputColumn == null)
                {
                    throw new ApplicationException(Properties.Resources.UIisInconsistentState);
                }
                // Get the lineageId, so we can use it to enable this column as an input column...
                int lineageId = virtualInputColumn.LineageID;

                IDTSInputColumn inputColumn = this.DesigntimeComponent.SetUsageType(input.ID, this.VirtualInput, lineageId, DTSUsageType.UT_READONLY);

                // return the new column back to the GUI to stick into a Tag...
                args.GeneratedColumns.InputColumn = new DataFlowElement(inputColumn.Name, inputColumn);
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
                args.CancelAction = true;
            }
        }
Exemplo n.º 3
0
        private void form_GetInputColumns(object sender, InputColumnsArgs args)
        {
            Debug.Assert(this.VirtualInput != null, "Virtual input is not valid.");

            this.ClearErrors();

            try
            {
                // Grab the virtual input collection, which has all the columns that are available to be selected
                IDTSVirtualInputColumnCollection virtualInputColumnCollection = this.VirtualInput.VirtualInputColumnCollection;
                int virtualInputColumnsCount = virtualInputColumnCollection.Count;

                // Allocate the array of columns
                args.InputColumns = new InputColumnElement[virtualInputColumnsCount];

                // populate the array with all the available input columns.
                for (int i = 0; i < virtualInputColumnsCount; i++)
                {
                    IDTSVirtualInputColumn virtualInputColumn = virtualInputColumnCollection[i];
                    args.InputColumns[i].Selected    = virtualInputColumn.UsageType != DTSUsageType.UT_IGNORED;
                    args.InputColumns[i].InputColumn = new DataFlowElement(virtualInputColumn.Name, virtualInputColumn);
                    args.InputColumns[i].LineageID   = virtualInputColumn.LineageID;
                }
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
            }
        }
        //Dissallow DT_NTEXT, DT_TEXT and DT_IMAGE data types.
        public override bool CheckColumnForInputValidity(IDTSVirtualInputColumn vInputColumn)
        {
            if (vInputColumn == null)
            {
                return(false);
            }
            else
            {
                var dt = vInputColumn.DataType;

                return(!HistoryLookupTransformation.UnsupportedInputTypes.Contains(dt));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets InputColumns of Input at selected inde of InputCollection encapsulated in the FormInputColumn class
        /// </summary>
        /// <param name="index">Index of the Input to get InputColumns</param>
        /// <returns>List of FormInputColumn</returns>
        public virtual List <FormInputColumn> GetFormInputColumns(int index)
        {
            List <FormInputColumn> inputCols = new List <FormInputColumn>();

            IDTSInput        input  = GetInput(index);
            IDTSVirtualInput vInput = GetVirtualInput(index);


            if (input != null && VirtualInput != null)
            {
                for (int i = 0; i < VirtualInput.VirtualInputColumnCollection.Count; i++)
                //foreach (IDTSVirtualInputColumn vcol in VirtualInput.VirtualInputColumnCollection)
                {
                    IDTSVirtualInputColumn vcol = VirtualInput.VirtualInputColumnCollection[i];

                    FormInputColumn icol = new FormInputColumn(vcol, i);

                    if (vcol.UsageType != DTSUsageType.UT_IGNORED)
                    {
                        IDTSInputColumn inputCol = input.InputColumnCollection.GetInputColumnByLineageID(vcol.LineageID);
                        icol.DTSInputColumn = inputCol;
                    }

                    bool isValidForInput = CheckColumnForInputValidity(vInput, input, icol);

                    if (isValidForInput)
                    {
                        inputCols.Add(icol);
                    }
                }

                inputCols.Sort((a, b) => a.Name.CompareTo(b.Name));


                for (int i = 0; i < inputCols.Count; i++)
                {
                    if (i >= 0 && i < inputCols.Count - 1 && inputCols[i].Name == inputCols[i + 1].Name)
                    {
                        inputCols[i].DisplayName = string.Format("{0}.{1}", inputCols[i].SourceComponent, inputCols[i].Name);
                    }
                    else if (i > 0 && i < inputCols.Count && inputCols[i].Name == inputCols[i - 1].Name)
                    {
                        inputCols[i].DisplayName = string.Format("{0}.{1}", inputCols[i].SourceComponent, inputCols[i].Name);
                    }
                }

                inputCols.Sort((a, b) => a.Index.CompareTo(b.Index));
            }

            return(inputCols);
        }
Exemplo n.º 6
0
        public Lookup AddLookupColumn(LookupColumn lookupItem)
        {
            Refresh();
            if (!lookupItem.IsReplacingOutput)
            {
                Pipe.IDTSOutputColumn100 newColumn = ComponentWrapper.InsertOutputColumnAt(SSISDefaultOutput.ID, 0, lookupItem.OutputAlias, "");
                ComponentWrapper.SetOutputColumnProperty(SSISDefaultOutput.ID, newColumn.ID, "CopyFromReferenceColumn", lookupItem.Name);
            }
            else
            {
                Pipe.IDTSVirtualInputColumn100 virtualColumn = base.FindVirtualInputColumn(lookupItem.ReplaceColumnName);
                Pipe.IDTSInputColumn100        inputColumn   = ComponentWrapper.SetUsageType(SSISDefaultInput.ID, base.DefaultVirtualInput, virtualColumn.LineageID, Pipe.DTSUsageType.UT_READWRITE);
                ComponentWrapper.SetInputColumnProperty(SSISDefaultInput.ID, inputColumn.ID, "CopyFromReferenceColumn", lookupItem.Name);
            }

            return(this);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Called repeatedly when the component is edited in the designer, and once at the beginning of execution.
        /// Verifies the following:
        /// 1. Check that there are no outputs
        /// 2. Check that there is only one input
        /// 3. Check that all upstream columns are present.
        /// </summary>
        /// <returns>The status of the validation</returns>
        public override DTSValidationStatus Validate()
        {
            bool cancel = false;

            if (ComponentMetaData.InputCollection.Count != 1)
            {
                ComponentMetaData.FireError(0, ComponentMetaData.Name, "The input collection count is not 1.", String.Empty, 0, out cancel);
                return(DTSValidationStatus.VS_ISCORRUPT);
            }

            if (ComponentMetaData.OutputCollection.Count != 0)
            {
                ComponentMetaData.FireError(0, ComponentMetaData.Name, "The output collection count is not 0.", String.Empty, 0, out cancel);
                return(DTSValidationStatus.VS_ISCORRUPT);
            }

            IDTSInput        input  = ComponentMetaData.InputCollection[0];
            IDTSVirtualInput vInput = input.GetVirtualInput();

            if (input.HasSideEffects == false)
            {
                ComponentMetaData.FireError(0, ComponentMetaData.Name, "The input does not have HasSideEffects set.", String.Empty, 0, out cancel);
                return(DTSValidationStatus.VS_ISCORRUPT);
            }

            foreach (IDTSInputColumn inputColumn in input.InputColumnCollection)
            {
                try
                {
                    IDTSVirtualInputColumn vColumn = vInput.VirtualInputColumnCollection.GetVirtualInputColumnByLineageID(inputColumn.LineageID);
                }
                catch
                {
                    ComponentMetaData.FireError(0, ComponentMetaData.Name, "The input column " + inputColumn.IdentificationString + " does not match a column in the upstream output.", String.Empty, 0, out cancel);
                    areInputColumnsValid = false;
                    return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
                }
            }
            //return base.Validate();
            return(DTSValidationStatus.VS_ISVALID);
        }
Exemplo n.º 8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (properties.NullColumnLineageId != -1)
            {
                IDTSInput              input  = UIHelper.GetInput(0);
                IDTSVirtualInput       vInput = UIHelper.GetVirtualInput(0);
                IDTSVirtualInputColumn vCol   = vInput.VirtualInputColumnCollection.GetVirtualInputColumnByLineageID(properties.NullColumnLineageId);;
                IDTSInputColumn        col;
                if (vCol.UsageType != DTSUsageType.UT_IGNORED)
                {
                    col = input.InputColumnCollection.GetInputColumnByLineageID(vCol.LineageID);
                }
                else
                {
                    col = UIHelper.DesignTimeComponent.SetUsageType(input.ID, vInput, properties.NullColumnLineageId, DTSUsageType.UT_READONLY);
                }

                IDTSCustomProperty nullCol = col.CustomPropertyCollection[Resources.LookupErrorAggIsNullColumnName];
                nullCol.Value = true;
            }
            this.Close();
        }
Exemplo n.º 9
0
 public virtual bool CheckColumnForInputValidity(IDTSVirtualInputColumn vInputColumn)
 {
     return(true);
 }
Exemplo n.º 10
0
 public FormInputColumn(IDTSVirtualInputColumn vcol, int index)
 {
     DTSVirtualColumn = vcol;
     displayName      = vcol.Name;
     Index            = index;
 }
Exemplo n.º 11
0
 private void MapInputColumn(Pipe.IDTSVirtualInputColumn100 virtualColumn, string destinationColumnName)
 {
     Pipe.IDTSInputColumn100 inputColumn = ComponentWrapper.SetUsageType(SSISDefaultInput.ID, DefaultVirtualInput, virtualColumn.LineageID, Pipe.DTSUsageType.UT_READONLY);
     ComponentWrapper.MapInputColumn(SSISDefaultInput.ID, inputColumn.ID, SSISDefaultInput.ExternalMetadataColumnCollection[destinationColumnName].ID);
 }
 public OutputColumnDetail(IDTSVirtualInputColumn virtualInputColumn, string aliasName, int id)
 {
     VirtualInputColumn = virtualInputColumn;
     AliasName          = aliasName;
     ID = id;
 }