/// <summary>
        /// Check for if all the column names specified in the column list is valid Or not.
        /// </summary>
        /// <returns></returns>
        private bool AreSourceColumnsValid()
        {
            bool isValidColumn = false;

            string[] fieldNamesList = dataViewOutputCommand.TaskVarNames.Split(',');
            com.magicsoftware.unipaas.management.data.FieldsTable sourceFieldsTable = currTask.DataView.GetFieldsTab();
            foreach (string fieldName in fieldNamesList)
            {
                isValidColumn = false;
                for (int fldIndex = 0; fldIndex < sourceFieldsTable.getSize(); fldIndex++)
                {
                    if (fieldName == sourceFieldsTable.getField(fldIndex).getVarName())
                    {
                        isValidColumn = true;
                        break;
                    }
                }

                if (!isValidColumn)
                {
                    string error = string.Format("DataViewToDataSource - Illegal source columns specified : {0}", fieldName);
                    Logger.Instance.WriteErrorToLog(error);
                    ClientManager.Instance.ErrorToBeWrittenInServerLog = error;
                    break;
                }
            }

            return(isValidColumn);
        }
Exemple #2
0
        /// <summary>
        /// Prepare mapping of Destination field to Source Field.
        /// For that maintain a dictionary with key as destination field name and
        /// value as index of the source field in the FieldsTable.
        /// </summary>
        /// <param name="record"></param>
        private void PrepareDestinationToSourceFieldIndexMapping(List <FieldDef> sourceVarList)
        {
            FieldsTable fieldsTab        = ((DataView)task.DataView).GetFieldsTab();
            int         sourceFieldIndex = 0;

            foreach (DBField dbfield in destinationColumnList)
            {
                FieldDef field = sourceVarList[sourceFieldIndex++];

                for (int fieldIndex = 0; fieldIndex < fieldsTab.getSize(); fieldIndex++)
                {
                    if (field.getVarName() == fieldsTab.getField(fieldIndex).getVarName())
                    {
                        destinationToSourceFieldIndexMapping.Add(dbfield.Name, fieldIndex);
                        break;
                    }
                }
            }
        }