Exemplo n.º 1
0
        private void ConvertFieldTableToMappings()
        {
            columnMapping = new List <ColumnConversionInfo>();

            foreach (DataRow row in dataDictionary.Rows)
            {
                if ((bool)row[0] == true)
                {
                    ColumnConversionInfo cci = new ColumnConversionInfo();
                    cci.SourceColumnName      = row["SourceColumnName"].ToString();
                    cci.DestinationColumnName = row["DestinationColumnName"].ToString();
                    cci.Prompt           = row["Prompt"].ToString();
                    cci.SourceColumnType = (DbType)row["SourceColumnType"];
                    switch (row["FieldType"].ToString())
                    {
                    case "Text":
                        cci.FieldType = MetaFieldType.Text;
                        break;

                    case "Multiline":
                        cci.FieldType = MetaFieldType.Multiline;
                        break;

                    case "Number":
                        cci.FieldType = MetaFieldType.Number;
                        break;

                    case "Checkbox":
                        cci.FieldType = MetaFieldType.Checkbox;
                        break;

                    case "YesNo":
                        cci.FieldType = MetaFieldType.YesNo;
                        break;

                    case "LegalValues":
                        cci.FieldType = MetaFieldType.LegalValues;
                        break;

                    case "Date":
                        cci.FieldType = MetaFieldType.Date;
                        break;

                    case "DateTime":
                        cci.FieldType = MetaFieldType.DateTime;
                        break;

                    case "Time":
                        cci.FieldType = MetaFieldType.Time;
                        break;

                    default:
                        throw new ApplicationException("Invalid field type");
                    }
                    cci.PageNumber               = (int)row["PageNumber"];
                    cci.TabIndex                 = (int)row["TabIndex"];
                    cci.IsTabStop                = (bool)row["IsTabStop"];
                    cci.IsReadOnly               = (bool)row["IsReadOnly"];
                    cci.IsRequired               = (bool)row["IsRequired"];
                    cci.IsRepeatLast             = (bool)row["IsRepeatLast"];
                    cci.HasRange                 = (bool)row["HasRange"];
                    cci.LowerBound               = row["LowerBound"].ToString();
                    cci.UpperBound               = row["UpperBound"].ToString();
                    cci.ListSourceTableName      = row["ListSourceTableName"].ToString();
                    cci.ListSourceTextColumnName = row["ListSourceTextColumnName"].ToString();
                    if (row["ListSourceTable"] != null && row["ListSourceTable"] != DBNull.Value)
                    {
                        cci.ListSourceTable = (DataTable)row["ListSourceTable"];
                    }
                    if (row["ControlFont"] != null && row["ControlFont"] != DBNull.Value)
                    {
                        cci.ControlFont = (Font)row["ControlFont"];
                    }
                    if (row["PromptFont"] != null && row["PromptFont"] != DBNull.Value)
                    {
                        cci.PromptFont = (Font)row["PromptFont"];
                    }
                    cci.ControlLeftPosition = (double)row["ControlLeftPosition"];
                    cci.ControlTopPosition  = (double)row["ControlTopPosition"];
                    cci.PromptLeftPosition  = (double)row["PromptLeftPosition"];
                    cci.PromptTopPosition   = (double)row["PromptTopPosition"];
                    columnMapping.Add(cci);
                }
            }
        }
Exemplo n.º 2
0
        private void ConvertFieldTableToMappings()
        {
            columnMapping = new List<ColumnConversionInfo>();

            foreach (DataRow row in dataDictionary.Rows)
            {
                if ((bool)row[0] == true)
                {
                    ColumnConversionInfo cci = new ColumnConversionInfo();
                    cci.SourceColumnName = row["SourceColumnName"].ToString();
                    cci.DestinationColumnName = row["DestinationColumnName"].ToString();
                    cci.Prompt = row["Prompt"].ToString();
                    cci.SourceColumnType = (DbType)row["SourceColumnType"];
                    switch (row["FieldType"].ToString())
                    {
                        case "Text":
                            cci.FieldType = MetaFieldType.Text;
                            break;
                        case "Multiline":
                            cci.FieldType = MetaFieldType.Multiline;
                            break;
                        case "Number":
                            cci.FieldType = MetaFieldType.Number;
                            break;
                        case "Checkbox":
                            cci.FieldType = MetaFieldType.Checkbox;
                            break;
                        case "YesNo":
                            cci.FieldType = MetaFieldType.YesNo;
                            break;
                        case "LegalValues":
                            cci.FieldType = MetaFieldType.LegalValues;
                            break;
                        case "Date":
                            cci.FieldType = MetaFieldType.Date;
                            break;
                        case "DateTime":
                            cci.FieldType = MetaFieldType.DateTime;
                            break;
                        case "Time":
                            cci.FieldType = MetaFieldType.Time;
                            break;
                        default:
                            throw new ApplicationException("Invalid field type");
                    }
                    cci.PageNumber = (int)row["PageNumber"];
                    cci.TabIndex = (int)row["TabIndex"];
                    cci.IsTabStop = (bool)row["IsTabStop"];
                    cci.IsReadOnly = (bool)row["IsReadOnly"];
                    cci.IsRequired = (bool)row["IsRequired"];
                    cci.IsRepeatLast = (bool)row["IsRepeatLast"];
                    cci.HasRange = (bool)row["HasRange"];
                    cci.LowerBound = row["LowerBound"].ToString();
                    cci.UpperBound = row["UpperBound"].ToString();
                    cci.ListSourceTableName = row["ListSourceTableName"].ToString();
                    cci.ListSourceTextColumnName = row["ListSourceTextColumnName"].ToString();
                    if (row["ListSourceTable"] != null && row["ListSourceTable"] != DBNull.Value)
                    {
                        cci.ListSourceTable = (DataTable)row["ListSourceTable"];
                    }
                    if (row["ControlFont"] != null && row["ControlFont"] != DBNull.Value)
                    {
                        cci.ControlFont = (Font)row["ControlFont"];
                    }
                    if (row["PromptFont"] != null && row["PromptFont"] != DBNull.Value)
                    {
                        cci.PromptFont = (Font)row["PromptFont"];
                    }
                    cci.ControlLeftPosition = (double)row["ControlLeftPosition"];
                    cci.ControlTopPosition = (double)row["ControlTopPosition"];
                    cci.PromptLeftPosition = (double)row["PromptLeftPosition"];
                    cci.PromptTopPosition = (double)row["PromptTopPosition"];
                    columnMapping.Add(cci);
                }
            }
        }