public void QueryCustomersWithinZipCodeBoundsAndWithOrder() { Selection sel = new Selection(0, 1); sel.FilingMode = FilingMode.Active; sel.AddCondition(Condition.Between("zipCode", "20000", "29999")); sel.OrderField = "zipCode"; sel.FieldList.Add("idno"); sel.FieldList.Add("swd"); sel.FieldList.Add("descrOperLang"); sel.FieldList.Add("zipCode"); Query query = ctx.CreateQuery(sel); var list = query.ToList(); Assert.AreEqual(4, list.Count); Assert.AreEqual("22113", list[0]["zipCode"]); Assert.AreEqual("22589", list[1]["zipCode"]); Assert.AreEqual("28022", list[2]["zipCode"]); Assert.AreEqual("28777", list[3]["zipCode"]); sel.Direction = OrderDirection.Descending; query = ctx.CreateQuery(sel); list = query.ToList(); Assert.AreEqual(4, list.Count); Assert.AreEqual("28777", list[0]["zipCode"]); Assert.AreEqual("28022", list[1]["zipCode"]); Assert.AreEqual("22589", list[2]["zipCode"]); Assert.AreEqual("22113", list[3]["zipCode"]); }
private void AddBoolean(string fieldName) { if (!String.IsNullOrEmpty(fieldName)) { // Sonderfall Ablageart, diese steht als Selektionsoption zur Verfügung if (fieldName == "recordFiled") { selection.FilingMode = negateCondition ? FilingMode.Active : FilingMode.Filed; } else { selection.AddCondition( Condition.Eq(fieldName, negateCondition ? "(No)" : "(Yes)")); } } }
public void QuerySingleProduct() { Selection sel = new Selection(2, 1); sel.FilingMode = FilingMode.Active; sel.AddCondition(Condition.Eq("idno", "30045")); Query query = ctx.CreateQuery(sel); Assert.AreEqual(1, query.Count()); Assert.AreEqual("SABA-KP5000", query.First()["swd"]); Assert.AreEqual("SWK2", query.FieldList.First(f => f.Name == "swd").Type); Assert.AreEqual(1, query.Count()); }
public void QuerySingleProductWithFieldList() { Selection sel = new Selection(2, 1); sel.FilingMode = FilingMode.Active; sel.AddCondition(Condition.Eq("idno", "30045")); sel.FieldList.Add("idno"); sel.FieldList.Add("swd"); sel.FieldList.Add("descrOperLang"); Query query = ctx.CreateQuery(sel); Assert.AreEqual(1, query.Count()); Assert.AreEqual("SABA-KP5000", query.First()["swd"]); Assert.AreEqual(3, query.FieldList.Count); Assert.AreEqual(1, query.Count()); }