public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject)
        {
            var myRäl = (BIS_Räl)bisObject;

            switch (index)
            {
            case 0:
                myRäl.ObjektTypNummer = attributeValue;
                break;

            case 1:
                myRäl.ObjektNummer = attributeValue;
                break;

            case 28:
                myRäl.SidaHVB = attributeValue;
                break;

            case 29:
                myRäl.Rälmodell = attributeValue;
                break;

            case 30:
                myRäl.Vikt = attributeValue;
                break;

            case 31:
                myRäl.Längd = attributeValue;
                break;

            case 32:
                myRäl.Skarvtyp = attributeValue;
                break;

            case 33:
                myRäl.Inläggningsår = attributeValue;
                break;

            case 34:
                myRäl.Tillverkngingsår = attributeValue;
                break;

            case 35:
                myRäl.Rev_Klass = attributeValue;
                break;

            case 36:
                myRäl.Tillverkare = attributeValue;
                break;

            case 37:
                myRäl.Stålsort = attributeValue;
                break;

            case 38:
                myRäl.Tillv_Process = attributeValue;
                break;

            case 39:
                myRäl.Notering = attributeValue;
                break;

            case 40:
                myRäl.Senast_Ändrad = attributeValue;
                break;

            case 41:
                myRäl.Senast_Ändrad_Av = attributeValue;
                break;
            }
            return(myRäl);
        }
Beispiel #2
0
        public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject)
        {
            var mySpårspärr = (BIS_SpårSpärr)bisObject;

            switch (index)
            {
            case 0:
                mySpårspärr.ObjektTypNummer = attributeValue;
                break;

            case 1:
                mySpårspärr.ObjektNummer = attributeValue;
                break;

            case 29:
                mySpårspärr.SpårspärrNummer = attributeValue;
                break;

            case 30:
                mySpårspärr.Modell = attributeValue;
                break;

            case 31:
                mySpårspärr.Besiktningsklass = attributeValue;
                break;

            case 32:
                mySpårspärr.Senast_Ändrad = attributeValue;
                break;

            case 33:
                mySpårspärr.Senast_Ändrad_Av = attributeValue;
                break;

            case 34:
                mySpårspärr.TLSUrsprung = attributeValue;
                break;

            case 35:
                mySpårspärr.Terminal = attributeValue;
                break;

            case 36:
                mySpårspärr.TLSId = attributeValue;
                break;

            case 37:
                mySpårspärr.TLSBeteckning = attributeValue;
                break;

            case 38:
                mySpårspärr.TLSTyp = attributeValue;
                break;

            case 39:
                mySpårspärr.CentralOmläggningsbar = attributeValue;
                break;

            case 40:
                mySpårspärr.GårAttSpärraIStällv = attributeValue;
                break;

            case 41:
                mySpårspärr.LokalfrigivBarIndivid = attributeValue;
                break;

            case 42:
                mySpårspärr.Återgående = attributeValue;
                break;

            case 43:
                mySpårspärr.FördFörÅtergång = attributeValue;
                break;

            //44 Not used
            case 45:
                mySpårspärr.Notering = attributeValue;
                break;

            case 46:
                mySpårspärr.Nivå = attributeValue;
                break;

            case 47:
                mySpårspärr.Komponent = attributeValue;
                break;

            case 48:
                mySpårspärr.Position = attributeValue;
                break;

            case 49:
                mySpårspärr.ModellDefinition = attributeValue;
                break;

            case 50:
                mySpårspärr.Artnr = attributeValue;
                break;

            case 51:
                mySpårspärr.Inldat = attributeValue;
                break;
            }

            return(mySpårspärr);
        }
Beispiel #3
0
 public abstract BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject);
Beispiel #4
0
        public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject)
        {
            var myTåg = (BIS_TågOchLokvärmeanläggning)bisObject;

            switch (index)
            {
            case 0:
                myTåg.ObjektTypNummer = attributeValue;
                break;

            case 1:
                myTåg.ObjektNummer = attributeValue;
                break;

            case 29:
                myTåg.Typ = attributeValue;
                break;

            case 30:
                myTåg.TransformatorEffekt = attributeValue;
                break;

            case 33:
                myTåg.TransformatorBrytareTyp = attributeValue;
                break;

            case 35:
                myTåg.Senast_Ändrad = attributeValue;
                break;

            case 36:
                myTåg.Senast_Ändrad_Av = attributeValue;
                break;

            case 37:
                myTåg.Notering = attributeValue;
                break;
            }
            return(myTåg);
        }
        public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject)
        {
            var myKanalisation = (BIS_Kanalisation)bisObject;

            switch (index)
            {
            case 0:
                myKanalisation.ObjektTypNummer = attributeValue;
                break;

            case 1:
                myKanalisation.ObjektNummer = attributeValue;
                break;

            case 30:
                myKanalisation.Typ = attributeValue;
                break;

            case 31:
                myKanalisation.MaterialKanalisation = attributeValue;
                break;

            case 32:
                myKanalisation.MaterialLock = attributeValue;
                break;

            case 33:
                myKanalisation.DiameterBrunnRör = attributeValue;
                break;

            case 34:
                myKanalisation.BreddRänna = attributeValue;
                break;

            case 35:
                myKanalisation.AntalRör = attributeValue;
                break;

            case 37:
                myKanalisation.Senast_Ändrad = attributeValue;
                break;

            case 38:
                myKanalisation.Senast_Ändrad_Av = attributeValue;
                break;

            case 39:
                myKanalisation.Notering = attributeValue;
                break;
            }

            return(myKanalisation);
        }
