protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeFilter = table.EntityType.Name; // Set the search data fields to all the string columns var searchExpression = (SearchExpression)GridQueryExtender.Expressions[1]; searchExpression.DataFields = String.Join(",", table.Columns.Where(c => c.IsString).Select(c => c.Name)); if (String.IsNullOrEmpty(searchExpression.DataFields)) { // No string fields, remove the search elements SearchPanel.Visible = false; GridQueryExtender.Expressions.Remove(searchExpression); } // Disable various options if the table is readonly GridView1.ColumnsGenerator = new OrderedFieldGenerator(table); if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; GridView1.EnablePersistedSelection = false; } Title = table.DisplayName; GridDataSource.Include = table.ForeignKeyColumnsNames; }
//------------------------------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); //GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated); GridDataSource.EntityTypeFilter = table.EntityType.Name; // HACKED TOGETHER FOR NOW if (User.Identity.IsAuthenticated) { GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, LoggedInUser.OrganizationId.ToString())); } else { GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, "0baae579-dbd8-488d-9e51-dd4dd6079e95")); } //GridDataSource.OrderBy = "it.PublishAt desc"; Master.FixedWidth = true; Master.FormTitle = table.DisplayName; IsPublic = true; if (Roles.IsUserInRole("Administrators")) { AdminLinks.Visible = true; } }
protected void Page_Init(object sender, EventArgs e) { object currentuser = Session["currentuser"]; if (currentuser == null || (string)currentuser == "Unknown") { Session["usertype"] = null; Session["currentuser"] = null; Response.Redirect("~/login.aspx"); } table = DynamicDataRouteHandler.GetRequestMetaTable(Context); object current = Session["usertype"]; if (current == null || (enumUserType)current == enumUserType.Unknown) { Session["user"] = DateTime.UtcNow.AddDays(-1).ToString("yyyy-MM-dd HH:mm:00"); Response.Redirect("~/login.aspx"); return; } System.Web.HttpRequest h = this.Request; if ((enumUserType)current == enumUserType.Users) { if (!UtilsConfig.UserTables.Contains(table.Name.ToLower())) { Response.Redirect(this.Request.UrlReferrer.PathAndQuery); return; } } FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; }
internal static MetaTable GetTableWithFullFallback(IDataSource dataSource, HttpContextBase context) { MetaTable table = GetTableFromMapping(context, dataSource); if (table != null) { return(table); } IDynamicDataSource dynamicDataSource = dataSource as IDynamicDataSource; if (dynamicDataSource != null) { table = GetTableFromDynamicDataSource(dynamicDataSource); if (table != null) { return(table); } } table = DynamicDataRouteHandler.GetRequestMetaTable(context); if (table != null) { return(table); } Control c = dataSource as Control; string id = (c != null ? c.ID : String.Empty); throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, DynamicDataResources.MetaTableHelper_CantFindTable, id)); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); foreach (MetaColumn mt in table.Columns) { if (mt.ColumnType == typeof(Guid) || mt.IsPrimaryKey) { mt.Scaffold = true; } } object currentuser = Session["currentuser"]; if (currentuser == null || (string)currentuser == "Unknown") { Session["usertype"] = null; Session["currentuser"] = null; Response.Redirect("~/login.aspx"); } GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; if (table.EntityType != table.RootEntityType) { GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType)); } }
//------------------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); _filteredFieldsManager = new FilteredFieldsManager(table, PageTemplate.List); if (!IsPostBack) { var availableColumns = table.Columns .Where(x => Global.IsAuthorized(x) == true && x.Scaffold); //.OrderBy(x => x.DisplayName); foreach (MetaColumn col in availableColumns) { // if (col.Scaffold) ListItem item = new ListItem(col.DisplayName, col.Name); if (Global.IsShown(col)) { item.Selected = true; } Columns.Items.Add(item); } } else { SetSelectedColumns(); } }
//------------------------------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { Navigation.SelectedNodeChanged += new EventHandler(Navigation_SelectedNodeChanged); FormView1.ItemCommand += new FormViewCommandEventHandler(FormView1_ItemCommand); Master.FixedWidth = false; Master.Width = "100%"; table = DynamicDataRouteHandler.GetRequestMetaTable(Context); TreeDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, SelectedOrganization.Id.ToString())); if (!IsPostBack) { DoDataBind(); } FormView1.SetMetaTable(table); //GridDataSource.EntityTypeFilter = table.EntityType.Name; TreeDataSource.EntityTypeFilter = table.EntityType.Name; //TreeDataSource.WhereParameters.Add(new Parameter("Parent", DbType.Guid, SelectedOrganization.OrganizationId.ToString())); //Master.FormTitle = table.DisplayName; //Master.FixedWidth = false; IsPublic = true; if (Navigation.Nodes.Count == 0) { EmptyData.Visible = true; } //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated); }
//------------------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); WeavverMaster.SetChatVisibility(true); WeavverMaster.FixedWidth = false; WeavverMaster.Width = "100%"; WeavverMaster.FormTitle = table.DisplayName; WeavverMaster.FormDescription = GetPageContent("Logistics/Products/Showcase_Description"); //GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated); GridDataSource.EntityTypeFilter = table.EntityType.Name; if (table.EntityType.FullName.Contains("Logistics_Products")) { if (LoggedInUser == null || LoggedInUser.OrganizationId != SelectedOrganization.OrganizationId) { GridDataSource.WhereParameters.Add(new Parameter("IsPublic", DbType.Boolean, "True")); } } GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, SelectedOrganization.Id.ToString())); GridDataSource.OrderBy = "it.Name"; WeavverMaster.FormTitle = table.DisplayName; GridDataSource.Include = table.ForeignKeyColumnsNames; StoreSpecials.Text = GetPageContent("Sales/Store Specials"); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); FormView1.SetMetaTable(table); GridDataSource.EntityTypeFilter = table.EntityType.Name; DetailsDataSource.EntityTypeFilter = table.EntityType.Name; }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); DetailsView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; DetailsView1.RowsGenerator = new OrderedFieldGenerator(table); Title = table.DisplayName; }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); FormView1.SetMetaTable(table); GridDataSource.EntityTypeFilter = table.EntityType.Name; DetailsDataSource.EntityTypeFilter = table.EntityType.Name; //ScriptManager.RegisterStartupScript(DetailsPanel, DetailsPanel.GetType(), "scroll", // "", true); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; if (table.EntityType != table.RootEntityType) { GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType)); } }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; DetailsDataSource.ContextCreating += (o, args) => { args.Context = (ObjectContext)table.CreateContext(); }; }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; if (Session["Record_Info"] != null) { Label1.Text = Session["Record_Info"].ToString(); Session["Record_Info"] = ""; } }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeFilter = table.EntityType.Name; if (Session["Record_Info"] != null) { Label4.Text = Session["Record_Info"].ToString(); Session["Record_Info"] = ""; } }
protected void Page_Init(object sender, EventArgs e) { IsPublic = true; table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; Master.FormTitle = "Add new entry to " + table.DisplayName; DetailsDataSource.Inserted += new EventHandler <EntityDataSourceChangedEventArgs>(DetailsDataSource_Inserted); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; if (table.EntityType != table.RootEntityType) { GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType)); } // Initialize the URL for routing to all categories. ViewAllLink.NavigateUrl = Request.Path; }
//protected MetaTable IndexTable; protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; //IndexTable = ASP.global_asax.DefaultModel.GetTable("Tool_ElementSet"); if (Session["Record_Info"] != null) { Label1.Text = Session["Record_Info"].ToString(); Session["Record_Info"] = ""; } }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); FormView1.SetMetaTable(table); GridDataSource.EntityTypeFilter = table.EntityType.Name; DetailsDataSource.EntityTypeFilter = table.EntityType.Name; DetailsDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, LoggedInUser.OrganizationId.ToString())); Master.FormTitle = table.DisplayName; Master.FixedWidth = false; GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated); }
protected void Page_Init(object sender, EventArgs e) { object currentuser = Session["currentuser"]; if (currentuser == null || (string)currentuser == "Unknown") { Session["usertype"] = null; Session["currentuser"] = null; Response.Redirect("~/login.aspx"); } table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; }
//------------------------------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { IsPublic = true; if (!Roles.IsUserInRole("Administrators")) { Response.Redirect("~/", true); } table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; WeavverMaster.FormTitle = "Edit entry from " + table.DisplayName; //FormView1.DataBind(); //var obj = Weavver.Data.EntityDataSourceExtensions.GetItemObject<Weavver.Data.IT_Servers>(FormView1.DataItem); //GenerateMenu(TableActions.Edit, table.Provider.EntityType); WeavverMenuItem auditTrail = new WeavverMenuItem(); auditTrail.Name = "Audit Trails"; auditTrail.Link = "~/Data_AuditTrails/List.aspx?Id=" + Request.QueryString["Id"]; WeavverMaster.ToolBarMenuAdd(auditTrail); WeavverMenuItem urlList = new WeavverMenuItem(); urlList.Name = "URLs"; urlList.Link = "~/System_URLs/List.aspx?ObjectId=" + Request.QueryString["Id"]; WeavverMaster.ToolBarMenuAdd(urlList); WeavverMenuItem urlNew = new WeavverMenuItem(); urlNew.Name = "New URL"; urlNew.Link = "~/System_URLs/Insert.aspx?ObjectId=" + Request.QueryString["Id"] + "&TableName=" + table.Provider.EntityType.ToString().Replace("Weavver.Data.", ""); WeavverMaster.ToolBarMenuAdd(urlNew); string projectionPath = "~/DynamicData/Projections/" + table.EntityType.ToString().Replace("Weavver.Data.", "") + ".ascx"; if (File.Exists(Server.MapPath(projectionPath))) { Control projection = LoadControl(projectionPath); Projections.Controls.Add(projection); } }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; NotyficationTable = ASP.global_asax.DefaultModel.GetTable("NotificationSet"); CommentTable = ASP.global_asax.DefaultModel.GetTable("CommentSet"); if (Session["Record_Info"] != null) { Label1.Text = Session["Record_Info"].ToString(); Session["Record_Info"] = ""; } string value = Request.QueryString["Id"]; HyperLink3.NavigateUrl = "~/CommentSet/Insert.aspx?Customer_ProductId=" + value; }
protected void Page_Init(object sender, EventArgs e) { object currentuser = Session["currentuser"]; if (currentuser == null || (string)currentuser == "Unknown") { Session["usertype"] = null; Session["currentuser"] = null; Response.Redirect("~/login.aspx"); } table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); FormView1.SetMetaTable(table); GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; DetailsDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName; if (table.EntityType != table.RootEntityType) { GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType)); } }
//------------------------------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); //GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated); GridDataSource.EntityTypeFilter = table.EntityType.Name; GridDataSource.WhereParameters.Add( new Parameter("OrganizationId", DbType.Guid, LoggedInUser.OrganizationId.ToString())); //GridDataSource.OrderBy = "Name"; //GridDataSource.WhereParameters.Add( // new Parameter("IsLab", DbType.Boolean, "false")); Master.FixedWidth = true; Master.FormTitle = table.DisplayName; //Master.FormTitle = "Professional Services"; Master.FormDescription = "If you need help or would like to discuss a custom project please call us at +1-714-872-5920."; }
public void GetRequestMetaTable() { MetaModel m = Utils.CommonInitialize(); var route = RouteTable.Routes[0] as DynamicDataRoute; MetaTable t = m.Tables[TestDataContext.TableFooDisplayName]; Assert.IsNotNull(t, "#A1"); // Surprise! A null check is present! AssertExtensions.Throws <ArgumentNullException> (() => { DynamicDataRouteHandler.GetRequestMetaTable(null); }, "#A2"); MetaTable t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current); Assert.IsNull(t2, "#A3"); DynamicDataRouteHandler.SetRequestMetaTable(HttpContext.Current, t); t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current); Assert.IsNotNull(t2, "#A4"); Assert.AreEqual(t, t2, "#A4-1"); }
protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeFilter = table.EntityType.Name; GridDataSource.ContextCreating += (o, args) => { args.Context = (ObjectContext)table.CreateContext(); }; // Set the search data fields to all the string columns var searchExpression = (SearchExpression)GridQueryExtender.Expressions[1]; searchExpression.DataFields = String.Join(",", table.Columns.Where(c => c.IsString).Select(c => c.Name)); if (string.IsNullOrEmpty(searchExpression.DataFields)) { // No string fields, remove the search elements SearchPanel.Visible = false; GridQueryExtender.Expressions.Remove(searchExpression); } }
public void SetRequestMetaTable() { MetaModel m = Utils.CommonInitialize(); var route = RouteTable.Routes[0] as DynamicDataRoute; MetaTable t = m.Tables[TestDataContext.TableFooDisplayName]; Assert.IsNotNull(t, "#A1"); // And following the tradition... [drum roll] - NO NULL CHECK! AssertExtensions.Throws <NullReferenceException> (() => { DynamicDataRouteHandler.SetRequestMetaTable(null, t); }, "#A2"); DynamicDataRouteHandler.SetRequestMetaTable(HttpContext.Current, t); MetaTable t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current); Assert.IsNotNull(t2, "#A3"); Assert.AreEqual(t, t2, "#A3-1"); DynamicDataRouteHandler.SetRequestMetaTable(HttpContext.Current, null); t2 = DynamicDataRouteHandler.GetRequestMetaTable(HttpContext.Current); Assert.IsNull(t2, "#A4"); }
//------------------------------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { //if (Roles.IsUserInRole("Administrators")) // AdminLinks.Visible = true; string pathBase = Request.Url.PathAndQuery; pathBase = pathBase.Substring(0, pathBase.LastIndexOf("/")); //EditLink.HRef = pathBase + "/Edit.aspx?Id=" + Request["Id"]; table = DynamicDataRouteHandler.GetRequestMetaTable(Context); FormView1.SetMetaTable(table); FormView1.ItemCreated += new EventHandler(FormView1_ItemCreated); DetailsDataSource.EntityTypeFilter = table.EntityType.Name; WeavverMaster.FormTitle = "Entry from table " + table.DisplayName; //WeavverMaster.FormDescription = "If you need help or would like to discuss your project please call us at +1-714-872-5920."; IsPublic = true; ActivationRequired = false; //Master.DiscussionEnabled = false; }
protected void DetailGridView_Init(object sender, EventArgs e) { // string detailTableName = DynamicDataRouteHandler.GetRequestContext(this.Context).RouteData.Values["details"].ToString(); MetaTable table = DynamicDataRouteHandler.GetRequestMetaTable(Context); // var parents = detailTable.Columns.OfType<MetaForeignKeyColumn>().Select(s => s.ParentTable).Distinct(); // var children = detailTable.Columns.OfType<MetaChildrenColumn>().Select(s => s.ChildTable).Distinct(); // var detailschildren = children.Where(x => x.Attributes[typeof(Modiriat_Gharardadha.Helpers.DetailTableName)] != null); //get child from custom attributes Helpers.DetailTableName tblName = table.Attributes[typeof(Helpers.DetailTableName)] as Helpers.DetailTableName; MetaModel model = ((DynamicDataRouteHandler)(DynamicDataRouteHandler.GetRequestContext(this.Context).RouteData.RouteHandler)).Model; Microsoft.AspNet.EntityDataSource.EntityDataSource GridDetailDataSource = (Microsoft.AspNet.EntityDataSource.EntityDataSource)((sender as RadGrid).NamingContainer).FindControl("GridDetailDataSource"); GridDetailDataSource.ContextTypeName = table.DataContextType.ToString(); if (tblName != null) { GridDetailDataSource.EntitySetName = tblName.TabeName; } else { ((RadGrid)sender).DataSourceID = string.Empty; } }
//------------------------------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { EnableViewState = false; table = DynamicDataRouteHandler.GetRequestMetaTable(Context); //GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated); GridDataSource.EntityTypeFilter = table.EntityType.Name; // HACKED TOGETHER FOR NOW if (User.Identity.IsAuthenticated) { GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, LoggedInUser.OrganizationId.ToString())); } else { GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, "0baae579-dbd8-488d-9e51-dd4dd6079e95")); } // GridDataSource.OrderBy = "it.PublishAt desc"; IsPublic = true; }