Example #1
0
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     FormView1.SetMetaTable(table);
     DetailsDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName;
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     FormView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
     DetailsDataSource.EntityTypeFilter = table.EntityType.Name;
 }
Example #3
0
//-------------------------------------------------------------------------------------------
        protected void Page_Init(object sender, EventArgs e)
        {
            IsPublic = true;
            table    = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            FormView1.SetMetaTable(table);
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
 }
Example #5
0
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     detailsView.SetMetaTable(table);
     DetailsDataSource.EntityTypeFilter = table.EntityType.Name;
 }
Example #6
0
//-------------------------------------------------------------------------------------------
    protected override void  OnInit(EventArgs e)
    {
        base.OnInit(e);
        table = DynamicDataRouteHandler.GetRequestMetaTable(Context);

        ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(string), "RunScripts", "run();", true);

        Controls_ColumnPicker obj = (Controls_ColumnPicker)SecureContent.FindControl("ColumnPicker1");

        if (obj != null)
        {
            obj.DataSaved += new DataSavedHandler(obj_DataSaved);
            GridView1.ColumnsGenerator = obj.FieldManager;
        }

        ((IQueryableDataSource)this.GridDataSource).QueryCreated += new EventHandler <QueryCreatedEventArgs>(List_QueryCreated);
        GridView1.DataBound         += new EventHandler(GridView1_DataBound);
        GridView1.PageIndexChanging += new GridViewPageEventHandler(GridView1_PageIndexChanging);
        GridView1.RowDataBound      += new GridViewRowEventHandler(GridView1_RowDataBound);
        GridView1.RowCreated        += new GridViewRowEventHandler(GridView1_RowCreated);

        GridDataSource.Selected += new EventHandler <EntityDataSourceSelectedEventArgs>(GridDataSource_Selected);

        GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
        //if (!IsPostBack)
        //{
        GridDataSource.EntityTypeFilter = table.EntityType.Name;
        //}

        //GenerateMenu(TableActions.List, table.EntityType.GetType());

        GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, BasePage.SelectedOrganization.Id.ToString()));

        //set the default sort
        if (table.DisplayColumn != null)
        {
            GridDataSource.AutoGenerateOrderByClause = true;
            GridDataSource.OrderByParameters.Add(new Parameter(table.DisplayColumn.Name));
        }

        if (Request["ObjectId"] != null)
        {
            GridDataSource.WhereParameters.Add(new Parameter("ObjectId", DbType.Guid, Request["ObjectId"]));
        }

        if (Request["AccountId"] != null)
        {
            GridDataSource.WhereParameters.Add(new Parameter("AccountId", DbType.Guid, Request["AccountId"]));

            using (WeavverEntityContainer data = new WeavverEntityContainer())
            {
                string title = data.GetName(new Guid(Request["AccountId"]));

                if (Request["LedgerType"] != null)
                {
                    title += " - " + Request["LedgerType"];
                }

                BasePage.WeavverMaster.FormTitle = title;
            }
        }


        DataAccess insertPermissions = table.EntityType.InsertPermissions();

        if (insertPermissions.HasAnyRole(Roles.GetRolesForUser()))
        {
            newObjectLink.Visible = true;
            newObjectLink.Title   = "Accessible to: " + String.Join(", ", insertPermissions.AllowedRoles);

            string newLink = "javascript:createPopup('/{0}/Details.aspx', {1}, {2});";
            newObjectLink.HRef = String.Format(newLink, table.EntityType.Name, insertPermissions.Width, insertPermissions.Height);
        }

        MethodInfo tableMenu = table.EntityType.GetMethod("GetTableMenu");

        if (tableMenu != null && tableMenu.IsStatic)
        {
            var x = tableMenu.Invoke(null, null);
            if (x != null)
            {
                List <WeavverMenuItem> items = (List <WeavverMenuItem>)x;
                foreach (WeavverMenuItem item in items)
                {
                    if (item.Link.StartsWith("control://"))
                    {
                        string controlPath = item.Link.Substring(10);
                        if (File.Exists(Server.MapPath(controlPath)))
                        {
                            WeavverUserControl customControl = (WeavverUserControl)LoadControl(controlPath);
                            //quickAdd.DataSaved += new DataSavedHandler(QuickAdd_DataSaved);
                            AvailableActions.Controls.Add(customControl);
                        }
                    }
                    else
                    {
                        LinkButton webMethod = new LinkButton();
                        webMethod.ID          = "DynamicWebMethod_" + item.Name;
                        webMethod.Text        = item.Name;
                        webMethod.CommandName = item.Name;
                        webMethod.CssClass    = "attachmentLink";
                        webMethod.Click      += new EventHandler(DynamicWebMethod_Click);
                        AvailableActions.Controls.Add(webMethod);
                    }
                }
            }
        }

        if (Request["TransactionId"] != null)
        {
            GridDataSource.WhereParameters.Add(new Parameter("TransactionId", DbType.Guid, Request["TransactionId"]));
        }

        // TODO: Repurpose this block to add a customizable "TOP panel"
        string quickAddPath = "~/DynamicData/QuickAdd/" + table.EntityType.ToString().Replace("Weavver.Data.", "") + ".ascx";

        if (File.Exists(Server.MapPath(quickAddPath)))
        {
            WeavverUserControl quickAdd = (WeavverUserControl)LoadControl(quickAddPath);
            quickAdd.DataSaved += new DataSavedHandler(QuickAdd_DataSaved);
            QuickAdd.Controls.Add(quickAdd);
        }

        string projectionPath = "~/DynamicData/Projections/" + table.EntityType.Name + ".ascx";

        if (File.Exists(Server.MapPath(projectionPath)))
        {
            Control projection = LoadControl(projectionPath);
            Projections.Controls.Add(projection);
        }

        if (!IsPostBack)
        {
            // set default sort
            if (table.SortColumn != null)
            {
                var order = new OrderByExpression()
                {
                    DataField = table.SortColumn.Name,
                    Direction = table.SortDescending ? SortDirection.Descending : SortDirection.Ascending,
                };
                GridQueryExtender.Expressions.Add(order);
            }
        }

        //newObjectLink.HRef = String.Format("javascript:createPopup('{0}', {1}, {2});", table.Name, 1000, 500);
    }
        public void Constructor()
        {
            var ddrh = new DynamicDataRouteHandler();

            Assert.AreEqual(null, ddrh.Model, "#A1");
        }