示例#1
0
        static void AddCondition(JoinAlias main, JoinAlias goodsAlias, DQueryDom query, string dtFile, QueryContainer mQueryContainer, DateInput sd, DateInput ed)
        {
            var goodsName = mQueryContainer.GetControl <DFTextBox>("Goods_Name").Text;
            var goodsCode = mQueryContainer.GetControl <DFTextBox>("Goods_Code").Text;

            if (!string.IsNullOrEmpty(goodsName))
            {
                query.Where.Conditions.Add(DQCondition.Or(DQCondition.Like(goodsAlias, "Name", goodsName), DQCondition.Like(goodsAlias, "Spell", goodsName)));
            }
            if (!string.IsNullOrEmpty(goodsCode))
            {
                query.Where.Conditions.Add(DQCondition.Like(goodsAlias, "Code", goodsCode));
            }
            if (sd.Value.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, dtFile, sd.Value.Value));
            }
            if (ed.Value.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, dtFile, ed.Value.Value));
            }
        }