protected InsertSections GetTableInsert(TableKey table) { InsertSections result = null; if (_tableToInsertStatments.TryGetValue(table, out result)) { return(result); } result = new InsertSections( ); result.InsertTemplate = SqlInsertStatments.GetInsertIntoTable(table); result.TableName = table.Name; _tableToInsertStatments.Add(table, result); return(result); }
protected virtual void InsertColumnValue ( ColumnInfo column, IDicomDataParameter dicomParam, IDbCommand insertCommand ) { InsertSections insert = GetTableInsert(column.Table); insert.ColumnNames.Add(column.Name); insert.ParametersValueNames.Add("@" + column.Name); //TODO: add a parameter name to the column class //insert.ParametersValueNames.Add ( column.Values[0] ) ; System.Data.SqlClient.SqlParameter param; object value = DBNull.Value; if (null != column.Values && column.Values.Count != 0) { value = column.Values [0]; if (null == value) { value = DBNull.Value; } } param = new System.Data.SqlClient.SqlParameter("@" + column.Name, value); Parameters.Add(param); if (null != insertCommand) { insertCommand.Parameters.Add(param); } }