public static BLLResult UpdateDetail(TDetail detail, List <TNode> nodes) { var result = new BLLResult(); using (var connection = SQLiteHelper.Connect()) { connection.Open(); var transaction = connection.BeginTransaction(); try { if (!detail.DbUpdate(connection)) { throw new NotImplementedException("Detail数据未按预期存储"); } if (!nodes.DbUpdate(connection)) { throw new NotImplementedException("Nodes数据未按预期存储"); } transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); result.IsSuccess = false; result.Message = ex.ToString(); } connection.Close(); } return(result); }
public static BLLResult UpdateDetail(TDetail detail, List <TDepthNode> depthNodes) { var result = new BLLResult(); using (var connection = SQLiteHelper.Connect()) { connection.Open(); var transaction = connection.BeginTransaction(); try { if (!detail.DbUpdate(connection)) { throw new NotImplementedException("Detail数据未按预期存储"); } if (!depthNodes.DbUpdate(connection)) { throw new NotImplementedException("Nodes数据未按预期存储"); } //0711TODO KO 更新TNodeElement if (!depthNodes.Select(c => new TDepthNodeElement(c.Segregation, c.NodeCode, c.Depth) { ElementIds = c.GetElementIds() }).DbInsertOrReplace(connection)) { throw new NotImplementedException("NodeElements数据未按预期存储"); } transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); result.IsSuccess = false; result.Message = ex.ToString(); } connection.Close(); } return(result); }