public BeheerContextEntity() { Attributes = new Dictionary<string, AttributeValue>(); Details = new List<BeheerContextEntity>(); Parent = new ParentKeyEntity(); SelectedIndex = -1;//not selected MasterId = -1; }
public int Insert(ParentKeyEntity masterForeignKey, BeheerContextEntity newBusinessObject) { int rowsAffected = 0; using (OracleConnection conn = new OracleConnection(_oradb)) { conn.Open(); var trans = conn.BeginTransaction(); try { string sqlUpdate = @"INSERT INTO {0} ({1}, {3}) VALUES ('{2}','{4}') "; sqlUpdate = string.Format(sqlUpdate, newBusinessObject.Tablename, newBusinessObject.DataKeyName, newBusinessObject.DataKeyValue, masterForeignKey.DataKeyName, masterForeignKey.DataKeyValue); var cmd = new OracleCommand { Connection = conn, CommandText = sqlUpdate, CommandType = CommandType.Text }; cmd.Connection = conn; rowsAffected = cmd.ExecuteNonQuery(); trans.Commit(); } catch (Exception) { trans.Rollback(); throw; } } return rowsAffected; }