Beispiel #1
0
        private int readGroup(string[] lines, List <ABBR> list)
        {
            int group_start = find_line(lines, "\"GROUP\",\"ABBR\"");

            if (group_start == NOT_FOUND)
            {
                return(-1);
            }

            string[] header = lines[group_start + 1].QuoteSplit();
            string[] units  = lines[group_start + 2].QuoteSplit();
            string[] type   = lines[group_start + 3].QuoteSplit();

            for (int i = group_start + 4; i < lines.Count(); i++)
            {
                string line = lines[i];
                if (line.Length == 0)
                {
                    return(i);
                }
                string[] values = line.QuoteSplit();
                ABBR     p      = new ABBR();
                setValues(header, values, p);
                list.Add(p);
            }
            return(0);
        }
        private List <ABBR> getABBR(List <POINT> list)
        {
            string[] loca_types = list.Select(m => m.LOCA_TYPE).Distinct().ToArray();

            List <ABBR> abbr = new List <ABBR>();

            foreach (string s in loca_types)
            {
                ABBR ab = new ABBR();
                ab.ABBR_HDNG = "LOCA_TYPE";
                ab.ABBR_CODE = s;
                ab.ABBR_DESC = "";
                abbr.Add(ab);
            }

            return(abbr);
        }
        private List <ABBR> getABBR(List <MOND> list)
        {
            string[] mond_types = list.Select(m => m.MOND_TYPE).Distinct().ToArray();

            List <ABBR> abbr = new List <ABBR>();

            foreach (string s in mond_types)
            {
                ABBR ab = new ABBR();
                ab.ABBR_HDNG = "MOND_TYPE";
                ab.ABBR_CODE = s;
                ab.ABBR_DESC = "";
                abbr.Add(ab);
            }

            return(abbr);
        }
        private List <ABBR> getABBR(List <ERES> list)
        {
            //Abbreviations ERES_CODE
            string[] eres_codes = list.Select(m => m.ItemKey).Distinct().ToArray();

            List <ERES> eres_codesList = new List <ERES>();

            foreach (string s in eres_codes)
            {
                ERES first = list.Where(el => el.ItemKey == s).First();
                eres_codesList.Add(first);
            }

            List <ABBR> abbr = new List <ABBR>();

            foreach (ERES eres in eres_codesList)
            {
                ABBR ab = new ABBR();
                ab.ABBR_HDNG = "ERES_CODE";
                ab.ABBR_CODE = eres.ItemKey;
                ab.ABBR_DESC = eres.ERES_NAME;
                abbr.Add(ab);
            }

            // Abbreviations ERES_MATX
            string[] eres_matx = list.Select(m => m.ERES_MATX).Distinct().ToArray();
            foreach (string s in eres_matx)
            {
                ABBR ab = new ABBR();
                ab.ABBR_HDNG = "ERES_MATX";
                ab.ABBR_CODE = s;
                ab.ABBR_DESC = "";
                abbr.Add(ab);
            }

            return(abbr);
        }
Beispiel #5
0
        private int setValues(string[] header, string[] values, ABBR p)
        {
            try {
                for (int i = 0; i < header.Count(); i++)
                {
                    if (header[i] == "ABBR_CODE")
                    {
                        p.ABBR_CODE = values[i];
                    }
                    if (header[i] == "ABBR_DESC")
                    {
                        p.ABBR_DESC = values[i];
                    }
                    if (header[i] == "ABBR_HDNG")
                    {
                        p.ABBR_HDNG = values[i];
                    }
                    if (header[i] == "ABBR_LIST")
                    {
                        p.ABBR_LIST = values[i];
                    }
                    if (header[i] == "ABBR_REM")
                    {
                        p.ABBR_REM = values[i];
                    }
                    if (header[i] == "FILE_FSET")
                    {
                        p.FILE_FSET = values[i];
                    }
                }
            } catch {
                return(-1);
            }

            return(0);
        }
Beispiel #6
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);
        }