예제 #1
0
        void _ReadTunnels(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[0];
            foreach (DataRow reader in table.Rows)
            {
                if (IsDbNull(reader, "ID") || IsDbNull(reader, "StartMileage"))
                    continue;

                Tunnel tunnel = new Tunnel(reader);
                tunnel.id = ReadInt(reader, "ID").Value;
                tunnel.name = ReadString(reader, "Name");
                //tunnel.FullName = ReadString(reader, "");
                tunnel.description = ReadString(reader, "description");
                tunnel.LineNo = ReadInt(reader, "LineNo");
                tunnel.Width = ReadDouble(reader, "Width");
                tunnel.Height = ReadDouble(reader, "Height");
                tunnel.ShapeDesc = ReadString(reader, "ShapeDesc");

                tunnel.StartMileage = ReadDouble(reader, "StartMileage").Value;
                tunnel.EndMileage = ReadDouble(reader, "EndMileage").Value;

                tunnel.ConBeginDate = ReadDateTime(reader, "ConBeginDate");
                tunnel.ConEndDate = ReadDateTime(reader, "ConEndDate");

                tunnel.shape = ReadShape(reader);

                objs[tunnel.key] = tunnel;
            }
        }
예제 #2
0
        // Read boreholes
        //
        public bool ReadBoreholes(DGObjects objs, string tableNameSQL,
            List<int> objsIDs)
        {
            string conditionSQL = WhereSQL(objsIDs);

            return ReadBoreholes(objs, tableNameSQL, conditionSQL, null);
        }
예제 #3
0
        // Summary:
        //     Get objects according to the specified object type
        // Remarks:
        //     If there is only a DGObjects with the specified object type,
        //     it will be returned directly.
        //
        //     If there are multiple DGObjects with the specified object type,
        //     then a new DGObjects is returned which will merged all the objects.
        //     In this situation, the index of the DGObjects are lost.
        public async Task <DGObjectsCollection> getObjects(string objType)
        {
            DGObjectsCollection result     = new DGObjectsCollection();
            DGObjectRepository  repository = DGObjectRepository.Instance(
                "SHML12", name, objType);
            List <DGObject> objList = await repository.GetAllAsync();

            DGObjects objs = new DGObjects();

            objs._objs   = new Dictionary <string, DGObject>();
            objs._id2Obj = new Dictionary <int, DGObject>();
            foreach (DGObject obj in objList)
            {
                objs._id2Obj[obj.id] = obj;
                objs._objs[obj.name] = obj;
            }
            result.Add(objs);
            //IEnumerable<DGObjectsDefinition> defs =
            //    objsDefinitions.Values.Where(x => x.Type == objType);
            //if (defs == null || defs.Count() == 0)
            //    return null;

            //DGObjectsCollection result = new DGObjectsCollection();
            //foreach (DGObjectsDefinition def in defs)
            //{
            //    if (objsContainer.ContainsKey(def.Name))
            //    {
            //        DGObjects objs = objsContainer[def.Name];
            //        result.Add(objs);
            //    }
            //}
            return(result);
        }
예제 #4
0
        // Summary:
        //    Load objects from database
        public virtual bool LoadObjs(DGObjects objs, DbContext dbContext)
        {
            DGObjectLoader loader2 = new DGObjectLoader(dbContext);
            bool           success = loader2.Load(objs);

            return(success);
        }
예제 #5
0
파일: MItem.cs 프로젝트: iS3-Project/iS3
 public override bool LoadObjs(DGObjects objs, DbContext dbContext)
 {
     MonitoringDGObjectLoader loader =
         new MonitoringDGObjectLoader(dbContext);
     bool success = loader.LoadMonPoints(objs);
     return success;
 }
예제 #6
0
        void _ReadBoreholes(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[0];
            foreach (DataRow row in table.Rows)
            {
                if (IsDbNull(row, "ID"))
                    continue;

                Borehole bh = new Borehole(row);
                bh.id = ReadInt(row, "ID").Value;
                bh.name = ReadString(row, "Name");
                bh.fullName = ReadString(row, "FullName");
                bh.description = ReadString(row, "Description");
                bh.shape = ReadShape(row);

                bh.Type = ReadString(row, "BoreholeType");
                bh.Top = ReadDouble(row, "TopElevation").Value;
                bh.Base = bh.Top - ReadDouble(row, "BoreholeLength").Value;
                bh.Mileage = ReadDouble(row, "Mileage");

                objs[bh.key] = bh;
            }
        }
예제 #7
0
        // Summary:
        //     Load objects from database
        public bool loadObjects(string objDefName, DbContext dbContext)
        {
            if (parent == null)
            {
                return(false);
            }

            DGObjectsDefinition def = objsDefinitions[objDefName];

            if (def == null)
            {
                return(false);
            }

            DGObjects objs    = new DGObjects(def);
            bool      success = objs.load(dbContext);

            objs.parent = this;

            // Old objs will be replaced recently loaded objects.
            if (success)
            {
                objsContainer[def.Name] = objs;
            }

            return(success);
        }
예제 #8
0
 // Summary:
 //    Re-read monitoring point.
 //    This is usually for loading all the monitoring records.
 //
 public bool ReloadMonPoints(DGObjects objs, string conditionSQL)
 {
     DGObjectsDefinition def = objs.definition;
     if (def == null)
         return false;
     bool success = _dbLoader.RereadMonPoints(objs,
         def.TableNameSQL, conditionSQL, def.OrderSQL);
     return success;
 }
예제 #9
0
 public bool LoadSLType(DGObjects objs)
 {
     DGObjectsDefinition def = objs.definition;
     if (def == null)
         return false;
     bool success = _dbLoader.ReadSLType(objs,
         def.TableNameSQL, def.ConditionSQL, def.OrderSQL);
     return success;
 }
예제 #10
0
        // Summary:
        //     Get a database context, which is requried to start reading
        //     objects from database file.
        //
        //protected DbContext _dbContext;
        //public DbContext getDbContext()
        //{
        //    // option:
        //    //  0 - odbc connection (default)
        //    //  1 - oledb connection
        //    if (_dbContext == null)
        //        _dbContext = new DbContext(projDef.LocalDatabaseName, 0);
        //    return _dbContext;
        //}

        // Summary:
        //     Synchronize objects on the tree.
        // Remarks:
        //     After synchronization, each tree will have an a DataView of objects.
        //
        public int syncObjectsOnTree(Tree inputTree, bool readSubTree = true)
        {
            int nSync = 0;

            List <Tree> trees = null;

            if (readSubTree == true)
            {
                trees = inputTree.ToList();
            }
            else
            {
                trees = new List <Tree>();
                trees.Add(inputTree);
            }

            foreach (Tree tree in trees)
            {
                if (tree.RefDomainName == null || tree.RefObjsName == null)
                {
                    continue;
                }

                Domain domain = null;
                if (domains.ContainsKey(tree.RefDomainName))
                {
                    domain = domains[tree.RefDomainName];
                }
                if (domain == null)
                {
                    continue;
                }

                DGObjects objs = null;
                if (domain.objsContainer.ContainsKey(tree.RefObjsName))
                {
                    objs = domain.objsContainer[tree.RefObjsName];
                }
                if (objs == null)
                {
                    continue;
                }

                if (objs.rawDataSet.Tables.Count == 0)
                {
                    continue;
                }

                // Open a view on the table, and apply filter and sort rule on the table
                //
                DataTable dt = objs.rawDataSet.Tables[0];
                DataView  dv = new DataView(dt, tree.Filter, tree.Sort, DataViewRowState.CurrentRows);
                tree.ObjectsView = dv;
                tree.RefObjs     = objs;
            }
            return(nSync);
        }
