Beispiel #1
0
        public void CustomSIFElementEncoding()
        {
            SIF_Query q = new SIF_Query();
            q.SIF_QueryObject = new SIF_QueryObject( StudentDTD.STUDENTPERSONAL.Name );
            SIF_Conditions conditions = new SIF_Conditions( ConditionType.NONE );
            conditions.AddSIF_Condition( "Name[@Type=\"05\"]/LastName", Operators.EQ, "Cookie" );
            q.SetSIF_ConditionGroup( ConditionType.NONE, conditions );

            string xml;
            using ( StringWriter w = new StringWriter() )
            {
                SifWriter writer = new SifWriter( w );
                writer.Write( q );
                writer.Flush();
                writer.Close();
                xml = w.ToString();
            }

            Console.WriteLine( xml );
            // Mainly, just check to make sure that the single quotes didn't get encoded
            int index = xml.IndexOf( """ );
            Assert.AreEqual( -1, index, "Single quotes should not be encoded" );
        }
Beispiel #2
0
 ///<summary>Sets the value of the <c>&lt;SIF_ConditionGroup&gt;</c> element.</summary>
 /// <param name="Type">
 ///         The Boolean operator for joining conditions (SIF_Conditions elements) within this element.  Note that None should be used if there is only one
 ///         SIF_Conditions element.
 ///       </param>
 /// <param name="SifConditions">A SIF_Conditions</param>
 ///<remarks>
 /// <para>This form of <c>setSIF_ConditionGroup</c> is provided as a convenience method
 /// that is functionally equivalent to the <c>SIF_ConditionGroup</c></para>
 /// <para>Version: 2.6</para>
 /// <para>Since: 2.0</para>
 /// </remarks>
 public void SetSIF_ConditionGroup( ConditionType Type, SIF_Conditions SifConditions )
 {
     RemoveChild( InfraDTD.SIF_WHERE_SIF_CONDITIONGROUP);
     AddChild( InfraDTD.SIF_WHERE_SIF_CONDITIONGROUP, new SIF_ConditionGroup( Type, SifConditions ) );
 }
 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="type">
 ///         The Boolean operator for joining conditions (SIF_Conditions elements) within this element.  Note that None should be used if there is only one
 ///         SIF_Conditions element.
 ///       </param>
 ///<param name="sifConditions">A SIF_Conditions</param>
 ///
 public SIF_ConditionGroup( ConditionType type, SIF_Conditions sifConditions )
     : base(InfraDTD.SIF_CONDITIONGROUP)
 {
     this.SetType( type );
     this.AddSIF_Conditions( sifConditions );
 }
 /// <summary>
 /// Sets all SIF_Conditions object instances. All existing 
 /// <c>SIF_Conditions</c> instances 
 /// are removed and replaced with this list. Calling this method with the 
 /// parameter value set to null removes all <c>SIF_Conditionses</c>.
 /// </summary>
 /// <remarks>
 /// <para>Version: 2.6</para>
 /// <para>Since: 1.1</para>
 /// </remarks>
 public void SetSIF_Conditionses( SIF_Conditions[] items)
 {
     SetChildren( InfraDTD.SIF_CONDITIONGROUP_SIF_CONDITIONS, items );
 }
 /// <summary>Adds a new <c>&lt;SIF_Conditions&gt;</c> child element.</summary>
 /// <param name="val">A SIF_Conditions object</param>
 /// <remarks>
 /// <para>Version: 2.6</para>
 /// <para>Since: 1.1</para>
 /// </remarks>
 public void AddSIF_Conditions( SIF_Conditions val )
 {
     AddChild( InfraDTD.SIF_CONDITIONGROUP_SIF_CONDITIONS, val );
 }
Beispiel #6
0
 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="type">
 ///         The Boolean operator for joining conditions (SIF_Conditions elements) within this element.  Note that None should be used if there is only one
 ///         SIF_Conditions element.
 ///       </param>
 ///<param name="sifConditions">A SIF_Conditions</param>
 ///
 public SIF_ConditionGroup(ConditionType type, SIF_Conditions sifConditions) : base(InfraDTD.SIF_CONDITIONGROUP)
 {
     this.SetType(type);
     this.AddSIF_Conditions(sifConditions);
 }
Beispiel #7
0
 /// <summary>Adds a new <c>&lt;SIF_Conditions&gt;</c> child element.</summary>
 /// <param name="val">A SIF_Conditions object</param>
 /// <remarks>
 /// <para>Version: 2.6</para>
 /// <para>Since: 1.1</para>
 /// </remarks>
 public void AddSIF_Conditions(SIF_Conditions val)
 {
     AddChild(InfraDTD.SIF_CONDITIONGROUP_SIF_CONDITIONS, val);
 }
Beispiel #8
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_Conditions createConditions(Query query, ConditionGroup group, SifVersion effectiveVersion)
 {
     ConditionType typ = ConditionType.NONE;
     if (group.Operator == GroupOperator.And)
     {
         typ = ConditionType.AND;
     }
     else if (group.Operator == GroupOperator.Or)
     {
         typ = ConditionType.OR;
     }
     Condition[] conditions = group.Conditions;
     SIF_Conditions conds = new SIF_Conditions(conditions.Length > 1 ? typ : ConditionType.NONE);
     foreach (Condition c in conditions)
     {
         conds.AddSIF_Condition(
             c.GetXPath(query, effectiveVersion),
             Operators.Wrap(c.Operators.ToString()),
             c.Value);
     }
     return conds;
 }
Beispiel #10
0
 ///<summary>Sets the value of the <c>&lt;SIF_ConditionGroup&gt;</c> element.</summary>
 /// <param name="Type">
 ///         The Boolean operator for joining conditions (SIF_Conditions elements) within this element.  Note that None should be used if there is only one
 ///         SIF_Conditions element.
 ///       </param>
 /// <param name="SifConditions">A SIF_Conditions</param>
 ///<remarks>
 /// <para>This form of <c>setSIF_ConditionGroup</c> is provided as a convenience method
 /// that is functionally equivalent to the <c>SIF_ConditionGroup</c></para>
 /// <para>Version: 2.6</para>
 /// <para>Since: 2.0</para>
 /// </remarks>
 public void SetSIF_ConditionGroup(ConditionType Type, SIF_Conditions SifConditions)
 {
     RemoveChild(InfraDTD.SIF_WHERE_SIF_CONDITIONGROUP);
     AddChild(InfraDTD.SIF_WHERE_SIF_CONDITIONGROUP, new SIF_ConditionGroup(Type, SifConditions));
 }