private void LoadMethodDropDownList(int entWorkflowId)
    {
        var workflow = new ENTWorkflowEO();

        if (workflow.Load(entWorkflowId))
        {
            //Create an instance of the type.
            var methods = Type.GetType(workflow.ENTWorkflowObjectName).GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);

            //Load the methods for this workflow that return a boolean value into the conditions drop down list.
            foreach (var mi in methods)
            {
                //Only methods that take a parameter of a data context can be used.
                var parameters = mi.GetParameters();
                if (parameters.Length == 1)
                {
                    if (parameters[0].ParameterType == typeof(Agency.PaidTimeOffDAL.HRPaidTimeOffDataContext))
                    {
                        ddlPostTransitionMethodName.Items.Add(mi.Name);
                    }
                }
            }

            ddlPostTransitionMethodName.Items.Insert(0, "");
        }
        else
        {
            throw new Exception("The workflow can not be found in the database.");
        }
    }
    private void LoadPropertiesTable(int entWorkflowId, ENTWFStateEO entWFStateEO)
    {
        if (entWorkflowId != 0)
        {
            var workflow = new ENTWorkflowEO();
            if (workflow.Load(entWorkflowId))
            {
                tblProperties.Rows.Clear();

                //Add header
                var trHeader = new TableRow();
                var tc1      = new TableCell();
                tc1.Text = "Property";
                trHeader.Cells.Add(tc1);

                var tc2 = new TableCell();
                tc2.Text = "Read Only";
                trHeader.Cells.Add(tc2);

                var tc3 = new TableCell();
                tc3.Text = "Required";
                trHeader.Cells.Add(tc3);

                tblProperties.Rows.Add(trHeader);

                //Create an instance of the type.
                var type = Type.GetType(workflow.ENTWorkflowObjectName);
                if (type != null)
                {
                    var properties = type.GetProperties(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);

                    //Populate the table with all the fields.
                    foreach (var prop in properties)
                    {
                        //Only show properties the have a public set property.
                        var methodInfo = prop.GetAccessors();

                        //Get the set method
                        var set =
                            from m in methodInfo
                            where m.Name.StartsWith("set")
                            select m;

                        if (set.Any())
                        {
                            if (set.Single().IsPublic)
                            {
                                var entWFStateProperty = new ENTWFStatePropertyEO();

                                if (entWFStateEO.ENTWorkflowId == Convert.ToInt32(ddlWorkflow.SelectedValue))
                                {
                                    //Try to find this property in the ENTWFStateObject
                                    entWFStateProperty = entWFStateEO.ENTWFStateProperties.GetByPropertyName(prop.Name);

                                    if (entWFStateProperty == null)
                                    {
                                        entWFStateProperty = new ENTWFStatePropertyEO();
                                    }
                                }

                                var tr = new TableRow();

                                //Name of property
                                var tcName = new TableCell();
                                tcName.Text = prop.Name;
                                tr.Cells.Add(tcName);

                                //Read Only checkbox
                                var tcReadOnly  = new TableCell();
                                var chkReadOnly = new CheckBox();
                                chkReadOnly.Enabled = !ReadOnly;
                                chkReadOnly.Checked = entWFStateProperty.ReadOnly;
                                tcReadOnly.Controls.Add(chkReadOnly);
                                tr.Cells.Add(tcReadOnly);

                                //Required checkbox
                                var tcRequired  = new TableCell();
                                var chkRequired = new CheckBox();
                                chkRequired.Enabled = !ReadOnly;
                                chkRequired.Checked = entWFStateProperty.Required;
                                tcRequired.Controls.Add(chkRequired);
                                tr.Cells.Add(tcRequired);
                                tblProperties.Rows.Add(tr);
                            }
                        }
                    }
                }
            }
            else
            {
                throw new Exception("The workflow can not be found in the database.");
            }
        }
    }