public static void DeleteRow(SQLiteConnection connection, long ID) { InsertPointModel model = SelectRow(connection, ID); gBlock.DeleteRow(ID, connection); DeleteOthers(model, connection); }
public static void DeleteRow(SQLiteConnection connection, string handle, long fileID) { InsertPointModel model = SelectRow(connection, handle, fileID); gBlock.DeleteRow(handle, fileID, connection); DeleteOthers(model, connection); }
public static void DeleteRow(SQLiteConnection connection, Dictionary <string, string> conDict, Dictionary <string, object> paraDict) { InsertPointModel model = SelectRow(connection, conDict, paraDict); gBlock.DeleteRow(conDict, paraDict, connection); DeleteOthers(model, connection); }
private static List <List <object> > GetItemsList(InsertPointModel model) { List <List <object> > items = new List <List <object> > { new List <object> { DBInsertPointName.ALIAS, DBInsertPointName_AT.alias, model.alias }, new List <object> { DBInsertPointName.ANAME, DBInsertPointName_AT.value_name, model.name }, new List <object> { DBInsertPointName.HANDLE, DBInsertPointName_AT.handle, model.handle }, new List <object> { DBInsertPointName.POSITION_ID, DBInsertPointName_AT.position, model.position.ID }, new List <object> { DBInsertPointName.MATRIX_ID, DBInsertPointName_AT.matrix, model.matrixTransform.ID }, new List <object> { DBInsertPointName.FILE_ID, DBInsertPointName_AT.file, model.file.ID }, }; return(items); }
public static void DeleteRow(SQLiteConnection connection, string handle, string relPath) { InsertPointModel model = SelectRow(connection, handle, relPath); gBlock.DeleteRow(handle, relPath, connection); DeleteOthers(model, connection); }
private static void DeleteOthers(InsertPointModel model, SQLiteConnection connection) { if (model != null) { DBPoint3D.DeleteRow(connection, model.position.ID); DBMatrix3d.DeleteRow(connection, model.matrixTransform.ID); } }
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); }
public static void InsertRow(SQLiteCommand command, InsertPointModel model) { List <List <object> > items = GetItemsList(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(DBInsertPointName.name, variables, paraDict, command); }
public static long UpdateRow(SQLiteConnection connection, InsertPointModel model) { using (SQLiteCommand command = connection.CreateCommand()) { DBInsertPointCommands.UpdateRow(command, model); int check = command.ExecuteNonQuery(); if (check == 1) { return(connection.LastInsertRowId); } else if (check == 0) { throw new Exception("DBInsertPoint -> UpdateRow -> No Row is Updated."); } throw new Exception("DBInsertPoint -> UpdateRow -> Update Point not successful."); } }
public static long InsertRow(ref InsertPointModel model, SQLiteConnection connection) { using (SQLiteCommand command = connection.CreateCommand()) { DBInsertPointCommands.InsertRow(command, model); int check = command.ExecuteNonQuery(); if (check == 1) { model.ID = connection.LastInsertRowId; return(model.ID); } else if (check == 0) { throw new Exception("DBInsertPoint -> Insert -> No Point Was Inserted"); } throw new Exception("DBInsertPoint -> Insert -> Insert Point not successful."); } }
private void FilloutVariables(BlockReference bref, Transaction tr) { model = new InsertPointModel(); model.handle = Goodies.ConvertHandleToString(bref.Handle); model.position = new Point3dModel(bref.Position.ToArray()); model.matrixTransform = new Matrix3dModel(bref.BlockTransform.ToArray()); foreach (ObjectId id in bref.AttributeCollection) { AttributeReference aRef = (AttributeReference)tr.GetObject(id, OpenMode.ForRead); if (aRef.Tag == InsertPointName.NAME) { model.name = aRef.TextString; } else if (aRef.Tag == InsertPointName.ALIAS) { model.alias = aRef.TextString; } } }
public static void UpdateRow(SQLiteCommand command, InsertPointModel model) { DBPoint3D.UpdateRow(model.position, command.Connection); DBMatrix3d.Update(command.Connection, model.matrixTransform); List <List <object> > items = GetItemsList(model); Dictionary <string, string> variables = new Dictionary <string, string>(); Dictionary <string, string> conditions = new Dictionary <string, string> { { DBInsertPointName.ID, DBInsertPointName_AT.id } }; 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(DBBlockName_AT.id, model.ID); DBCommand.UpdateRow(DBInsertPointName.name, variables, conditions, paraDict, command); }
public InsertPoint(InsertPointModel model) { this.model = model; }