Example #1
0
        public static MapFilter GetMapJavascriptFilter(IndustrialActivitySearchFilter filter)
        {
            ParameterExpression param = Expression.Parameter(typeof(FACILITYSEARCH_MAINACTIVITY), "s");
            Expression          exp   = LinqExpressionBuilder.GetLinqExpressionIndustrialActivitySearch(filter, param);
            Expression <Func <FACILITYSEARCH_MAINACTIVITY, bool> > lambda = Expression.Lambda <Func <FACILITYSEARCH_MAINACTIVITY, bool> >(exp, param);

            // create sql and sectors to map
            MapFilter mapFilter = new MapFilter();

            mapFilter.SqlWhere = LinqExpressionBuilder.GetSQL(exp, param);

            return(mapFilter);
        }
Example #2
0
        /// <summary>
        /// Returns the number of facilities corresponding to the filter. Always use FACILITY_MAIN table, since it has the fewest records.
        /// </summary>
        public static int GetFacilityCount(IndustrialActivitySearchFilter filter)
        {
            DataClassesFacilityDataContext db    = getFacilityDataContext();
            ParameterExpression            param = Expression.Parameter(typeof(FACILITYSEARCH_MAINACTIVITY), "s");
            Expression exp = LinqExpressionBuilder.GetLinqExpressionIndustrialActivitySearch(filter, param);
            Expression <Func <FACILITYSEARCH_MAINACTIVITY, bool> > lambda = Expression.Lambda <Func <FACILITYSEARCH_MAINACTIVITY, bool> >(exp, param);

            //find total no. of facilities. Table only have one record per facility, so distinct is not needed.
            int count = db.FACILITYSEARCH_MAINACTIVITies
                        .Where(lambda)
                        .Count();

            return(count);
        }
Example #3
0
        /// <summary>
        /// returns the MapFilter (sql and layers) corresponding to the filter.
        /// </summary>
        public static MapFilter GetMapFilter(IndustrialActivitySearchFilter filter)
        {
            DataClassesFacilityDataContext db    = getFacilityDataContext();
            ParameterExpression            param = Expression.Parameter(typeof(FACILITYSEARCH_MAINACTIVITY), "s");
            Expression exp = LinqExpressionBuilder.GetLinqExpressionIndustrialActivitySearch(filter, param);
            Expression <Func <FACILITYSEARCH_MAINACTIVITY, bool> > lambda = Expression.Lambda <Func <FACILITYSEARCH_MAINACTIVITY, bool> >(exp, param);

            // create sql and sectors to map
            MapFilter mapFilter = new MapFilter();

            mapFilter.SqlWhere = LinqExpressionBuilder.GetSQL(exp, param);
            mapFilter.SetLayers(filter.ActivityFilter);

            return(mapFilter);
        }