protected void lnkAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { if (txtName.Text.Length > 0) { AdminDataQuery query = new AdminDataQuery() { _DataTableID = DQManager.GetDataTable().ID, AdminID = ((AdminPage)Page).AdminUser.ID, IsPublic = chkIsPublic.Checked, Name = txtName.Text, Timestamp = UKTime.Now, }; db.AdminDataQueries.InsertOnSubmit(query); db.SubmitChanges(); RePopulateQueriesList(); ddlExistingQueries.SelectedValue = query.ID.ToString(); ReloadFilters(sender, e); pnlManageQuery.Visible = true; ucDataQuery.Reset(); UpdateCurrentQuery(); } } }
protected void UpdateCurrentQuery(string forceQuery) { AdminDataQuery adq = db.AdminDataQueries.SingleOrDefault(s => s.ID.ToString() == forceQuery); if (forceQuery != "") { if (((AdminPage)Page).AdminUser.ID == adq.AdminID) { mvManageQuery.SetActiveView(viewDelete); lnkDeleteQuery.Visible = true; } else { lnkDeleteQuery.Visible = false; } ReloadFilters(null, null); pnlManageQuery.Visible = true; if (adq != null) { ucDataQuery.AdminDataQueryID = adq.ID; } lnkRunQuery.Visible = true; } else { mvManageQuery.SetActiveView(viewAdd); ReloadFilters(null, null); pnlManageQuery.Visible = false; } }
public DynamicQueryable(IEnumerable <T> Dataset, AdminDataQuery query) : this(Dataset) { dataset = Dataset; if (query != null) { dataset = ExtendQuery(query); } }
protected void lnkDeleteQuery_Click(object sender, EventArgs e) { AdminDataQuery query = db.AdminDataQueries.Single(c => c.ID.ToString() == ddlExistingQueries.SelectedValue); db.AdminDataQueryFilters.DeleteAllOnSubmit(query.AdminDataQueryFilters); db.AdminDataQueries.DeleteOnSubmit(query); db.SubmitChanges(); ddlExistingQueries.SelectedValue = ""; RePopulateQueriesList(); Response.Redirect("list.aspx"); }
protected void LoadView(AdminDataQuery query) { DQManager = new DataQueryManager(Type, ViewID); DataTableSchema = DQManager.GetSchema(); ddlFields.Items.Clear(); ddlFields.Items.Add(new ListItem("Add a new Column", String.Empty)); ddlFields.DataSource = DQManager.usableFields; ddlFields.DataBind(); Columns = DQManager.GetSchema().Count(); dpMain.PageSize = _ItemsPerPage; SetPageColSpan(); rptHeader.DataSource = DataTableSchema; rptHeader.DataBind(); if (DataSet != null) { var items = (from p in DataSet select p).ToArray(); if (items.Any() && !(items.First() is ListOrderItem)) { CanOrder = false; } IEnumerable <ListData> data = FormData(); data = FilterDownForMail(data); IsDataEmpty = !data.Any(); lvItems.DataSource = data.ToList(); lvItems.DataBind(); } }
public IEnumerable <T> ExtendQuery(AdminDataQuery query) { return(dataset.AsQueryable().Where(query.ParsedQuery)); }