Beispiel #6
0
        public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject)
        {
            var myTrumma = (BIS_Trumma)bisObject;

            switch (index)
            {
            case 0:
                myTrumma.ObjektTypNummer = attributeValue;
                break;

            case 1:
                myTrumma.ObjektNummer = attributeValue;
                break;

            case 29:
                myTrumma.UrsprungligtMaterial = attributeValue;
                break;

            case 30:
                myTrumma.Antalvattengångar = attributeValue;
                break;

            case 31:
                myTrumma.Ursprungligtyp = attributeValue;
                break;

            case 32:
                myTrumma.Infodring = attributeValue;
                break;

            case 33:
                myTrumma.DiamRörinfodring = attributeValue;
                break;

            case 34:
                myTrumma.FaunaTrumma = attributeValue;
                break;

            case 35:
                myTrumma.Bredd = attributeValue;
                break;

            case 36:
                myTrumma.Höjd = attributeValue;
                break;

            case 37:
                myTrumma.Diameter = attributeValue;
                break;

            case 38:
                myTrumma.Längd = attributeValue;
                break;

            case 39:
                myTrumma.FyllnadsHöjdDuruk = attributeValue;
                break;

            case 40:
                myTrumma.SläntlutningÖverstigande1_1_5 = attributeValue;
                break;

            case 41:
                myTrumma.ByggnadsÅr = attributeValue;
                break;

            case 42:
                myTrumma.MaterialFörlängningVänsterSida = attributeValue;
                break;

            case 43:
                myTrumma.MaterialFörlängningHögerSida = attributeValue;
                break;

            case 44:
                myTrumma.TypFörlängningVänsterSida = attributeValue;
                break;

            case 45:
                myTrumma.TypFörlängningHögerSida = attributeValue;
                break;

            case 46:
                myTrumma.DiameterFörlängningVänsterSida = attributeValue;
                break;

            case 47:
                myTrumma.DiameterFörlängningHögerSida = attributeValue;
                break;

            case 48:
                myTrumma.LängdFörlängningVänsterSida = attributeValue;
                break;

            case 49:
                myTrumma.LängdFörlängningHögerSida = attributeValue;
                break;

            //Case 50 är besiktningsklass, används inte
            case 51:
                myTrumma.Senast_Ändrad = attributeValue;
                break;

            case 52:
                myTrumma.Senast_Ändrad_Av = attributeValue;
                break;

            case 53:
                myTrumma.Notering = attributeValue;
                break;
            }
            return(myTrumma);
        }
        public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObject)
        {
            var mySkarv = (BIS_Skarv)bisObject;

            switch (index)
            {
            case 0:
                mySkarv.ObjektTypNummer = attributeValue;
                break;

            case 1:
                mySkarv.ObjektNummer = attributeValue;
                break;

            case 28:
                mySkarv.Skarvmodell = attributeValue;
                break;

            case 29:
                mySkarv.Dil_Skarv_serienr = attributeValue;
                break;

            case 30:
                mySkarv.Skarv_Tillv_år = attributeValue;
                break;

            case 32:
                mySkarv.isolerskarv_Passräl_längd = attributeValue;
                break;

            case 33:
                mySkarv.isolskarv_Hårdgjord = attributeValue;
                break;

            case 34:
                mySkarv.Isolskarv_DriftTillstånd = attributeValue;
                break;

            case 35:
                mySkarv.Besiktningsklass = attributeValue;
                break;

            case 36:
                mySkarv.Senast_ändrad = attributeValue;
                break;

            case 37:
                mySkarv.Senast_ändrad_av = attributeValue;
                break;

            case 38:
                mySkarv.Notering = attributeValue;
                break;

            case 39:
                mySkarv.Nivå = attributeValue;
                break;

            case 40:
                mySkarv.Komponent = attributeValue;
                break;

            case 41:
                mySkarv.Position = attributeValue;
                break;

            case 42:
                mySkarv.Modell = attributeValue;
                break;

            case 43:
                mySkarv.Art_nr = attributeValue;
                break;

            case 44:
                mySkarv.Ritnr = attributeValue;
                break;

            case 45:
                mySkarv.Material = attributeValue;
                break;

            case 46:
                mySkarv.Inldat = attributeValue;
                break;

            case 47:
                mySkarv.skarvavst_End_partikelm = attributeValue;
                break;
            }
            return(mySkarv);
        }
        public override BIS_GrundObjekt MapXmlValue(int index, string attributeValue, BIS_GrundObjekt bisObjekt)
        {
            var myPlattform = (BIS_Plattform)bisObjekt;

            //IT IS ZERO BASED
            switch (index)
            {
            case 0:
                myPlattform.ObjektTypNummer = attributeValue;
                break;

            case 1:
                myPlattform.ObjektNummer = attributeValue;
                break;

            case 17:
                myPlattform.Kmtal = attributeValue;
                break;

            case 20:
                myPlattform.Kmtalti = attributeValue;
                break;

            case 28:
                myPlattform.Höjd = attributeValue;
                break;

            case 29:
                myPlattform.Längd = decimal.Parse(attributeValue, CultureInfo.InvariantCulture);
                break;

            case 30:
                myPlattform.Bredd = decimal.Parse(attributeValue, CultureInfo.InvariantCulture);
                break;

            case 31:
                myPlattform.Plattformskant_mtrl = attributeValue;
                break;

            case 32:
                myPlattform.Beläggning = attributeValue;
                break;

            case 33:
                myPlattform.Skyddszon_Och_Ledstråk = attributeValue;
                break;

            case 34:
                myPlattform.Väderskydd = attributeValue;
                break;

            case 35:
                myPlattform.Skylt = attributeValue;
                break;

            case 36:
                myPlattform.Fotsteg = attributeValue;
                break;

            case 37:
                myPlattform.Brunn_Och_Lock = attributeValue;
                break;

            case 38:
                myPlattform.Skyddsräcken = attributeValue;
                break;

            case 39:
                myPlattform.PlattformsUtrustning = attributeValue;
                break;

            case 40:
                myPlattform.BesiktningsKlass = attributeValue;
                break;

            case 41:
                myPlattform.Senast_Ändrad = attributeValue;
                break;

            case 42:
                myPlattform.Senast_Ändrad_Av = attributeValue;
                break;

            case 43:
                myPlattform.Notering = attributeValue;
                break;
            }
            return(myPlattform);
        }
        private void ReadExcelFile(string fileName)
        {
            DataTable dataTable = new DataTable();

            try
            {
                using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(fileName, false))
                {
                    var workbookPart = spreadsheetDocument.WorkbookPart;
                    IEnumerable <Sheet> sheetcollection = workbookPart.Workbook.GetFirstChild <Sheets>().Elements <Sheet>();

                    string relationshipId = sheetcollection.First().Id.Value;
                    var    worksheetPart  = (WorksheetPart)workbookPart.GetPartById(relationshipId);

                    //Only working with the first sheet
                    SheetData         sheetData     = worksheetPart.Worksheet.Elements <SheetData>().First();
                    IEnumerable <Row> rowCollection = sheetData.Descendants <Row>();

                    //When there is no data left to process
                    if (!rowCollection.Any())
                    {
                        return;
                    }
                    //Adds the columns
                    foreach (Cell cell in rowCollection.ElementAt(0))
                    {
                        //Value of the BIS attribute
                        var bisAttribute = GetValueOfCell(spreadsheetDocument, cell);
                        dataTable.Columns.Add(bisAttribute);
                    }
                    //Adds the rows into the dataTable
                    foreach (Row row in rowCollection)
                    {
                        if (row.RowIndex == 1)
                        {
                            continue;
                        }

                        DataRow tempRow  = dataTable.NewRow();
                        int     colIndex = 0;

                        //A object to use for mapping values
                        _bisObjekt = GetBisObjectType(_mapper.MapperType);

                        //Every cell in selected row
                        foreach (Cell cell in row.Descendants <Cell>())
                        {
                            int cellColumnIndex = GetColumnIndex(GetColumnName(cell.CellReference));

                            while (colIndex < cellColumnIndex)
                            {
                                //Empties the cell at the right index
                                tempRow[colIndex] = string.Empty;
                                colIndex++;
                            }
                            //Then sets the cell value at the right index
                            var attribute = GetValueOfCell(spreadsheetDocument, cell);
                            _bisObjekt        = _mapper.MapXmlValue(cellColumnIndex, attribute, _bisObjekt);
                            tempRow[colIndex] = attribute;

                            colIndex++;
                        }
                        //The row updates after each cell value
                        _bisList.Add(_bisObjekt);
                        dataTable.Rows.Add(tempRow);
                    }
                }
            }
            catch (IOException exception)
            {
                throw new IOException(exception.Message);
            }
        }