コード例 #1
0
        /// <summary>
        /// Restores join on loading or after saving
        /// </summary>
        /// <param name="filename">Filename of the datasource to join</param>
        /// <param name="fieldList">Csv list of fields</param>
        /// <param name="joinOptions">Provider specific options</param>
        /// <param name="joinSource">At table to be filled to data source and passed to the ocx</param>
        public static void Table_OnUpdateJoin(string filename, string fieldList, string joinOptions, Table joinSource)
        {
            DataTable dt;

            filename = filename.ToLower();
            if (filename.EndsWith(".xls") || filename.EndsWith(".xlsx"))
            {
                dt = XlsImportHelper.GetData(filename, GetOption("workbook", joinOptions));
            }
            else if (filename.EndsWith(".csv"))
            {
                dt = CsvImportHelper.GetData(filename, GetOption("separator", joinOptions));
            }
            else
            {
                return;
            }

            DbfImportHelper.FillMapWinGisTable(dt, joinSource);
        }
コード例 #2
0
        private bool ReloadExternal(IAttributeTable table)
        {
            switch (SourceType)
            {
            case JoinSourceType.Dbf:
                if (!table.Open(Filename))
                {
                    return(false);
                }
                break;

            case JoinSourceType.Xls:
            {
                var dt = XlsImportHelper.GetData(Filename, SelectedOption);
                if (dt == null)
                {
                    return(false);
                }
                DbfImportHelper.FillMapWinGisTable(dt, table);
            }
            break;

            case JoinSourceType.Csv:
            {
                var dt = CsvImportHelper.GetData(Filename, SelectedOption);
                if (dt == null)
                {
                    return(false);
                }
                DbfImportHelper.FillMapWinGisTable(dt, table);
            }
            break;

            default:
                return(false);
            }

            return(true);
        }