protected void eds_QueryCreated(object sender, QueryCreatedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(this.descriptionFilter.Text))
     {
         e.Query = e.Query.OfType<job>().Where(x => x.job_desc.Contains(this.descriptionFilter.Text));
     }
 }
 // Method that selects, from the database, which category (for which user) to list
 protected void EntityDataSourceGeneral_QueryCreated(object sender, QueryCreatedEventArgs e)
 {
     int usrnID = int.Parse(Session["usrnid"].ToString());
     var mediaitms = e.Query.Cast<arcencase_itms>();
     e.Query = from mi in mediaitms
               where mi.arcencase_ctgrys.aenc_ctgrys_ctgrysname == this.Ctgry
               && mi.aenc_itms_itmsusrsid == usrnID
               select mi;
 }
Beispiel #3
0
        protected virtual void OnQueryCreated(QueryCreatedEventArgs e)
        {
            EventHandler <QueryCreatedEventArgs> handler = (EventHandler <QueryCreatedEventArgs>)Events[EventQueryCreated];

            if (handler != null)
            {
                handler(this, e);
            }
        }
        protected void entyPlayer_QueryCreated(object sender, QueryCreatedEventArgs e)
        {
            string strid = Request.QueryString["teamId"];

            Guid teamGuid = new Guid(strid);

            if (teamGuid != Guid.Empty)
            {

                var playersQuery = e.Query.OfType<player>();
                e.Query = playersQuery.Where(c => c.teamId == teamGuid);

            }
        }
 protected virtual void OnQueryCreated(QueryCreatedEventArgs e) {
     EventHandler<QueryCreatedEventArgs> handler = (EventHandler<QueryCreatedEventArgs>)Events[EventQueryCreated];
     if (handler != null) {
         handler(this, e);
     }
 }
        protected IQueryable ExecuteQueryExpressions(IQueryable source, QueryContext context) {
            if (source != null) {                
                QueryCreatedEventArgs queryArgs = new QueryCreatedEventArgs(source);
                OnQueryCreated(queryArgs);
                source = queryArgs.Query ?? source;

                // Support the Dynamic Expression language used by LinqDataSource
                if (AutoGenerateWhereClause) {
                    if (!String.IsNullOrEmpty(Where)) {
                        throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
                        AtlasWeb.LinqDataSourceView_WhereAlreadySpecified, _owner.ID));
                    }
                    source = QueryableDataSourceHelper.CreateWhereExpression(context.WhereParameters, source, _queryable);
                }
                else if (!String.IsNullOrEmpty(Where)) {
                    source = _queryable.Where(source, Where, context.WhereParameters.ToEscapedParameterKeys(_owner));
                }

                if (AutoGenerateOrderByClause) {
                    if (!String.IsNullOrEmpty(OrderBy)) {
                        throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
                        AtlasWeb.LinqDataSourceView_OrderByAlreadySpecified, _owner.ID));
                    }
                    source = QueryableDataSourceHelper.CreateOrderByExpression(context.OrderByParameters, source, _queryable);
                }
                else if (!String.IsNullOrEmpty(OrderBy)) {
                    source = _queryable.OrderBy(source, OrderBy, context.OrderByParameters.ToEscapedParameterKeys(_owner));
                }


                string groupBy = GroupBy;
                if (String.IsNullOrEmpty(groupBy)) {
                    if (!String.IsNullOrEmpty(OrderGroupsBy)) {
                        throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
                            AtlasWeb.LinqDataSourceView_OrderGroupsByRequiresGroupBy, _owner.ID));
                    }
                }
                else {
                    source = _queryable.GroupBy(source, groupBy, "it", context.GroupByParameters.ToEscapedParameterKeys(_owner));
                    if (!String.IsNullOrEmpty(OrderGroupsBy)) {
                        source = _queryable.OrderBy(source, OrderGroupsBy, context.OrderGroupsByParameters.ToEscapedParameterKeys(_owner));
                    }
                }

                if (!String.IsNullOrEmpty(SelectNew)) {
                    source = _queryable.Select(source, SelectNew, context.SelectParameters.ToEscapedParameterKeys(_owner));
                }

                return source;
            }

            return source;
        }