예제 #11
0
        getSelectedObjs()
        {
            Dictionary <string, IEnumerable <DGObject> > selectedObjsDict =
                new Dictionary <string, IEnumerable <DGObject> >();

            foreach (string layerID in objsLayerIndex.Keys)
            {
                DGObjects       objs         = objsLayerIndex[layerID];
                List <DGObject> selectedObjs = getSelected(objs);
                if (selectedObjs != null && selectedObjs.Count > 0)
                {
                    selectedObjsDict[layerID] = selectedObjs;
                }
            }

            return(selectedObjsDict);
        }
예제 #12
0
 // Summary:
 //    Read monitoring points from the specified tables, using condition and order
 public bool ReadMonPoints(DGObjects objs, string tableNameSQL,
     string conditionSQL, string orderSQL)
 {
     try
     {
         ReadRawData_Partial(objs, tableNameSQL, orderSQL, conditionSQL);
         _ReadMonPoints(objs, tableNameSQL, conditionSQL, orderSQL);
         _ReadMonReadings(objs);
     }
     catch (DbException ex)
     {
         string str = ex.ToString();
         ErrorReport.Report(str);
         return false;
     }
     return true;
 }
예제 #13
0
        // Summary:
        //     Set object selection state.
        // Remarks:
        //     For more info on IsSelected property,
        //     see remarks of objSelectionChangedListener() function.
        void setObjSelectionState(
            Dictionary <string, IEnumerable <DGObject> > selectedObjs,
            bool isSelected)
        {
            // Method1:
            //     set object selection state through layer index
            //
            //foreach (string layerID in selectedObjs.Keys)
            //{
            //    if (objsLayerIndex.ContainsKey(layerID))
            //    {
            //        DGObjects objs = objsLayerIndex[layerID];
            //        foreach (DGObject obj in selectedObjs[layerID])
            //        {
            //            if (objs.obj2RowView.Keys.Contains(obj))
            //            {
            //                DataRow dr = objs.obj2RowView[obj];
            //                dr.SetField<bool>("IsSelected", isSelected);
            //            }
            //        }
            //    }
            //}

            // Method 2:
            //     set object selection state from object's parent
            //     Method 2 is robust than method 1 because it bypass layer index.
            //
            foreach (var objs in selectedObjs.Values)
            {
                if (objs.Count() == 0)
                {
                    continue;
                }
                DGObjects parent = objs.First().parent;
                foreach (var obj in objs)
                {
                    if (parent.obj2RowView.Keys.Contains(obj))
                    {
                        DataRow dr = parent.obj2RowView[obj];
                        dr.SetField <bool>("IsSelected", isSelected);
                    }
                }
            }
        }
예제 #14
0
        // Summary:
        //      Load project from a definition file.
        // Remarks:
        //      It involoved two steps:
        //      (1) Load defintion at first
        //      (2) Load project domain data specifiled in the definition file
        //
        public static Project load(string definitionFile)
        {
            Project prj = new Project();

            IS3.Core.Globals.project = prj;

            // Load project definition first
            //
            prj.loadDefinition(definitionFile);

            // Load project data
            //
            DbContext dbContext = prj.getDbContext();
            bool      success   = dbContext.Open();

            if (!success)
            {
                return(prj);
            }

            foreach (Domain domain in prj.domains.Values)
            {
                // load all objects into domain
                domain.loadAllObjects(dbContext);
                // sync objects on the tree
                prj.syncObjectsOnTree(domain.root);
                // build objects index based on layer ID
                // which is specified in the DGObjectsDefinition.GISLayerName
                foreach (var def in domain.objsDefinitions)
                {
                    string defName = def.Key;
                    string layerID = def.Value.GISLayerName;
                    if (layerID != null && layerID.Length > 0)
                    {
                        DGObjects objs = domain.objsContainer[defName];
                        prj.objsLayerIndex[layerID]       = objs;
                        prj.dataSetIndex[objs.rawDataSet] = objs;
                    }
                }
            }
            dbContext.Close();

            return(prj);
        }
예제 #15
0
 public bool ReadTunnels(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     try
     {
         _ReadTunnels(objs, tableNameSQL,
             conditionSQL, orderSQL);
     }
     catch (DbException ex)
     {
         string str = ex.ToString();
         ErrorReport.Report(str);
         return false;
     }
     return true;
 }
예제 #16
0
        // Summary:
        //    Re-read monitoring point from the specified tables.
        //
        public bool RereadMonPoints(DGObjects objs, string tableNameSQL,
            string conditionSQL, string orderSQL)
        {
            try
            {
                // read raw data ingoring condition
                ReadRawData_Partial(objs, tableNameSQL, orderSQL, conditionSQL);

                // fill readings (note: objs are already exist)
                _ReadMonReadings(objs);
            }
            catch (DbException ex)
            {
                string str = ex.ToString();
                ErrorReport.Report(str);
                return false;
            }
            return true;
        }
예제 #17
0
        SegmentLining _GetSL(DGObjects objs, DataRow row)
        {
            if (IsDbNull(row, "LineNo") || IsDbNull(row, "RingNo"))
                return null;

            int lineNo = ReadInt(row, "LineNo").Value;
            int ringNo = ReadInt(row, "RingNo").Value;

            string key = lineNo.ToString() + ":" + ringNo.ToString();
            if (!objs.containsKey(key))
            {
                string error = string.Format(
                    "Segment Lining does not exist when reading [{0}]!!! " +
                    "LineNo={1}, RingNo={2}.", row.Table.TableName, lineNo, ringNo);
                ErrorReport.Report(error);
                return null;
            }
            SegmentLining SL = (SegmentLining)objs[key];
            return SL;
        }
예제 #18
0
        List <DGObject> getSelected(DGObjects objs)
        {
            List <DGObject> selectedObjs = new List <DGObject>();

            foreach (DGObject obj in objs.values)
            {
                if (objs.obj2RowView.Keys.Contains(obj))
                {
                    DataRow dr = objs.obj2RowView[obj];
                    //if (dr.IsNull("IsSelected"))
                    //    continue;
                    bool isSelected = dr.Field <bool>("IsSelected");
                    if (isSelected)
                    {
                        selectedObjs.Add(obj);
                    }
                }
            }
            return(selectedObjs);
        }
예제 #19
0
 public bool ReadSegmentLinings(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     try
     {
         _ReadSegmentLinings(objs, tableNameSQL,
             conditionSQL, orderSQL);
         //_ReadSLConstructionRecords(conn, objs);
         //_ReadTBMDrivingRecords(conn, objs);
     }
     catch (DbException ex)
     {
         string str = ex.ToString();
         ErrorReport.Report(str);
         return false;
     }
     return true;
 }
예제 #20
0
        // Summary:
        //     Get objects according to the specified object type
        // Remarks:
        //     If there is only a DGObjects with the specified object type,
        //     it will be returned directly.
        //
        //     If there are multiple DGObjects with the specified object type,
        //     then a new DGObjects is returned which will merged all the objects.
        //     In this situation, the index of the DGObjects are lost.
        public DGObjectsCollection getObjects(string objType)
        {
            IEnumerable <DGObjectsDefinition> defs =
                objsDefinitions.Values.Where(x => x.Type == objType);

            if (defs == null || defs.Count() == 0)
            {
                return(null);
            }

            DGObjectsCollection result = new DGObjectsCollection();

            foreach (DGObjectsDefinition def in defs)
            {
                if (objsContainer.ContainsKey(def.Name))
                {
                    DGObjects objs = objsContainer[def.Name];
                    result.Add(objs);
                }
            }
            return(result);
        }
