protected virtual void CopyModel(BlockModelBase model)
 {
     ID              = model.ID;
     handle          = model.handle;
     position        = model.position;
     matrixTransform = model.matrixTransform;
     file            = model.file;
 }
Example #2
0
        private static List <List <object> > getItems(Matrix3dModel model)
        {
            List <List <object> > items = new List <List <object> >
            {
                new List <object> {
                    DBMatrixName.R00, DBMatrixName_AT.r00, model.index[0]
                },
                new List <object> {
                    DBMatrixName.R01, DBMatrixName_AT.r01, model.index[1]
                },
                new List <object> {
                    DBMatrixName.R02, DBMatrixName_AT.r02, model.index[2]
                },
                new List <object> {
                    DBMatrixName.R03, DBMatrixName_AT.r03, model.index[3]
                },
                new List <object> {
                    DBMatrixName.R10, DBMatrixName_AT.r10, model.index[4]
                },
                new List <object> {
                    DBMatrixName.R11, DBMatrixName_AT.r11, model.index[5]
                },
                new List <object> {
                    DBMatrixName.R12, DBMatrixName_AT.r12, model.index[6]
                },
                new List <object> {
                    DBMatrixName.R13, DBMatrixName_AT.r13, model.index[7]
                },
                new List <object> {
                    DBMatrixName.R20, DBMatrixName_AT.r20, model.index[8]
                },
                new List <object> {
                    DBMatrixName.R21, DBMatrixName_AT.r21, model.index[9]
                },
                new List <object> {
                    DBMatrixName.R22, DBMatrixName_AT.r22, model.index[10]
                },
                new List <object> {
                    DBMatrixName.R23, DBMatrixName_AT.r23, model.index[11]
                },
                new List <object> {
                    DBMatrixName.R30, DBMatrixName_AT.r30, model.index[12]
                },
                new List <object> {
                    DBMatrixName.R31, DBMatrixName_AT.r31, model.index[13]
                },
                new List <object> {
                    DBMatrixName.R32, DBMatrixName_AT.r32, model.index[14]
                },
                new List <object> {
                    DBMatrixName.R33, DBMatrixName_AT.r33, model.index[15]
                }
            };

            return(items);
        }
        private static FixtureDetailsModel GetFixture(SQLiteDataReader reader, SQLiteConnection connection)
        {
            FixtureDetailsModel model;

            long   POSITION_ID  = (long)reader[DBFixtureDetailsNames.POSITION_ID];
            long   TRANSFORM_ID = (long)reader[DBFixtureDetailsNames.MATRIX_ID];
            string HANDLE       = (string)reader[DBFixtureDetailsNames.HANDLE];
            double INDEX        = (double)reader[DBFixtureDetailsNames.INDEXX];
            string FIXTURE_NAME = (string)reader[DBFixtureDetailsNames.FIXTURE_NAME];
            string TAG          = (string)reader[DBFixtureDetailsNames.TAG];
            string NUMBER       = (string)reader[DBFixtureDetailsNames.NUMBER];
            double CW_DIA       = (double)reader[DBFixtureDetailsNames.CW_DIA];
            double HW_DIA       = (double)reader[DBFixtureDetailsNames.HW_DIA];
            double WASTE_DIA    = (double)reader[DBFixtureDetailsNames.WASTE_DIA];
            double VENT_DIA     = (double)reader[DBFixtureDetailsNames.VENT_DIA];
            double STORM_DIA    = (double)reader[DBFixtureDetailsNames.STORM_DIA];
            double WSFU         = (double)reader[DBFixtureDetailsNames.WSFU];
            double CWSFU        = (double)reader[DBFixtureDetailsNames.CWSFU];
            double HWSFU        = (double)reader[DBFixtureDetailsNames.HWSFU];
            double DFU          = (double)reader[DBFixtureDetailsNames.DFU];
            string DESCRIPTION  = (string)reader[DBFixtureDetailsNames.DESCRIPTION];
            long   ID           = (long)reader[DBFixtureDetailsNames.ID];
            long   FILE_ID      = (long)reader[DBFixtureDetailsNames.FILE_ID];

            Matrix3dModel matrix   = DBMatrix3d.SelectRow(connection, TRANSFORM_ID);
            Point3dModel  position = DBPoint3D.SelectRow(connection, POSITION_ID);
            DwgFileModel  file     = DBDwgFile.SelectRow(connection, FILE_ID);

            model                 = new FixtureDetailsModel();
            model.position        = position;
            model.matrixTransform = matrix;
            model.handle          = HANDLE;
            model.INDEX           = INDEX;
            model.FIXTURENAME     = FIXTURE_NAME;
            model.TAG             = TAG;
            model.NUMBER          = NUMBER;
            model.CW_DIA          = CW_DIA;
            model.HW_DIA          = HW_DIA;
            model.WASTE_DIA       = WASTE_DIA;
            model.VENT_DIA        = VENT_DIA;
            model.STORM_DIA       = STORM_DIA;
            model.WSFU            = WSFU;
            model.CWSFU           = CWSFU;
            model.HWSFU           = HWSFU;
            model.DFU             = DFU;
            model.DESCRIPTION     = DESCRIPTION;
            model.ID              = ID;
            model.file            = file;

            return(model);
        }
