/// <summary> Populates a query object created by the base class. </summary> /// <param name="context"></param> /// <param name="pQuery"></param> protected override void PopulateQuery(CodeActivityContext context, ImpacRdbQuery pQuery) { // Activity inputs int patId1 = PatId1.Get(context); string commentFieldString = CommentFieldString.Get(context); string protocolFieldString = ProtocolFieldString.Get(context); EntityBooleanOp logicalOperator = ((LogicalOperator.Expression != null) ? LogicalOperator.Get(context) : EntityBooleanOp.Or) ?? EntityBooleanOp.Or; // The logical NOT operator is not supported, because the meaning of the result is vague. if (logicalOperator == EntityBooleanOp.Not) { string message = String.Format("The Not value of the logical operator is not supported by the {0}", GetType().Name); throw new ArgumentException(message); } // Build the query pQuery.AddClause(Course.Pat_ID1EntityColumn, EntityQueryOp.EQ, patId1); if ((commentFieldString == null) && (protocolFieldString == null)) { // Don't want to change the base class to handle "empty" queries, so just perform a ridiculous query that will return // an empty result (in case none of the string identifiers have been supplied) pQuery.AddClause(Course.NotesEntityColumn.ColumnName, EntityQueryOp.EQ, "Dummy string to force empty result!"); } else { if (commentFieldString != null) { if (commentFieldString == string.Empty) { pQuery.AddClause(Course.NotesEntityColumn, EntityQueryOp.EQ, string.Empty); } else { pQuery.AddClause(Course.NotesEntityColumn, EntityQueryOp.Contains, commentFieldString); } } if (protocolFieldString != null) { if (protocolFieldString == string.Empty) { pQuery.AddClause(Course.ProtocolEntityColumn, EntityQueryOp.EQ, string.Empty); } else { pQuery.AddClause(Course.ProtocolEntityColumn, EntityQueryOp.Contains, protocolFieldString); } } if ((commentFieldString != null) && (protocolFieldString != null)) { pQuery.AddOperator(logicalOperator); } } }
/// <summary> Populates a query object created by the base class. </summary> /// <param name="context"></param> /// <param name="pQuery"></param> protected override void PopulateQuery(CodeActivityContext context, ImpacRdbQuery pQuery) { // Activity inputs int patId1 = PatId1.Get(context); string commentFieldString = CommentFieldString.Get(context); string patternFieldString = PatternFieldString.Get(context); EntityBooleanOp logicalOperator = ((LogicalOperator.Expression != null) ? LogicalOperator.Get(context) : EntityBooleanOp.Or) ?? EntityBooleanOp.Or; // Build the query pQuery.AddClause(PrescriptionSite.Pat_ID1EntityColumn, EntityQueryOp.EQ, patId1); pQuery.AddClause(PrescriptionSite.VersionEntityColumn, EntityQueryOp.EQ, 0); if ((commentFieldString == null) && (patternFieldString == null)) { // Don't want to change the base class to handle "empty" queries, so just perform a ridiculous query that will return // an empty result (in case none of the string identifiers have been supplied) pQuery.AddClause(PrescriptionSite.PrescriptionDescriptionEntityColumn.ColumnName, EntityQueryOp.EQ, "Dummy string to force empty result!"); } else { if (commentFieldString != null) { if (commentFieldString == string.Empty) { pQuery.AddClause(PrescriptionSite.PrescriptionDescriptionEntityColumn, EntityQueryOp.EQ, string.Empty); } else { pQuery.AddClause(PrescriptionSite.PrescriptionDescriptionEntityColumn, EntityQueryOp.Contains, commentFieldString); } } if (patternFieldString != null) { if (patternFieldString == string.Empty) { pQuery.AddClause(PrescriptionSite.Frac_PatternEntityColumn, EntityQueryOp.EQ, string.Empty); } else { pQuery.AddClause(PrescriptionSite.Frac_PatternEntityColumn, EntityQueryOp.Contains, patternFieldString); } } if ((commentFieldString != null) && (patternFieldString != null)) { pQuery.AddOperator(logicalOperator); } } pQuery.AddOrderBy(PrescriptionSite.DisplaySequenceEntityColumn); }