예제 #21
0
 void _ReadConfinedWaters(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
     DataTable table = objs.rawDataSet.Tables[0];
     foreach (DataRow reader in table.Rows)
     {
         if (IsDbNull(reader, "ID"))
             continue;
         ConfinedWater cw = new ConfinedWater(reader);
         cw.id = ReadInt(reader, "ID").Value;
         cw.BoreholeName = ReadString(reader, "BoreholeName");
         cw.SiteName = ReadString(reader, "SiteName");
         cw.TopElevation = ReadDouble(reader, "TopElevation");
         cw.ObservationDepth = ReadDouble(reader, "ObservationDepth");
         cw.StratumName = ReadString(reader, "StatumName");
         cw.Layer = ReadInt(reader, "Layer");
         cw.WaterTable = ReadDouble(reader, "WaterTable");
         cw.ObservationDate = ReadDateTime(reader, "ObservationDate");
         objs[cw.key] = cw;
     }
 }
예제 #22
0
 void _ReadWaterProperties(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
     DataTable table = objs.rawDataSet.Tables[0];
     foreach (DataRow reader in table.Rows)
     {
         if (IsDbNull(reader, "ID"))
             continue;
         WaterProperty wp = new WaterProperty(reader);
         wp.id = ReadInt(reader, "ID").Value;
         wp.BoreholeName = ReadString(reader, "BoreholeName");
         wp.Cl = ReadDouble(reader, "Cl");
         wp.SO4 = ReadDouble(reader, "SO4");
         wp.Mg = ReadDouble(reader, "Mg");
         wp.NH = ReadDouble(reader, "NH");
         wp.pH = ReadDouble(reader, "pH");
         wp.CO2 = ReadDouble(reader, "CO2");
         wp.Corrosion = ReadString(reader, "Corrosion");
         objs[wp.key] = wp;
     }
 }
예제 #23
0
 void _ReadPhreaticWaters(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
     DataTable table = objs.rawDataSet.Tables[0];
     foreach (DataRow reader in table.Rows)
     {
         if (IsDbNull(reader, "ID"))
             continue;
         PhreaticWater pw = new PhreaticWater(reader);
         pw.id = ReadInt(reader, "ID").Value;
         pw.SiteName = ReadString(reader, "SiteName");
         pw.AvBuriedDepth = ReadDouble(reader, "AvBuriedDepth");
         pw.AvElevation = ReadDouble(reader, "AvElevation");
         objs[pw.key] = pw;
     }
 }
예제 #24
0
        void _ReadSLType(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLBaseType"];
            Dictionary<int, SLBaseType> slBaseTypes = new Dictionary<int, SLBaseType>();
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    if (IsDbNull(reader, "SLBaseTypeID"))
                        continue;
                    SLBaseType type = new SLBaseType();
                    type.id = ReadInt(reader, "SLBaseTypeID").Value;
                    type.SLBaseTypeID = type.id;
                    string category = ReadString(reader, "SLCategory");
                    if (category == "PrecastConcrete")
                        type.SLCategory = SLCategoryEnum.PrecastConcrete;
                    else if (category == "CastIron")
                        type.SLCategory = SLCategoryEnum.CastIron;
                    else if (category == "SteelPlate")
                        type.SLCategory = SLCategoryEnum.SteelPlate;

                    string shape = ReadString(reader, "SLShape");
                    if (shape == "Stright")
                        type.SLShape = SLShapeEnum.Straight;
                    else if (shape == "Tapered")
                        type.SLShape = SLShapeEnum.Tapered;
                    else if (shape == "Universal")
                        type.SLShape = SLShapeEnum.Universal;

                    type.NumberOfSegments = ReadInt(reader, "SLNumOfSegments").Value;
                    type.Conicity = ReadDouble(reader, "SLConicity").Value;
                    type.Thickness = ReadDouble(reader, "SLThickness").Value;
                    type.Width = ReadDouble(reader, "SLWidth").Value;
                    type.OuterDiameter = ReadDouble(reader, "SLOutDiameter").Value;
                    type.InnerDiameter = ReadDouble(reader, "SLInnerDiameter").Value;
                    type.TotalKeyPos = ReadInt(reader, "SLTotalKeyPos").Value;

                    slBaseTypes[(int)type.SLBaseTypeID] = type;
                }

                table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLType"];
                if (table != null)
                {
                    foreach (DataRow reader in table.Rows)
                    {
                        if (IsDbNull(reader, "SLTypeID"))
                            continue;
                        SLType type = new SLType(reader);
                        type.id = ReadInt(reader, "SLTypeID").Value;
                        type.name = ReadString(reader, "SLTypeName");
                        type.SLBaseTypeID = ReadInt(reader, "SLBaseTypeID");
                        type.description = ReadString(reader, "SLTypeDescription");
                        type.Description_CN = ReadString(reader, "SLTypeDescription_CN");

                        if (type.SLBaseTypeID != null && slBaseTypes.ContainsKey((int)type.SLBaseTypeID))
                        {
                            SLBaseType baseType = slBaseTypes[(int)type.SLBaseTypeID];
                            type.SLCategory = baseType.SLCategory;
                            type.SLShape = baseType.SLShape;
                            type.NumberOfSegments = baseType.NumberOfSegments;
                            type.Conicity = baseType.Conicity;
                            type.Thickness = baseType.Thickness;
                            type.Width = baseType.Width;
                            type.OuterDiameter = baseType.OuterDiameter;
                            type.InnerDiameter = baseType.InnerDiameter;
                            type.TotalKeyPos = baseType.TotalKeyPos;
                        }
                        objs[type.key] = type;
                    }
                }

                table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "Segments"];
                if (table != null)
                {
                    Dictionary<int, List<Segment>> allSegments = new Dictionary<int, List<Segment>>();
                    List<Segment> segments;

                    foreach (DataRow reader in table.Rows)
                    {
                        Segment seg = new Segment();
                        int i = 0;
                        int SLBaseTypeID = ReadInt(reader, "SLBaseTypeID").Value;
                        seg.StartAngle = ReadDouble(reader, "StartAngle").Value;
                        seg.CentralAngle = ReadDouble(reader, "CentralAngle").Value;
                        seg.Code = ReadString(reader, "Code");

                        if (allSegments.ContainsKey(SLBaseTypeID))
                            segments = allSegments[SLBaseTypeID];
                        else
                        {
                            segments = new List<Segment>();
                            allSegments[SLBaseTypeID] = segments;
                        }
                        segments.Add(seg);
                    }

                    foreach (var obj in objs.values)
                    {
                        SLType slType = obj as SLType;
                        if (slType.SLBaseTypeID == null)
                            continue;
                        int SLBaseTypeID = (int)slType.SLBaseTypeID;
                        if (allSegments.ContainsKey(SLBaseTypeID))
                        {
                            segments = allSegments[SLBaseTypeID];
                            slType.Segments.AddRange(segments);
                        }
                    }
                }
            }
        }
예제 #25
0
 public override bool LoadObjs(DGObjects objs, DbContext dbContext)
 {
     GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(dbContext);
     bool success = loader2.LoadSoilProperties(objs);
     return success;
 }