Example #4
0
        public static void Insert(SQLiteCommand command, Matrix3dModel model)
        {
            List <List <object> >       items     = getItems(model);
            List <string>               variables = new List <string>();
            Dictionary <string, object> paraDict  = new Dictionary <string, object>();

            foreach (List <object> item in items)
            {
                variables.Add((string)item[0]);
                paraDict.Add((string)item[1], item[2]);
            }

            DBCommand.InsertCommand(DBMatrixName.name, variables, paraDict, command);
        }
Example #5
0
        private static InsertPointModel GetModel(SQLiteDataReader reader, SQLiteConnection connection)
        {
            string        alias   = (string)reader[DBInsertPointName.ALIAS];
            string        name    = (string)reader[DBInsertPointName.ANAME];
            long          ID      = (long)reader[DBInsertPointName.ID];
            Point3dModel  pos     = DBPoint3D.SelectRow(connection, (long)reader[DBInsertPointName.POSITION_ID]);
            string        handle1 = (string)reader[DBInsertPointName.HANDLE];
            DwgFileModel  file    = DBDwgFile.SelectRow(connection, (long)reader[DBInsertPointName.FILE_ID]);
            Matrix3dModel matrix  = DBMatrix3d.SelectRow(connection, (long)reader[DBInsertPointName.MATRIX_ID]);

            InsertPointModel model = new InsertPointModel(alias, name, ID, file, handle1, pos, matrix);

            return(model);
        }
Example #6
0
 public static long Update(SQLiteConnection connection, Matrix3dModel model)
 {
     using (SQLiteCommand command = connection.CreateCommand())
     {
         DBMatrix3dCommands.Update(command, model);
         long check = command.ExecuteNonQuery();
         if (check == 1)
         {
             return(connection.LastInsertRowId);
         }
         else if (check == 0)
         {
             //throw new Exception("DBMatrix3d -> Update -> No Row Is Update.");
         }
         throw new Exception("DBMatrix3d -> Update -> Update Is Not Successful.");
     }
 }
Example #7
0
 public static long Insert(SQLiteConnection connection, ref Matrix3dModel model)
 {
     using (SQLiteCommand command = connection.CreateCommand())
     {
         DBMatrix3dCommands.Insert(command, model);
         long check = command.ExecuteNonQuery();
         if (check == 1)
         {
             model.ID = connection.LastInsertRowId;
             return(model.ID);
         }
         else if (check == 0)
         {
             throw new Exception("DBMatrix3d -> Insert -> No Row Is Inserted.");
         }
         throw new Exception("DBMatrix3d -> Insert -> Insert Is Not Successful.");
     }
 }
Example #8
0
        public static void Update(SQLiteCommand command, Matrix3dModel model)
        {
            List <List <object> > items = getItems(model);

            Dictionary <string, string> conDict = new Dictionary <string, string> {
                { DBMatrixName.ID, DBMatrixName_AT.id }
            };
            Dictionary <string, string> variables = new Dictionary <string, string>();
            Dictionary <string, object> paraDict  = new Dictionary <string, object>();

            foreach (List <object> item in items)
            {
                variables.Add((string)item[0], (string)item[1]);
                paraDict.Add((string)item[1], item[2]);
            }

            paraDict.Add(DBMatrixName_AT.id, model.ID);

            DBCommand.UpdateRow(DBMatrixName.name, variables, conDict, paraDict, command);
        }