Beispiel #7
0
        protected IQueryable ExecuteQueryExpressions(IQueryable source, QueryContext context)
        {
            if (source != null)
            {
                QueryCreatedEventArgs queryArgs = new QueryCreatedEventArgs(source);
                OnQueryCreated(queryArgs);
                source = queryArgs.Query ?? source;

                // Support the Dynamic Expression language used by LinqDataSource
                if (AutoGenerateWhereClause)
                {
                    if (!String.IsNullOrEmpty(Where))
                    {
                        throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
                                                                          AtlasWeb.LinqDataSourceView_WhereAlreadySpecified, _owner.ID));
                    }
                    source = QueryableDataSourceHelper.CreateWhereExpression(context.WhereParameters, source, _queryable);
                }
                else if (!String.IsNullOrEmpty(Where))
                {
                    source = _queryable.Where(source, Where, context.WhereParameters.ToEscapedParameterKeys(_owner));
                }

                if (AutoGenerateOrderByClause)
                {
                    if (!String.IsNullOrEmpty(OrderBy))
                    {
                        throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
                                                                          AtlasWeb.LinqDataSourceView_OrderByAlreadySpecified, _owner.ID));
                    }
                    source = QueryableDataSourceHelper.CreateOrderByExpression(context.OrderByParameters, source, _queryable);
                }
                else if (!String.IsNullOrEmpty(OrderBy))
                {
                    source = _queryable.OrderBy(source, OrderBy, context.OrderByParameters.ToEscapedParameterKeys(_owner));
                }


                string groupBy = GroupBy;
                if (String.IsNullOrEmpty(groupBy))
                {
                    if (!String.IsNullOrEmpty(OrderGroupsBy))
                    {
                        throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
                                                                          AtlasWeb.LinqDataSourceView_OrderGroupsByRequiresGroupBy, _owner.ID));
                    }
                }
                else
                {
                    source = _queryable.GroupBy(source, groupBy, "it", context.GroupByParameters.ToEscapedParameterKeys(_owner));
                    if (!String.IsNullOrEmpty(OrderGroupsBy))
                    {
                        source = _queryable.OrderBy(source, OrderGroupsBy, context.OrderGroupsByParameters.ToEscapedParameterKeys(_owner));
                    }
                }

                if (!String.IsNullOrEmpty(SelectNew))
                {
                    source = _queryable.Select(source, SelectNew, context.SelectParameters.ToEscapedParameterKeys(_owner));
                }

                return(source);
            }

            return(source);
        }
Beispiel #8
0
    //-------------------------------------------------------------------------------------------
    void List_QueryCreated(object sender, QueryCreatedEventArgs e)
    {
        if (export)
               {
                    Response.Clear();
                    //XmlSerializer serializer = new XmlSerializer(typeof(Logistics_Products));
                    //TextWriter writer = new StreamWriter(Response.OutputStream);

                    Response.AddHeader("Content-Disposition", "attachment; filename=Data.csv");
                    Response.ContentType = "text/plain";

                    var query = (ObjectQuery)e.Query;

                    bool outputHeader = true;
                    foreach (var res in query)
                    {
                         //serializer.Serialize(writer, rec);

                         PropertyInfo[] props = res.GetType().GetProperties();
                         if (outputHeader)
                         {
                              for (int i = 0; i < props.Length; i++)
                              {
                                   PropertyInfo Prop = props[i];
                                   Response.Write("\"" + Prop.Name + "\",");
                              }
                              outputHeader = false;
                              Response.Write("\r\n");
                         }

                         for (int i = 0; i < props.Length; i++)
                         {
                              PropertyInfo Prop = props[i];
                              object propValue = Prop.GetValue(res, null);
                              //Response.Write(Prop.Name);
                              if (propValue != null)
                              {
                                   string val = propValue.ToString();
                                   val = val.Replace("\"", "\"\"");

                                   Response.Write("\"" + val + "\"");
                              }
                              Response.Write(",");
                         }
                         Response.Write("\r\n");
                    }
                    Response.End();
               }
    }
 private void OnDataSourceQueryCreated(object sender, QueryCreatedEventArgs e)
 {
     e.Query = Query.GetQueryable(e.Query);
 }
 private void OnDataSourceQueryCreated(object sender, QueryCreatedEventArgs e) {
     e.Query = Query.GetQueryable(e.Query);
 }