예제 #26
0
 void _ReadRiverWaters(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
     DataTable table = objs.rawDataSet.Tables[0];
     foreach (DataRow reader in table.Rows)
     {
         if (IsDbNull(reader, "ID"))
             continue;
         RiverWater rw = new RiverWater(reader);
         rw.id = ReadInt(reader, "ID").Value;
         rw.ObservationLocation = ReadString(reader, "ObservationLocation");
         rw.HighestTidalLevel = ReadDouble(reader, "HighestTidalLevel");
         rw.HighestTidalLevelDate = ReadDateTime(reader, "HighestTidalLevelDate");
         rw.LowestTidalLevel = ReadDouble(reader, "LowestTidalLevel");
         rw.LowestTidalLevelDate = ReadDateTime(reader, "LowestTidalLevelDate");
         rw.AvHighTidalLevel = ReadDouble(reader, "AvHighTidalLevel");
         rw.AvLowTidalLevel = ReadDouble(reader, "AvLowTidalLevel");
         rw.AvTidalRange = ReadDouble(reader, "AvTidalRange");
         rw.DurationOfRise = ReadTimeSpan(reader, "DurationOfRise").ToString();
         rw.DurationOfFall = ReadTimeSpan(reader, "DurationOfFall").ToString();
         objs[rw.key] = rw;
     }
 }
예제 #27
0
        void _ReadStrata(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[0];
            foreach (DataRow row in table.Rows)
            {
                if (IsDbNull(row, "ID"))
                    continue;

                Stratum st = new Stratum(row);
                st.name = ReadString(row, "Name");
                st.fullName = ReadString(row, "FullName");
                st.description = ReadString(row, "Description");

                st.id = ReadInt(row, "ID").Value;
                st.GeologyAge = ReadString(row, "GeologicalAge");
                st.FormationType = ReadString(row, "FormationType");
                st.Compaction = ReadString(row, "Compaction");
                st.ElevationRange = ReadString(row, "ElevationOfStratumBottom");
                st.ThicknessRange = ReadString(row, "Thickness");

                st.shape = ReadShape(row);

                objs[st.key] = st;
            }
        }
 public virtual bool ReadDGObjects(DGObjects objs, string tableNameSQL,
     List<int> IDs)
 {
     string condition = WhereSQL(IDs);
     return ReadDGObjects(objs, tableNameSQL, null, null, condition);
 }
예제 #29
0
        void _ReadBoreholeGeologies(DGObjects objs)
        {
            // method1: maybe very slow because linq is slow.
            DataTable dt = objs.rawDataSet.Tables[1];
            foreach (Borehole bh in objs.values)
            {
                var rows = from row in dt.AsEnumerable()
                           where (int)row["BoreholeID"] == bh.id
                           orderby row["ElevationOfStratumBottom"] descending
                           select row;

                double top = bh.Top;
                foreach (DataRow x in rows)
                {
                    //if (x["StratumID"].GetType() == typeof(System.DBNull)
                    //    || x["ElevationOfStratumBottom"].GetType() == typeof(System.DBNull))
                    if (IsDbNull(x, "StratumID") || IsDbNull(x, "ElevationOfStratumBottom"))
                    {
                        string error = string.Format(
                            "Data table [{0}] error: [StratumID] or [ElevationOfStratumBottom] can't be null, [BoreholeID] = {1}."
                            + Environment.NewLine
                            + "This record is ignore. Checking data is strongly recommended.",
                            dt.TableName, x["BoreholeID"]);
                        ErrorReport.Report(error);
                        continue;
                    }
                    BoreholeGeology bg = new BoreholeGeology();
                    bg.StratumID = ReadInt(x, "StratumID").Value;
                    bg.Top = top;
                    bg.Base = ReadDouble(x, "ElevationOfStratumBottom").Value;

                    top = bg.Base;
                    bh.Geologies.Add(bg);
                }
            }
        }
예제 #30
0
        void _ReadBoreholeGeologies2(DGObjects objs)
        {
            if (objs.rawDataSet.Tables.Count <= 1)
                return;

            // method2: index the stratra info
            DataTable dt = objs.rawDataSet.Tables[1];
            Dictionary<int, List<BoreholeGeology>> strata_dict =
                new Dictionary<int, List<BoreholeGeology>>();

            // put the strata information into the dictionary
            foreach (DataRow row in dt.Rows)
            {
                if (IsDbNull(row, "StratumID") || IsDbNull(row, "ElevationOfStratumBottom"))
                {
                    string error = string.Format(
                        "Data table [{0}] error: [StratumID] or [ElevationOfStratumBottom] can't be null, [BoreholeID] = {1}."
                        + Environment.NewLine
                        + "This record is ignore. Checking data is strongly recommended.",
                        dt.TableName, row["BoreholeID"]);
                    ErrorReport.Report(error);
                    continue;
                }

                int bhID = ReadInt(row, "BoreholeID").Value;
                List<BoreholeGeology> geo = null;
                if (strata_dict.ContainsKey(bhID))
                    geo = strata_dict[bhID];
                else
                {
                    geo = new List<BoreholeGeology>();
                    strata_dict[bhID] = geo;
                }
                BoreholeGeology bg = new BoreholeGeology();
                bg.StratumID = ReadInt(row, "StratumID").Value;
                bg.Base = ReadDouble(row, "ElevationOfStratumBottom").Value;
                geo.Add(bg);
            }

            // sort the borehole geology
            foreach (var geo in strata_dict.Values)
            {
                geo.Sort((x,y) => x.StratumID.CompareTo(y.StratumID));
            }

            // add the geology to borehole
            foreach (Borehole bh in objs.values)
            {
                List<BoreholeGeology> geo = null;
                if (strata_dict.ContainsKey(bh.id))
                    geo = strata_dict[bh.id];
                else
                    continue;

                double top = bh.Top;
                foreach (var x in geo)
                {
                    x.Top = top;
                    top = x.Base;
                    bh.Geologies.Add(x);
                }
            }
        }
예제 #31
0
파일: Water.cs 프로젝트: iS3-Project/iS3
 public override bool LoadObjs(DGObjects objs, DbContext dbContext)
 {
     GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(dbContext);
     bool success = loader2.LoadPhreaticWaters(objs);
     return success;
 }
예제 #32
0
        public static DGObjects NewObjsInAnalysisDomain(string Type, string Name, 
            bool HasGeometry = false, string GISLayerName = "")
        {
            DGObjectsDefinition eDef = new DGObjectsDefinition();
            eDef.Type = Type;
            eDef.Name = Name;
            eDef.HasGeometry = HasGeometry;
            string layerName = "";
            if (HasGeometry)
                layerName = "e" + GISLayerName;
            eDef.GISLayerName = layerName;
            DGObjects dgObjects = new DGObjects(eDef);

            Domain analysisDomain = GetAnalysisDomain();
            dgObjects.parent = analysisDomain;
            analysisDomain.objsDefinitions[eDef.Name] = eDef;
            analysisDomain.objsContainer[eDef.Name] = dgObjects;

            return dgObjects;
        }
예제 #33
0
 public override bool LoadObjs(DGObjects objs, DbContext dbContext)
 {
     GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(dbContext);
     bool success = loader2.LoadStratumSections(objs);
     return success;
 }
