Ejemplo n.º 1
0
        public void OrGroup_MultipleAndGroups()
        {
            string  orGroupString = @"foo=bar|123=456&\789=987|\\\=\&\|=\|\&\=\\";
            OrGroup orGroup       = OrGroup.Parse(orGroupString);

            Assert.IsNotNull(orGroup.AndGroups);
            Assert.AreEqual(3, orGroup.AndGroups.Count);

            Assert.AreEqual(1, orGroup.AndGroups.First().Conditions.Count);

            Assert.AreEqual("foo", orGroup.AndGroups.First().Conditions.First().Field);
            Assert.AreEqual("bar", orGroup.AndGroups.First().Conditions.First().Value);
            Assert.IsFalse(orGroup.AndGroups.First().Conditions.First().FieldIndex.HasValue);
            Assert.IsFalse(orGroup.AndGroups.First().Conditions.First().IsFieldByIndex);

            Assert.AreEqual(2, orGroup.AndGroups.Skip(1).First().Conditions.Count);

            Assert.AreEqual("123", orGroup.AndGroups.Skip(1).First().Conditions.First().Field);
            Assert.AreEqual("456", orGroup.AndGroups.Skip(1).First().Conditions.First().Value);
            Assert.IsFalse(orGroup.AndGroups.Skip(1).First().Conditions.First().FieldIndex.HasValue);
            Assert.IsFalse(orGroup.AndGroups.Skip(1).First().Conditions.First().IsFieldByIndex);

            Assert.AreEqual("789", orGroup.AndGroups.Skip(1).First().Conditions.Skip(1).First().Field);
            Assert.AreEqual("987", orGroup.AndGroups.Skip(1).First().Conditions.Skip(1).First().Value);
            Assert.IsTrue(orGroup.AndGroups.Skip(1).First().Conditions.Skip(1).First().FieldIndex.HasValue);
            Assert.AreEqual(789, orGroup.AndGroups.Skip(1).First().Conditions.Skip(1).First().FieldIndex.Value);
            Assert.IsTrue(orGroup.AndGroups.Skip(1).First().Conditions.Skip(1).First().IsFieldByIndex);

            Assert.AreEqual(1, orGroup.AndGroups.Skip(2).First().Conditions.Count);

            Assert.AreEqual(@"\=&|", orGroup.AndGroups.Skip(2).First().Conditions.First().Field);
            Assert.AreEqual(@"|&=\", orGroup.AndGroups.Skip(2).First().Conditions.First().Value);
            Assert.IsFalse(orGroup.AndGroups.Skip(2).First().Conditions.First().FieldIndex.HasValue);
            Assert.IsFalse(orGroup.AndGroups.Skip(2).First().Conditions.First().IsFieldByIndex);
        }
Ejemplo n.º 2
0
        private List <FNLABELEntity> GetNextLabel()
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNLABELEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNLABELEntity.__PRINTING_FLAG, "1");
            OrGroup og = c.GetNewOrGroup();

            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "11");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "12");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "13");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "14");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "15");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "16");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "17");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "18");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "19");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "20");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "21");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "22");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "31");
            rc.OrderBy(FNLABELEntity.__BUCKET_NO);
            rc.OrderBy(FNLABELEntity.__PRINTER_NO);
            rc.OrderBy(FNLABELEntity.__RETRIEVAL_STATION);
            rc.OrderBy(FNLABELEntity.__LINE);
            EntityContainer ec = rc.AsEntityContainer();

            if (ec.Count > 0)
            {
                List <FNLABELEntity> labels = new List <FNLABELEntity>();
                for (int i = 0; i < ec.Count; i++)
                {
                    FNLABELEntity label = ec[i] as FNLABELEntity;
                    if (i > 0)
                    {
                        if (label.BUCKET_NO != labels[i - 1].BUCKET_NO || label.PRINTER_NO != labels[i - 1].PRINTER_NO)
                        {
                            break;  //不同的箱号或打印机
                        }
                    }
                    labels.Add(label);
                }
                return(labels);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public void OrGroup_SingleAndGroup()
        {
            string  orGroupString = "foo=bar";
            OrGroup orGroup       = OrGroup.Parse(orGroupString);

            Assert.IsNotNull(orGroup.AndGroups);
            Assert.AreEqual(1, orGroup.AndGroups.Count);

            Assert.AreEqual(1, orGroup.AndGroups.First().Conditions.Count);

            Assert.AreEqual("foo", orGroup.AndGroups.First().Conditions.First().Field);
            Assert.AreEqual("bar", orGroup.AndGroups.First().Conditions.First().Value);
            Assert.IsFalse(orGroup.AndGroups.First().Conditions.First().FieldIndex.HasValue);
            Assert.IsFalse(orGroup.AndGroups.First().Conditions.First().IsFieldByIndex);
        }
Ejemplo n.º 4
0
 public void OrGroup_MissingConditionMiddle()
 {
     string  orGroupString = @"foo=bar||bar=foo";
     OrGroup orGroup       = OrGroup.Parse(orGroupString);
 }
Ejemplo n.º 5
0
 public void OrGroup_MissingConditionEnd()
 {
     string  orGroupString = @"foo=bar|";
     OrGroup orGroup       = OrGroup.Parse(orGroupString);
 }
Ejemplo n.º 6
0
 public void OrGroup_MissingConditionStart()
 {
     string  orGroupString = @"|foo=bar";
     OrGroup orGroup       = OrGroup.Parse(orGroupString);
 }