private static FixtureUnitModel getItem(SQLiteDataReader reader, SQLiteConnection connection) { FixtureUnitModel model = new FixtureUnitModel(); long POSITION_ID = (long)reader[DBFixtureUnitName.POSITION_ID]; long TRANSFORM_ID = (long)reader[DBFixtureUnitName.MATRIX_ID]; model.handle = (string)reader[DBFixtureUnitName.HANDLE]; model.INDEX = (double)reader[DBFixtureUnitName.INDEX]; model.TAG = (string)reader[DBFixtureUnitName.TAG]; model.NUMBER = (string)reader[DBFixtureUnitName.NUMBER]; model.CW_DIA = (double)reader[DBFixtureUnitName.CW_DIA]; model.HW_DIA = (double)reader[DBFixtureUnitName.HW_DIA]; model.WASTE_DIA = (double)reader[DBFixtureUnitName.WASTE_DIA]; model.VENT_DIA = (double)reader[DBFixtureUnitName.VENT_DIA]; model.STORM_DIA = (double)reader[DBFixtureUnitName.STORM_DIA]; model.WSFU = (double)reader[DBFixtureUnitName.WSFU]; model.CWSFU = (double)reader[DBFixtureUnitName.CWSFU]; model.HWSFU = (double)reader[DBFixtureUnitName.HWSFU]; model.DFU = (double)reader[DBFixtureUnitName.DFU]; model.ID = (long)reader[DBFixtureUnitName.ID]; long FILE_ID = (long)reader[DBFixtureUnitName.FILE_ID]; model.A2 = (double)reader[DBFixtureUnitName.A2]; model.Y2 = (double)reader[DBFixtureUnitName.Y2]; model.X2 = (double)reader[DBFixtureUnitName.X2]; model.X2_2 = (double)reader[DBFixtureUnitName.X2_2]; model.A3 = (double)reader[DBFixtureUnitName.A3]; model.A1 = (double)reader[DBFixtureUnitName.A1]; model.D1 = (double)reader[DBFixtureUnitName.D1]; long tagID = (long)reader[DBFixtureUnitName.tagPos]; long ventID = (long)reader[DBFixtureUnitName.ventPos]; long hotStubID = (long)reader[DBFixtureUnitName.hotStub]; long coldStubID = (long)reader[DBFixtureUnitName.coldStub]; long drainPosID = (long)reader[DBFixtureUnitName.drainPos]; long M_ID = (long)reader[DBFixtureUnitName.M_ID]; long R1_ID = (long)reader[DBFixtureUnitName.R1_ID]; long V_ID = (long)reader[DBFixtureUnitName.V_ID]; model.matrixTransform = DBMatrix3d.SelectRow(connection, TRANSFORM_ID); model.position = DBPoint3D.SelectRow(connection, POSITION_ID); model.file = DBDwgFile.SelectRow(connection, FILE_ID); model.tagPos = DBPoint3D.SelectRow(connection, tagID); model.ventPos = DBPoint3D.SelectRow(connection, ventID); model.hotStub = DBPoint3D.SelectRow(connection, hotStubID); model.coldStub = DBPoint3D.SelectRow(connection, coldStubID); model.drainPos = DBPoint3D.SelectRow(connection, drainPosID); model.M = DBPoint3D.SelectRow(connection, M_ID); model.R1 = DBPoint3D.SelectRow(connection, R1_ID); model.V = DBPoint3D.SelectRow(connection, V_ID); return(model); }
/// <summary> /// Check whether or not file and database has different date. /// This is used to decide whether or not to read from database or file Dwg. /// </summary> /// <param name="dwgPath">Full Dwg Path</param> /// <returns></returns> public static bool IsDateTheSame(string dwgPath, SQLiteConnection connection) { if (!IsPathInDatabase(dwgPath, connection)) { return(false); } string relPath = MakeRelativePath(dwgPath); DwgFileModel file = DBDwgFile.SelectRow(connection, relPath); return(file.modifieddate == GetModifiedOfFile(dwgPath).Ticks); }
private static TableModel CreateModel(SQLiteDataReader reader, SQLiteConnection connection) { TableModel model = new TableModel(); model.ID = Convert.ToInt64(reader[DBTableName.ID]); model.handle = Convert.ToString(reader[DBTableName.HANDLE]); model.matrixTransform = DBMatrix3d.SelectRow(connection, Convert.ToInt64(reader[DBTableName.MATRIX_ID])); model.position = DBPoint3D.SelectRow(connection, Convert.ToInt64(reader[DBTableName.POSITION_ID])); model.ALIAS = Convert.ToString(reader[DBTableName.ALIAS]); model.A_VALUE = Convert.ToString(reader[DBTableName.A_VALUE]); model.file = DBDwgFile.SelectRow(connection, Convert.ToInt64(reader[DBTableName.FILE_ID])); return(model); }
/// <summary> /// Read Node File From Database, Fill Out The NODEDWG /// Path must be FULL PATH of a DWG from the database /// </summary> /// <param name="connection"></param> /// <param name="path">Note PATH</param> public void ReadFromDatabase(SQLiteConnection connection, string pathDwg) { FixtureBoxSet.Clear(); InsertPointSet.Clear(); FixtureDetailSet.Clear(); TableDataSet.Clear(); string relPath = GoodiesPath.MakeRelativePath(pathDwg); file = DBDwgFile.SelectRow(connection, relPath); if (file == null || file.ID == ConstantName.invalidNum) { MessageBox.Show("NODEDWG -> ReadFromDatabase -> File Not Found"); return; } foreach (FixtureBeingUsedAreaModel fixtureBox in DBFixtureBeingUsedArea.SelectRows(connection, file.ID)) { FixtureBeingUsedArea fixtureArea = new FixtureBeingUsedArea(fixtureBox); //this line is very important. You have to make sure they have file model in each fixtureArea; //this won't complicate the program as we pass the pointer. FixtureBoxSet.Add(fixtureArea); } foreach (FixtureDetailsModel detailModel in DBFixtureDetails.SelectRows(connection, file.ID)) { FixtureDetails fd = new FixtureDetails(detailModel); FixtureDetailSet.Add(fd); } foreach (InsertPointModel insertPointModel in DBInsertPoint.SelectRows(connection, file.ID)) { InsertPoint ip = new InsertPoint(insertPointModel); InsertPointSet.Add(ip); } foreach (TableModel model in DBTable.SelectRows(connection, file.ID)) { TableData table = new TableData(model); TableDataSet.Add(table); } }
private static AreaBorderModel GetModelFromReader(SQLiteDataReader reader, SQLiteConnection connection) { AreaBorderModel model = new AreaBorderModel(); model.ID = (long)reader[DBAreaBorderNames.ID]; model.handle = (string)reader[DBAreaBorderNames.HANDLE]; model.position = DBPoint3D.SelectRow(connection, (long)reader[DBAreaBorderNames.POSITION_ID]); model.pointTop = DBPoint3D.SelectRow(connection, (long)reader[DBAreaBorderNames.POINT_TOP_ID]); model.pointBottom = DBPoint3D.SelectRow(connection, (long)reader[DBAreaBorderNames.POINT_BOTTOM_ID]); model.origin = DBPoint3D.SelectRow(connection, (long)reader[DBAreaBorderNames.ORIGIN_ID]); model.matrixTransform = DBMatrix3d.SelectRow(connection, (long)reader[DBAreaBorderNames.MATRIX_ID]); model.X = (double)reader[DBAreaBorderNames.X]; model.Y = (double)reader[DBAreaBorderNames.Y]; model.file = DBDwgFile.SelectRow(connection, (long)reader[DBAreaBorderNames.FILE_ID]); if (model.ID == ConstantName.invalidNum) { model = null; } return(model); }