///<summary>Sets the value of the <c>&lt;SIF_Where&gt;</c> element.</summary>
 /// <param name="SifConditionGroup">A SIF_ConditionGroup</param>
 ///<remarks>
 /// <para>This form of <c>setSIF_Where</c> is provided as a convenience method
 /// that is functionally equivalent to the <c>SIF_Where</c></para>
 /// <para>Version: 2.5</para>
 /// <para>Since: 2.0</para>
 /// </remarks>
 public void SetSIF_Where( SIF_ConditionGroup SifConditionGroup )
 {
     RemoveChild( InfraDTD.SIF_EXTENDEDQUERY_SIF_WHERE);
     AddChild( InfraDTD.SIF_EXTENDEDQUERY_SIF_WHERE, new SIF_Where( SifConditionGroup ) );
 }
Beispiel #2
0
 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="sifConditionGroup">A SIF_ConditionGroup</param>
 ///
 public SIF_Where( SIF_ConditionGroup sifConditionGroup )
     : base(InfraDTD.SIF_WHERE)
 {
     this.SIF_ConditionGroup = sifConditionGroup;
 }
Beispiel #3
0
 ///<summary>Sets the value of the <c>&lt;SIF_Where&gt;</c> element.</summary>
 /// <param name="SifConditionGroup">A SIF_ConditionGroup</param>
 ///<remarks>
 /// <para>This form of <c>setSIF_Where</c> is provided as a convenience method
 /// that is functionally equivalent to the <c>SIF_Where</c></para>
 /// <para>Version: 2.6</para>
 /// <para>Since: 2.0</para>
 /// </remarks>
 public void SetSIF_Where(SIF_ConditionGroup SifConditionGroup)
 {
     RemoveChild(InfraDTD.SIF_EXTENDEDQUERY_SIF_WHERE);
     AddChild(InfraDTD.SIF_EXTENDEDQUERY_SIF_WHERE, new SIF_Where(SifConditionGroup));
 }
Beispiel #4
0
        public void testCreateWithSIF_Query()
        {
            SIF_Query q = new SIF_Query( new SIF_QueryObject(
                                             ReportingDTD.STUDENTLOCATOR.Name ) );
            SIF_ConditionGroup scg = new SIF_ConditionGroup();
            scg.SetType( ConditionType.NONE );

            SIF_Condition sifCondition = new SIF_Condition(
                "RequestingAgencyId[@Type=\"School\"]", Operators.EQ, "2001" );
            SIF_Conditions conds = new SIF_Conditions( ConditionType.NONE );
            conds.AddChild( sifCondition );
            scg.AddSIF_Conditions( conds );
            q.SIF_ConditionGroup = scg;

            Query query = new Query( q );

            Assert.IsTrue( query.HasConditions );
            ConditionGroup[] conditions = query.Conditions;
            Assert.AreEqual( 1, conditions.Length, "One Condition Group" );
            Assert.AreEqual( GroupOperator.None, conditions[0].Operator, "None" );
            Condition condition = conditions[0].Conditions[0];
            Assert.AreEqual( "2001", condition.Value, "RequestingAgencyId" );
            Assert.AreEqual( ComparisonOperators.EQ, condition.Operators, "RequestingAgencyId" );
            Assert.AreEqual( ReportingDTD.STUDENTLOCATOR_REQUESTINGAGENCYID, condition.Field, "RequestingAgencyId" );
        }
        private static SIF_ConditionGroup createConditionGroup(Query query, SifVersion effectiveVersion)
        {
            // Create the hierarchy SIF_ConditionGroup
            //                              >    SIF_Conditons
            //                                        > SIF_Condition

            // From
            //                       ConditionGroup
            //								> [ConditionGroup (Optional)]
            //										> Condition

            SIF_ConditionGroup returnGroup = new SIF_ConditionGroup();
            returnGroup.Type = ConditionType.NONE.ToString();
            ConditionGroup cg = query.RootConditionGroup;
            ConditionGroup[] groups = cg.Groups;
            if (groups != null && groups.Length > 0)
            {
                //
                //	There's one or more ConditionGroups...
                // 	These get translated to SIF_Conditions elements
                //
                if (cg.Operator == GroupOperator.Or)
                {
                    returnGroup.Type = ConditionType.OR.ToString();
                }
                else if (cg.Operator == GroupOperator.And)
                {
                    returnGroup.Type = ConditionType.AND.ToString();
                }

                foreach (ConditionGroup group in groups)
                {
                    returnGroup.AddSIF_Conditions(createConditions(query, group, effectiveVersion));
                }
            }
            else
            {
                //
                //	There are no SIF_Conditions groups, so build one...
                //
                returnGroup.AddSIF_Conditions(createConditions(query, cg, effectiveVersion));
            }
            return returnGroup;
        }
Beispiel #6
0
 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="sifConditionGroup">A SIF_ConditionGroup</param>
 ///
 public SIF_Where(SIF_ConditionGroup sifConditionGroup) : base(InfraDTD.SIF_WHERE)
 {
     this.SIF_ConditionGroup = sifConditionGroup;
 }