예제 #34
0
        void _ReadTunnelAxes(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "TunnelAxes"];
            if( table != null)
            {
                foreach (DataRow row in table.Rows)
                {
                    if (IsDbNull(row, "ID"))
                        continue;

                    TunnelAxis ta = new TunnelAxis(row);
                    ta.name = ReadString(row, "Name");
                    ta.id = ReadInt(row, "ID").Value;
                    ta.LineNo = ReadInt(row, "LineNo").Value;
                    ta.shape = ReadShape(row);

                    objs[ta.key] = ta;
                }

                DataTable table2 = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "TunnelAxesPoints"];
                Dictionary<int, TunnelAxis> dictAxes = new Dictionary<int, TunnelAxis>();
                if (table2 != null)
                {
                    TunnelAxis axis = null;
                    foreach (DataRow reader in table2.Rows)
                    {
                        if (IsDbNull(reader, "LineNo"))
                            continue;
                        int lineNo = ReadInt(reader, "LineNo").Value;

                        if (dictAxes.ContainsKey(lineNo))
                            axis = dictAxes[lineNo];
                        else
                        {
                            axis = new TunnelAxis();
                            axis.LineNo = lineNo;
                            axis.id = lineNo;
                            axis.name = lineNo.ToString();
                            dictAxes[lineNo] = axis;
                        }
                        TunnelAxisPoint tap = new TunnelAxisPoint();
                        tap.Mileage = ReadDouble(reader, "Milage").Value;
                        tap.X = ReadDouble(reader, "X").Value;
                        tap.Y = ReadDouble(reader, "Y").Value;
                        tap.Z = ReadDouble(reader, "Z").Value;
                        axis.AxisPoints.Add(tap);
                    }
                }

                foreach (TunnelAxis ta in objs.values)
                {
                    if (dictAxes.ContainsKey(ta.id))
                        ta.AxisPoints = dictAxes[ta.id].AxisPoints;
                }
            }
        }
예제 #35
0
        void _ReadSoilProperties(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[0];
            foreach (DataRow reader in table.Rows)
            {
                if (IsDbNull(reader, "ID"))
                    continue;

                SoilProperty soilProp = new SoilProperty(reader);
                soilProp.id = ReadInt(reader, "ID").Value;
                soilProp.name = ReadString(reader, "Name");
                soilProp.StratumID = ReadInt(reader, "StratumID").Value;
                soilProp.StratumSectionID = ReadInt(reader, "StratumSectionID");

                soilProp.StaticProp.w = ReadDouble(reader, "w");
                soilProp.StaticProp.gama = ReadDouble(reader, "gama");
                soilProp.StaticProp.c = ReadDouble(reader, "c");
                soilProp.StaticProp.fai = ReadDouble(reader, "fai");
                soilProp.StaticProp.cuu = ReadDouble(reader, "cuu");
                soilProp.StaticProp.faiuu = ReadDouble(reader, "faiuu");
                soilProp.StaticProp.Cs = ReadDouble(reader, "Cs");
                soilProp.StaticProp.qu = ReadDouble(reader, "qu");
                soilProp.StaticProp.K0 = ReadDouble(reader, "K0");
                soilProp.StaticProp.Kv = ReadDouble(reader, "Kv");
                soilProp.StaticProp.Kh = ReadDouble(reader, "Kh");
                soilProp.StaticProp.e = ReadDouble(reader, "e");
                soilProp.StaticProp.av = ReadDouble(reader, "av");
                soilProp.StaticProp.Cu = ReadDouble(reader, "Cu");

                soilProp.StaticProp.G = ReadDouble(reader, "G");
                soilProp.StaticProp.Sr = ReadDouble(reader, "Sr");
                soilProp.StaticProp.ccq = ReadDouble(reader, "ccq");
                soilProp.StaticProp.faicq = ReadDouble(reader, "faicq");
                soilProp.StaticProp.c_s = ReadDouble(reader, "c_s");
                soilProp.StaticProp.fais = ReadDouble(reader, "fais");
                soilProp.StaticProp.a01_02 = ReadDouble(reader, "a01_02");
                soilProp.StaticProp.Es01_02 = ReadDouble(reader, "Es01_02");
                soilProp.StaticProp.ccu = ReadDouble(reader, "ccu");
                soilProp.StaticProp.faicu = ReadDouble(reader, "faicu");
                soilProp.StaticProp.cprime = ReadDouble(reader, "cprime");
                soilProp.StaticProp.faiprime = ReadDouble(reader, "faiprime");
                soilProp.StaticProp.E015_0025 = ReadDouble(reader, "E015_0025");
                soilProp.StaticProp.E02_0025 = ReadDouble(reader, "E02_0025");
                soilProp.StaticProp.E04_0025 = ReadDouble(reader, "E04_0025");

                SoilDynamicProperty dynamicProp = new SoilDynamicProperty();
                soilProp.DynamicProp.G0 = ReadDouble(reader, "G0");
                soilProp.DynamicProp.ar = ReadDouble(reader, "ar");
                soilProp.DynamicProp.br = ReadDouble(reader, "br");

                objs[soilProp.key] = soilProp;
            }
        }
        // Read object (i.e., Name list) from the specified table.
        // REQUIREMENT:
        //      1. The specified table must have a 'Name' column.
        //
        public virtual bool ReadDGObjects(DGObjects objs, string tableNameSQL,
            string defNamesSQL, string orderSQL, string conditionSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);

            DataTable table = objs.rawDataSet.Tables[0];
            foreach (DataRow row in table.Rows)
            {
                DGObject dgObj = new DGObject(row);

                try
                {
                    if (table.Columns.Contains("ID"))
                        dgObj.id = Convert.ToInt32(row["ID"]);

                    if (table.Columns.Contains("Name"))
                        dgObj.name = Convert.ToString(row["Name"]);

                    if (table.Columns.Contains("FullName"))
                        dgObj.fullName = ReadString(row, "FullName");

                    if (table.Columns.Contains("Description"))
                        dgObj.description = ReadString(row, "Description");

                    dgObj.shape = ReadShape(row);
                }
                catch (FormatException ex)
                {
                    string str = ex.ToString();
                    ErrorReport.Report(str);
                    continue;
                }
                objs[dgObj.id.ToString() + ":" + dgObj.name] = dgObj;
            }

            return true;
        }
예제 #37
0
 public void _ReadStratumSections(
     DGObjects objs,
     string tableNameSQL,
     string conditionSQL,
     string orderSQL)
 {
     ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
     DataTable table = objs.rawDataSet.Tables[0];
     foreach (DataRow reader in table.Rows)
     {
         if (IsDbNull(reader, "ID"))
             continue;
         StratumSection sec = new StratumSection(reader);
         sec.id = ReadInt(reader, "ID").Value;
         sec.name = ReadString(reader, "Name");
         sec.StartMileage = ReadDouble(reader, "StartMileage");
         sec.EndMileage = ReadDouble(reader, "EndMileage");
         objs[sec.key] = sec;
     }
 }
        // Summary:
        //     Read tables in database into objs.RawDataSet, which have DataTable(s).
        // Parameters:
        //     objs -> objects
        //     tableNameSQL -> table names, could have many table names together,
        //                     see remarks below
        //     orderSQL -> SQL order string: 'Order by orderSQL'
        //     conditionSQL -> SQL condition string: 'Where conditionSQL'
        // Remarks:
        //     Objects can have multiple tables combined togther.
        //     For example, borehole objects my have [Borehole], [BoreholeStrataInfo] tables.
        //     To specifify multiple tables, just combine them together into
        //     a string, such as "Boreholes,BoreholeStrataInfo".
        //     Similarly, orderSQL and conditionSQL may have mutliple items.
        //
        public virtual bool ReadRawData(
            DGObjects objs,
            string tableNameSQL,
            string orderSQL,
            string conditionSQL)
        {
            // tableNameSQL,orderSQL,conditionSQL may contain
            // multiple table names speratored by comma
            string[] names = tableNameSQL.Split(_separator);
            string[] orders = null;
            string[] conditions = null;
            if (orderSQL != null)
                orders = orderSQL.Split(_separator);
            if (conditionSQL != null)
                conditions = conditionSQL.Split(_separator);

            for (int i = 0; i < names.Count(); ++i)
            {
                string tableName = _dbContext.TableNamePrefix + names[i];
                string strCmd = "SELECT * FROM " + tableName + "";

                if (conditions != null && i < conditions.Count())
                    strCmd += WhereSQL(null, conditions[i]);
                if (orders != null && i < orders.Count())
                    strCmd += OrderSQL(orders[i]);

                DbDataAdapter adapter = _dbContext.GetDbDataAdapter(strCmd);
                adapter.Fill(objs.rawDataSet, tableName);
            }

            // Add a field 'IsSelected' to the first DataTable, so we can
            // set and track the selection state of each row
            if (objs.rawDataSet.Tables != null
                && objs.rawDataSet.Tables.Count > 0)
            {
                DataTable dt = objs.rawDataSet.Tables[0];
                DataColumn column = dt.Columns.Add("IsSelected", typeof(bool));
                foreach (DataRow row in dt.Rows)
                {
                    row.SetField(column, false);
                }

            }

            return true;
        }
