예제 #1
0
        public async Task <int> AddLibraryAGSData(IAGSGroupTables tables, Guid?LibraryAGSDataId)
        {
            if (LibraryAGSDataId != null)
            {
                await SetLibraryAGSData(LibraryAGSDataId.Value);
            }

            if (_library == null)
            {
                return(-1);
            }

            AGS404GroupTables ags404_lib = (AGS404GroupTables)_library;
            AGS404GroupTables _tables    = (AGS404GroupTables)tables;

            // ABBR

            if (_tables.ABBR != null)
            {
                foreach (ABBR abbr in _tables.ABBR.values)
                {
                    ABBR abbr_lib = ags404_lib.ABBR.values.Find(e => e.ABBR_CODE == abbr.ABBR_CODE &&
                                                                e.ABBR_HDNG == abbr.ABBR_HDNG);
                    if (abbr_lib != null)
                    {
                        abbr.ABBR_DESC = abbr_lib.ABBR_DESC;
                        abbr.ABBR_REM  = abbr_lib.ABBR_REM;
                    }
                }
            }

            if (_tables.UNIT != null)
            {
                foreach (UNIT unit in _tables.UNIT.values)
                {
                    UNIT unit_lib = ags404_lib.UNIT.values.Find(e => e.UNIT_UNIT == unit.UNIT_UNIT);
                    if (unit_lib != null)
                    {
                        unit.UNIT_DESC = unit_lib.UNIT_DESC;
                        unit.UNIT_REM  = unit_lib.UNIT_REM;
                    }
                }
            }

            if (_tables.TYPE != null)
            {
                foreach (TYPE type in _tables.TYPE.values)
                {
                    TYPE type_lib = ags404_lib.TYPE.values.Find(e => e.TYPE_TYPE == type.TYPE_TYPE);
                    if (type_lib != null)
                    {
                        type.TYPE_DESC = type_lib.TYPE_DESC;
                        //    type.TYPE_REM = type_lib.TYPE_REM;
                    }
                }
            }

            if (_tables.DICT != null)
            {
                foreach (DICT dict in _tables.DICT.values)
                {
                    DICT dict_lib = ags404_lib.DICT.values.Find(e => e.DICT_HDNG == dict.DICT_HDNG &&
                                                                e.DICT_PGRP == dict.DICT_PGRP);
                    if (dict_lib != null)
                    {
                        dict.DICT_DESC = dict_lib.DICT_DESC;
                        dict.DICT_DTYP = dict_lib.DICT_DTYP;
                        dict.DICT_EXMP = dict_lib.DICT_EXMP;
                        dict.DICT_REM  = dict_lib.DICT_REM;
                    }
                }
            }

            return(1);
        }
예제 #2
0
        public IAGSGroupTables CreateAGS(ge_data_table dt_file, ge_table_map map, string[] agstables, string options)
        {
            IAGSGroupTables ags_tables = new AGS404GroupTables();

            if (agstables.Contains("PROJ"))
            {
                List <PROJ> proj = getPROJ();
                ags_tables.AddTable(proj);
            }

            if (agstables.Contains("ERES"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "ERES"))
                {
                    if (tm != null)
                    {
                        List <ERES> list = ConvertDataTable <ERES>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                        if (agstables.Contains("ABBR"))
                        {
                            List <ABBR> abbr = getABBR(list);
                            ags_tables.AddTable(abbr);
                        }
                        if (agstables.Contains("UNIT"))
                        {
                            List <UNIT> unit = getUNIT(list);
                            ags_tables.AddTable(unit);
                        }
                    }
                }
            }

            if (agstables.Contains("TRAN"))
            {
                List <TRAN> tran = getTRAN();
                ags_tables.AddTable(tran);
            }

            if (agstables.Contains("POINT"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "LOCA"))
                {
                    List <POINT> list     = ConvertDataTable <POINT>(dt_file.dt, tm);
                    string[]     distinct = list.Select(m => m.PointID).Distinct().ToArray();
                    List <POINT> unique   = getFirsts(list, distinct);
                    ags_tables.AddTable(unique);
                    if (agstables.Contains("ABBR"))
                    {
                        List <ABBR> abbr = getABBR(list);
                        ags_tables.AddTable(abbr);
                    }
                }
            }

            if (agstables.Contains("SAMP"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "SAMP"))
                {
                    List <SAMP> list     = ConvertDataTable <SAMP>(dt_file.dt, tm);
                    string[]    distinct = list.Select(m => m.SAMP_ID).Distinct().ToArray();
                    List <SAMP> unique   = getFirsts(list, distinct);
                    ags_tables.AddTable(unique);
                }
            }

            if (agstables.Contains("MOND"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "MOND"))
                {
                    if (tm != null)
                    {
                        List <MOND> list = ConvertDataTable <MOND>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                        if (agstables.Contains("ABBR"))
                        {
                            List <ABBR> abbr = getABBR(list);
                            ags_tables.AddTable(abbr);
                        }
                        if (agstables.Contains("UNIT"))
                        {
                            List <UNIT> unit = getUNIT(list);
                            ags_tables.AddTable(unit);
                        }
                    }
                }
            }

            if (agstables.Contains("MONG"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "MONG"))
                {
                    if (tm != null)
                    {
                        List <MONG> list = ConvertDataTable <MONG>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                        if (agstables.Contains("ABBR"))
                        {
                            List <ABBR> abbr = getABBR(list);
                            ags_tables.AddTable(abbr);
                        }
                    }
                }
            }

            if (agstables.Contains("ABBR"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "ABBR"))
                {
                    if (tm != null)
                    {
                        List <ABBR> list = ConvertDataTable <ABBR>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                    }
                }
            }

            if (agstables.Contains("UNIT"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "UNIT"))
                {
                    if (tm != null)
                    {
                        List <UNIT> list = ConvertDataTable <UNIT>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                    }
                }
            }

            if (agstables.Contains("TYPE"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "TYPE"))
                {
                    if (tm != null)
                    {
                        List <TYPE> list = ConvertDataTable <TYPE>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                    }
                }
            }

            if (agstables.Contains("DICT"))
            {
                foreach (table_map tm in map.table_maps.Where(m => m.destination == "DICT"))
                {
                    if (tm != null)
                    {
                        List <DICT> list = ConvertDataTable <DICT>(dt_file.dt, tm);
                        ags_tables.AddTable(list);
                    }
                }
            }

            return(ags_tables);
        }