コード例 #1
0
        public void DemoAttributes()
        {
            var query = new FetchQuery("lead")
                        .Filter(f => f.Gt("budgetamount", 5000))
                        .Attributes("fullname", "companyname", "budgetamount");

            var fetchxml = query.ToString();

            Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-16""?>
<fetch xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <entity name=""lead"">
    <filter>
      <condition attribute=""budgetamount"" operator=""gt"" value=""5000"" />
    </filter>
    <attribute name=""fullname"" />
    <attribute name=""companyname"" />
    <attribute name=""budgetamount"" />
  </entity>
</fetch>", fetchxml);
        }
コード例 #2
0
        public void DemoFilter()
        {
            var query = new FetchQuery("contact")
                        .Attributes("firstname", "lastname", "fullname")
                        .Filter(f => f
                                .SubFilterOr(f2 => f2
                                             .SubFilterAnd(f3 => f3
                                                           .Eq("firstname", "Sam")
                                                           .Eq("lastname", "Jones"))
                                             .SubFilterAnd(f3 => f3
                                                           .Like("lastname", "%(sample)%"))))
                        .AllAttributes();

            var fetchxml = query.ToString();

            Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-16""?>
<fetch xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <entity name=""contact"">
    <filter>
      <filter type=""or"">
        <filter>
          <condition attribute=""firstname"" operator=""eq"" value=""Sam"" />
          <condition attribute=""lastname"" operator=""eq"" value=""Jones"" />
        </filter>
        <filter>
          <condition attribute=""lastname"" operator=""like"" value=""%(sample)%"" />
        </filter>
      </filter>
    </filter>
    <attribute name=""firstname"" />
    <attribute name=""lastname"" />
    <attribute name=""fullname"" />
    <all-attributes />
  </entity>
</fetch>", fetchxml);
        }
コード例 #3
0
 public override IList <string> GetQueryValue(string key)
 {
     return(FetchQuery.GetOrDefault(key));
 }
コード例 #4
0
 AskObject[] FetchObject(FetchQuery fetchQuery)
 {
     float[] centerPoint = fetchQuery.centerPoint;
     int targetId = fetchQuery.targetId;
     AskObject[] result=new AskObject[1];
     try {
         KdTreeNode<float, int>[] objects = KDTree.RadialSearch(centerPoint,4*maxRadius,100);
         for (int i=0;i<objects.Length;i++)
         {
             if(targetId==(idMap[objects[i].Value]).targetId)
             {
                 result[0]=idMap[objects[i].Value];
                 break;
             }
         }
     }
     catch (Exception e) {
         Console.WriteLine (e.StackTrace);
     }
     return result;
 }