예제 #39
0
        public void _ReadSegmentLinings(
            DGObjects objs,
            string tableNameSQL,
            string conditionSQL,
            string orderSQL)
        {
            ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL);
            DataTable table = objs.rawDataSet.Tables[0];

            ///
            /// 0. [SegmentLinings]
            ///
            foreach (DataRow reader in table.Rows)
            {
                if (IsDbNull(reader, "ID"))
                    continue;

                SegmentLining SL = new SegmentLining(reader);
                SL.id = ReadInt(reader, "ID").Value;
                SL.name = ReadString(reader, "Name");
                SL.fullName = ReadString(reader, "FullName");
                SL.description = ReadString(reader, "Description");
                SL.StartMileage = ReadDouble(reader, "MilageAsDesign");
                SL.SLTypeID = ReadInt(reader, "SLTypeIDAsDesign");
                SL.LineNo = ReadInt(reader, "LineNo").Value;
                SL.RingNo = ReadInt(reader, "RingNo").Value;
                SL.CentroidZ = ReadDouble(reader, "Centroid_Z");

                SL.shape = ReadShape(reader);

                objs[SL.key] = SL;
            }

            /*
             * Don't write code like this because linq is too slow for large data.
             * 
            foreach (SegmentLining SL in objs.Values)
            {
                DataTable sub_table = objs.RawDataSet.Tables[1];
                var rows = from row in sub_table.AsEnumerable()
                           where !IsDbNull(row, "LineNo") &&
                                 !IsDbNull(row, "RingNo") &&
                                 Convert.ToInt32(row["LineNo"]) == SL.LineNo &&
                                 Convert.ToInt32(row["RingNo"]) == SL.RingNo
                           select row;
                ...
            }
            */
            ///
            ///1.[SLConstructionRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLConstructionRecords"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    rec.LineNo = SL.LineNo;
                    rec.RingNo = SL.RingNo;
                    rec.ConstructionDate = ReadDateTime(reader, "ConstructionDate");
                    rec.MileageAsBuilt = ReadDouble(reader, "MilageAsBuilt");
                    rec.SLTypeIDAsBuilt = ReadInt(reader, "SLTypeIDAsBuilt");
                    rec.KeySegmentPosition = ReadInt(reader, "KeySegementPositionNum");
                    rec.Remarks = ReadString(reader, "Remarks");
                }
            }
            ///
            ///2. [TBMDrivingRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "TBMDrivingRecords"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    rec.TBMDrivingRecord.DataAquisitionNum = ReadInt(reader, "DataAquisitionNum");
                    rec.TBMDrivingRecord.DrivingDate = ReadDateTime(reader, "DrivingDate");
                    rec.TBMDrivingRecord.DrivingSpeed = ReadDouble(reader, "DrivingSpeed");
                    // time detail
                    rec.TBMDrivingRecord.TimeDetail.DrivingStartTime = ReadString(reader, "DrivingStartTime");
                    rec.TBMDrivingRecord.TimeDetail.DrivingEndTime = ReadString(reader, "DrivingEndTime");
                    rec.TBMDrivingRecord.TimeDetail.ExcavTime = ReadInt(reader, "ExcavTime");
                    rec.TBMDrivingRecord.TimeDetail.ExcavStopTime = ReadInt(reader, "ExcavStopTime");
                    rec.TBMDrivingRecord.TimeDetail.ExcavWaitingTime = ReadInt(reader, "ExcavWaitingTime");
                    rec.TBMDrivingRecord.TimeDetail.AssemTime = ReadInt(reader, "AssemTime");
                    rec.TBMDrivingRecord.TimeDetail.AssemStopTime = ReadInt(reader, "AssemStopTime");
                    // grouting detail
                    rec.TBMDrivingRecord.GroutingDetail.GroutingAmountOfPumps = new double?[6];
                    rec.TBMDrivingRecord.GroutingDetail.GroutingPressureOfPumps = new double?[6];
                    for (int index = 0; index < 6; ++index)
                        rec.TBMDrivingRecord.GroutingDetail.GroutingAmountOfPumps[index] = ReadDouble(reader, "GroutingAmountOfPump" + (index + 1).ToString());
                    for (int index = 0; index < 6; ++index)
                        rec.TBMDrivingRecord.GroutingDetail.GroutingPressureOfPumps[index] = ReadDouble(reader, "GroutingPressureOfPump" + (index + 1).ToString());
                    rec.TBMDrivingRecord.GroutingDetail.TotalGroutingAmountOfAllPumps = ReadDouble(reader, "TotalGroutingAmountOfAllPumps");
                    rec.TBMDrivingRecord.GroutingDetail.GroutingOilAmountAtTBMTail = ReadDouble(reader, "GroutingOilAmountAtTBMTail");
                    rec.TBMDrivingRecord.GroutingDetail.GroutingOilAmountAtFrontChamber = ReadDouble(reader, "GroutingOilAmountAtFrontChamber");
                    rec.TBMDrivingRecord.GroutingDetail.GroutingOilAmountAtMiddleChamber = ReadDouble(reader, "GroutingOilAmountAtMiddleChamber");
                    rec.TBMDrivingRecord.GroutingDetail.GroutingOilAmountAtRearChamber = ReadDouble(reader, "GroutingOilAmountAtRearChamber");
                    // driving force detail
                    rec.TBMDrivingRecord.ForceDetail.TotalDrivingForce = ReadDouble(reader, "TotalDrivingForce");
                    rec.TBMDrivingRecord.ForceDetail.RearFrameTractionForce = ReadDouble(reader, "RearFrameTractionForce");
                    // pressure detail
                    rec.TBMDrivingRecord.PressureDetail.AirBubblePressure = ReadDouble(reader, "AirBubblePressure");
                    rec.TBMDrivingRecord.PressureDetail.FrontChamberPressure = ReadDouble(reader, "FrontChamberPressure");
                    // mud detail
                    rec.TBMDrivingRecord.MudDetail.MudLiquidLevel = ReadDouble(reader, "MudLiquidLevel");
                    rec.TBMDrivingRecord.MudDetail.IncomingMudAmount = ReadDouble(reader, "IncomingMudAmount");
                    rec.TBMDrivingRecord.MudDetail.DischargingMudAmount = ReadDouble(reader, "DischargingMudAmount");
                    rec.TBMDrivingRecord.MudDetail.IncomingMudDensity = ReadDouble(reader, "IncomingMudDensity");
                    rec.TBMDrivingRecord.MudDetail.DischargingMudDensity = ReadDouble(reader, "DischargingMudDensity");
                    // cutter header detail
                    rec.TBMDrivingRecord.CutterHeadDetail.RotationSpeedOfCutterHead = ReadDouble(reader, "RotationSpeedOfCutterHead");
                    rec.TBMDrivingRecord.CutterHeadDetail.PenetrationOfCutterHead = ReadDouble(reader, "PenetrationOfCutterHead");
                    // deviation detail
                    rec.TBMDrivingRecord.DeviationDetail.ExcavDeviation = ReadDouble(reader, "ExcavDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.AbsoluteDeviationX = ReadDouble(reader, "AbsoluteDeviationX");
                    rec.TBMDrivingRecord.DeviationDetail.AbsoluteDeviationY = ReadDouble(reader, "AbsoluteDeviationY");
                    rec.TBMDrivingRecord.DeviationDetail.BeginFrontHorizontalDeviation = ReadDouble(reader, "BeginFrontHorizontalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.BeginFrontElevationalDeviation = ReadDouble(reader, "BeginFrontElevationalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.EndFrontHorizontalDeviation = ReadDouble(reader, "EndFrontHorizontalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.EndFrontElevationalDeviation = ReadDouble(reader, "EndFrontElevationalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.BeginRearHorizontalDeviation = ReadDouble(reader, "BeginRearHorizontalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.BeginRearElevationalDeviation = ReadDouble(reader, "BeginRearElevationalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.EndRearHorizontalDeviation = ReadDouble(reader, "EndRearHorizontalDeviation");
                    rec.TBMDrivingRecord.DeviationDetail.EndRearElevationalDeviation = ReadDouble(reader, "EndRearElevationalDeviation");
                    // angle detail
                    rec.TBMDrivingRecord.AngleDetail.FrontRotationAngleOfTBM = ReadDouble(reader, "FrontRotationAngleOfTBM");
                    rec.TBMDrivingRecord.AngleDetail.DipAngle = ReadDouble(reader, "DipAngle");
                    rec.TBMDrivingRecord.AngleDetail.RotationAngle = ReadDouble(reader, "RotationAngle");
                    rec.TBMDrivingRecord.AngleDetail.AzimuthAngle = ReadDouble(reader, "AzimuthAngle");
                    // travel detail
                    rec.TBMDrivingRecord.TravelDetail.BeginTravelDistance = ReadDouble(reader, "BeginTravelDistance");
                    rec.TBMDrivingRecord.TravelDetail.EndTravelDistance = ReadDouble(reader, "EndTravelDistance");
                    rec.TBMDrivingRecord.TravelDetail.DrivingMilage = ReadDouble(reader, "DrivingMilage");
                }
            }
            ///
            ///3.[TBMPostureRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "TBMPostureRecords"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    rec.TBMPostureRecord.CutterHeadHorizontalDeviation = ReadDouble(reader, "CutterHeadHorizontalDeviation");
                    rec.TBMPostureRecord.CutterHeadElevationalDeviation = ReadDouble(reader, "CutterHeadElevationalDeviation");
                    rec.TBMPostureRecord.TBMTailHorizontalDeviation = ReadDouble(reader, "TBMTailHorizontalDeviation");
                    rec.TBMPostureRecord.TBMTailElevationalDeviation = ReadDouble(reader, "TBMTailElevationalDeviation");
                    rec.TBMPostureRecord.TBMSlope = ReadDouble(reader, "TBMSlope");
                    rec.TBMPostureRecord.TBMRotationAngle = ReadString(reader, "TBMRotationAngle");
                }
            }
            ///
            ///4.[SLPostureRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLPostureRecords"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    rec.SLPostureRecord.SLHorizontalDeviation = ReadDouble(reader, "SLHorizontalDeviation");
                    rec.SLPostureRecord.SLElevationalDeviation = ReadDouble(reader, "SLElevationalDeviation");
                    // gap detail
                    rec.SLPostureRecord.GapDetail.SLGapUp = ReadDouble(reader, "SLGapUp");
                    rec.SLPostureRecord.GapDetail.SLGapDown = ReadDouble(reader, "SLGapDown");
                    rec.SLPostureRecord.GapDetail.SLGapLeft = ReadDouble(reader, "SLGapLeft");
                    rec.SLPostureRecord.GapDetail.SLGapRight = ReadDouble(reader, "SLGapRight");
                    rec.SLPostureRecord.GapDetail.SLOtherGaps = new double?[8];
                    for (int index = 0; index < 8; ++index)
                        rec.SLPostureRecord.GapDetail.SLOtherGaps[index] = ReadDouble(reader, "SLGap" + (index + 1).ToString());
                    // diameter detail
                    rec.SLPostureRecord.DiameterDetail.HorizontalDiameter = ReadDouble(reader, "HorizontalDiameter");
                    rec.SLPostureRecord.DiameterDetail.VerticalDiameter = ReadDouble(reader, "VerticalDiameter");
                    rec.SLPostureRecord.DiameterDetail.OtherDiameters = new double?[2];
                    for (int index = 0; index < 2; ++index)
                        rec.SLPostureRecord.DiameterDetail.OtherDiameters[index] = ReadDouble(reader, "Diamter" + (index + 1).ToString());
                    rec.SLPostureRecord.DiameterDetail.DeformationDescription = ReadString(reader, "DeformationDescription");
                }
            }
            ///
            ///5.[SLQualityRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLQualityRecords"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    SLQualityRecordType qualityRec = new SLQualityRecordType();
                    qualityRec.QualityDescription = ReadString(reader, "QualityDescription");
                    qualityRec.InspectionDate = ReadString(reader, "InspectionDate");
                    qualityRec.Repairment = ReadString(reader, "Repairment");
                    rec.SLQualityRecords.Add(qualityRec);
                }
            }
            ///
            ///6.[SLSettlementRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLSettlement"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    rec.SLSettlementRecords.LineNo = rec.LineNo;
                    rec.SLSettlementRecords.RingNo = rec.RingNo;
                    rec.SLSettlementRecords.Name = SL.name;
                    rec.SLSettlementRecords.ID = SL.id;

                    SLSettlementItem item = new SLSettlementItem();
                    item.Name = ReadString(reader, "Name");
                    item.Date = ReadDateTime(reader, "Date");
                    item.Total = ReadDouble(reader, "Total");
                    item.Inc = ReadDouble(reader, "Increasement");
                    item.Rate = ReadDouble(reader, "Rate");
                    item.InitialElev = ReadDouble(reader, "InitialElev");
                    item.Elevation = ReadDouble(reader, "Elevation");
                    rec.SLSettlementRecords.SLSettlementItems.Add(item);
                }
            }

            ///
            ///7.[SLConvergenceRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLConvergence"];
            if (table != null)
            {
                foreach (DataRow reader in table.Rows)
                {
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLConstructionRecordType rec = SL.ConstructionRecord;
                    rec.SLConvergenceRecords.LineNo = rec.LineNo;
                    rec.SLConvergenceRecords.RingNo = rec.RingNo;
                    rec.SLConvergenceRecords.Name = SL.name;
                    rec.SLConvergenceRecords.ID = SL.id;

                    SLConvergenceItem item = new SLConvergenceItem();
                    //item.Name = ReadString(reader, "Name");
                    item.Date = ReadDateTime(reader, "Date");
                    item.HorizontalRad = ReadDouble(reader, "HorizontalRad");
                    item.HorizontalDev = ReadDouble(reader, "HorizontalDeviation");
                    item.VerticalRad = ReadDouble(reader, "VerticalRad");
                    item.VerticalDev = ReadDouble(reader, "VerticalDeviation");
                    rec.SLConvergenceRecords.SLConvergenceItems.Add(item);
                }
            }

            ///
            ///8.[SLSpallRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLSpall"];
            if (table != null)
            {
                DataColumn column = table.Columns.Add("RingNo", typeof(int));
                foreach (DataRow reader in table.Rows)
                {
                    int? ringNo = ReadInt(reader, "StartRingNo");
                    reader.SetField(column, ringNo);
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLInspectionRecordType rec = SL.InspectionRecords;
                    rec.LineNo = SL.LineNo;
                    rec.RingNo = SL.RingNo;

                    SLSpallRecordItem item = new SLSpallRecordItem();
                    //item.Name = ReadString(reader, "Name");
                    item.LineNo = SL.LineNo;
                    item.StartMilage = ReadDouble(reader, "StartMilage");
                    item.EndMilage = ReadDouble(reader, "EndMilage");
                    item.StartRingNo = ReadInt(reader, "StartRingNo");
                    item.EndRingNo = ReadInt(reader, "EndRingNo");
                    item.SLCode = ReadString(reader, "SLCode");
                    item.LocalX = ReadDouble(reader, "LocalX");
                    item.LocalY = ReadDouble(reader, "LocalY");
                    item.Shape = ReadString(reader, "Shape");
                    item.Area = ReadDouble(reader, "Area");
                    item.Length = ReadDouble(reader, "Length");
                    item.Width = ReadDouble(reader, "Width");
                    item.Depth = ReadDouble(reader, "Depth");
                    item.Date = ReadDateTime(reader, "Date");
                    item.Document = ReadString(reader, "Document");
                    item.Discription = ReadString(reader,"Discription");
                    SL.InspectionRecords.SLSpallRecords.Add(item);
                }
            }

            ///
            ///9.[SLCrackRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "SLCrackRecord"];
            if (table != null)
            {
                DataColumn column = table.Columns.Add("RingNo", typeof(int));
                foreach (DataRow reader in table.Rows)
                {
                    int? ringNo = ReadInt(reader, "StartRingNo");
                    reader.SetField(column, ringNo);
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLInspectionRecordType rec = SL.InspectionRecords;
                    rec.LineNo = SL.LineNo;
                    rec.RingNo = SL.RingNo;

                    SLCrackRecordItem item = new SLCrackRecordItem();
                    item.LineNo = SL.LineNo;
                    item.StartMilage = ReadDouble(reader, "StartMilage");
                    item.EndMilage = ReadDouble(reader, "EndMilage");
                    item.StartRingNo = ReadInt(reader, "StartRingNo");
                    item.EndRingNo = ReadInt(reader, "EndRingNo");
                    item.SLCode = ReadString(reader, "SLCode");
                    item.Direction = ReadString(reader, "Direction");
                    item.Length = ReadDouble(reader, "Length");
                    item.Width = ReadDouble(reader, "Width");
                    item.Date = ReadDateTime(reader, "Date");
                    item.Document = ReadString(reader, "Document");
                    item.Discription = ReadString(reader, "Discription");
                    SL.InspectionRecords.SLCrackRecords.Add(item);
                }
            }

            ///
            ///10.[DislocationRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "Dislocation"];
            if (table != null)
            {
                DataColumn column = table.Columns.Add("RingNo", typeof(int));
                foreach (DataRow reader in table.Rows)
                {
                    int? ringNo = ReadInt(reader, "StartRingNo");
                    reader.SetField(column, ringNo);
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLInspectionRecordType rec = SL.InspectionRecords;
                    rec.LineNo = SL.LineNo;
                    rec.RingNo = SL.RingNo;

                    DislocationRecordItem item = new DislocationRecordItem();
                    item.LineNo = SL.LineNo;
                    item.StartMilage = ReadDouble(reader, "StartMilage");
                    item.EndMilage = ReadDouble(reader, "EndMilage");
                    item.StartRingNo = ReadInt(reader, "StartRingNo");
                    item.EndRingNo = ReadInt(reader, "EndRingNo");
                    item.SLCode = ReadString(reader, "SLCode");
                    item.Horizontal = ReadDouble(reader, "Horizontal");
                    item.Vertical = ReadDouble(reader, "Vertical");
                    item.Total = ReadDouble(reader, "Total");
                    item.Date = ReadDateTime(reader, "Date");
                    item.Document = ReadString(reader, "Document");
                    item.Discription = ReadString(reader, "Discription");
                    SL.InspectionRecords.DislocationRecords.Add(item);
                }
            }

            ///
            ///11.[JointOpeningRecords]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "JointOpening"];
            if (table != null)
            {
                DataColumn column = table.Columns.Add("RingNo", typeof(int));
                foreach (DataRow reader in table.Rows)
                {
                    int? ringNo = ReadInt(reader, "StartRingNo");
                    reader.SetField(column, ringNo);
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLInspectionRecordType rec = SL.InspectionRecords;
                    rec.LineNo = SL.LineNo;
                    rec.RingNo = SL.RingNo;

                    JointOpeningRecordItem item = new JointOpeningRecordItem();
                    item.LineNo = SL.LineNo;
                    item.StartMilage = ReadDouble(reader, "StartMilage");
                    item.EndMilage = ReadDouble(reader, "EndMilage");
                    item.StartRingNo = ReadInt(reader, "StartRingNo");
                    item.EndRingNo = ReadInt(reader, "EndRingNo");
                    item.SLCode1 = ReadString(reader, "SLCode1");
                    item.SLCode2 = ReadString(reader, "SLCode2");
                    item.Total = ReadDouble(reader, "Total");
                    item.Date = ReadDateTime(reader, "Date");
                    item.Document = ReadString(reader, "Document");
                    item.Discription = ReadString(reader, "Discription");
                    SL.InspectionRecords.JointOpeningRecords.Add(item);
                }
            }

            ///
            ///11.[LeakageRecord]
            ///
            table = objs.rawDataSet.Tables[_dbContext.TableNamePrefix + "Leakage"];
            if (table != null)
            {
                DataColumn column = table.Columns.Add("RingNo", typeof(int));
                foreach (DataRow reader in table.Rows)
                {
                    int? ringNo = ReadInt(reader, "StartRingNo");
                    reader.SetField(column, ringNo);
                    SegmentLining SL = _GetSL(objs, reader);
                    if (SL == null)
                        continue;

                    SLInspectionRecordType rec = SL.InspectionRecords;
                    rec.LineNo = SL.LineNo;
                    rec.RingNo = SL.RingNo;

                    LeakageRecordItem item = new LeakageRecordItem();
                    item.LineNo = SL.LineNo;
                    item.StartMilage = ReadDouble(reader, "StartMilage");
                    item.EndMilage = ReadDouble(reader, "EndMilage");
                    item.StartRingNo = ReadInt(reader, "StartRingNo");
                    item.EndRingNo = ReadInt(reader, "EndRingNo");
                    item.SLCode = ReadString(reader, "SLCode");
                    item.StartAngle = ReadDouble(reader, "StartAngle");
                    item.EndAngle = ReadDouble(reader, "EndAngle");
                    item.Shape = ReadString(reader, "Shape");
                    item.Area = ReadDouble(reader, "Area");
                    item.Speed = ReadDouble(reader, "Speed");
                    item.Status = ReadString(reader, "Status");
                    item.p = ReadString(reader, "p");
                    item.pH = ReadDouble(reader, "pH");
                    item.Date = ReadDateTime(reader, "Date");
                    item.Document = ReadString(reader, "Document");
                    item.Discription = ReadString(reader, "Discription");
                    item.WaterSample = ReadString(reader, "WaterSample");
                    SL.InspectionRecords.LeakageRecords.Add(item);
                }
            }
        }