示例#1
0
 public override void HandleQuickFilters(poSelectQuery query, List <powFilterField> filterFields)
 {
     base.HandleQuickFilters(query, filterFields);
     foreach (var field in filterFields)
     {
         if (field.FieldName == "heName")
         {
             var value = $"%{field.FieldValue}%";
             query.WherePhrase.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("heName", query.BaseTable), query.ParameterValue(value), CompareOperator.Like));
         }
     }
 }
示例#2
0
        protected override poSelectQuery BuildQuery()
        {
            var selQuery = new poSelectQuery("heItems");

            selQuery.AddColumn("heID", selQuery.BaseTable, "ID");
            selQuery.AddColumn("heCode", selQuery.BaseTable, "heCode");
            selQuery.AddColumn("heName", selQuery.BaseTable, "heName");
            selQuery.AddColumns("heFactoryCode", "heSeasID", "heAMsntID", "heAuxiliaryCode", "heDetailedDescr", "heClassification", "heKind",
                                "heCompID", "heActive", "heNameSoundex", "heRefNumber", "heIaccID", "heProductionCatID", "heBlockSales", "heBlockPurchases", "heBlockWarehouses", "hePartInStockControl"
                                , "heSalInvAttrSpPrice", "hePurInvAttrSpPrice", "heCat01ID", "heCat02ID", "HECALCFROMVALUE",
                                "heRetailPrice", "heWholeSalesPrice");
            selQuery.AddColumns("heSplrID", "heType");

            selQuery.WherePhrase.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("heCompID", selQuery.FromClause.BaseTable), selQuery.ParameterValue(AppContext.GetService <heSystemParams>().CurrentCompanyID), CompareOperator.Equal));
            selQuery.WherePhrase.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("heType", selQuery.FromClause.BaseTable), selQuery.ParameterValue(Convert.ToInt16(hewItemsDataObjectProxy.ItemTypeEnum.Service)), CompareOperator.Equal));

            selQuery.AddEnumColumn(AppContext, selQuery.FromClause.BaseTable, "Hercules;heItems;heKind");
            selQuery.AddEnumColumn(AppContext, selQuery.FromClause.BaseTable, "Hercules;heItems;heClassification");

            var AMesUnits = FromTerm.Table("heMeasurementUnits", "MU1");

            selQuery.AddColumn("heName", AMesUnits, "AMUNAME");
            selQuery.FromClause.Join(JoinType.Inner, selQuery.BaseTable, AMesUnits, "heAMsntID", "heID");

            var vats = FromTerm.Table("heVATClasses", "Vats");

            selQuery.AddColumn("heName", vats, "VTCLNAME");
            selQuery.FromClause.Join(JoinType.Inner, selQuery.FromClause.BaseTable, vats, "heVtclID", "heID");

            var iaccs = FromTerm.Table("heItemAccCategories", "Iacc");

            selQuery.AddColumn("heName", iaccs, "IaccName");
            selQuery.FromClause.Join(JoinType.Left, selQuery.FromClause.BaseTable, iaccs, "heIaccID", "heID");

            return(selQuery);
        }