示例#1
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        //Build the notification list.
        var notifications = new ENTNotificationEOList();

        notifications.Load();

        foreach (ENTNotificationEO notification in notifications)
        {
            var tr = new HtmlTableRow();

            //the first cell contains a checkbox
            var tc1 = new HtmlTableCell();
            tc1.Attributes.Add("NotificationId", notification.ID.ToString());

            var chkNotify = new CheckBox();
            chkNotify.Text = notification.Description;
            chkNotify.ID   = "chk" + notification.ID.ToString();
            tc1.Controls.Add(chkNotify);
            tc1.VAlign = "top";
            tr.Cells.Add(tc1);

            //if this is the state notification then add a listbox to the second cell.
            if ((ENTNotificationEO.NotificationType)notification.ID == ENTNotificationEO.NotificationType.IssueIOwnedGoesToState)
            {
                var tc2 = new HtmlTableCell();

                var lstStates = new ListBox();
                lstStates.SelectionMode = ListSelectionMode.Multiple;

                //get the states
                var states = new ENTWFStateEOList();
                states.Load();
                var sortedStates = states.SortByPropertyName("StateName", true);

                if (states.Count > 0)
                {
                    lstStates.DataSource     = sortedStates;
                    lstStates.DataTextField  = "DisplayText";
                    lstStates.DataValueField = "ID";
                    lstStates.DataBind();

                    lstStates.Rows = states.Count;
                }
                tc2.Controls.Add(lstStates);

                tr.Cells.Add(tc2);
            }
            else
            {
                tc1.ColSpan = 2;
            }
            tblNotifications.Rows.Add(tr);
        }
    }
    private void LoadStateDropDownLists(int entWorkflowId)
    {
        //Load the from state and to state based on the workflow.
        var states = new ENTWFStateEOList();

        states.Load(entWorkflowId);

        ddlFromState.DataSource     = states;
        ddlFromState.DataTextField  = "DisplayText";
        ddlFromState.DataValueField = "ID";
        ddlFromState.DataBind();
        ddlFromState.Items.Insert(0, new ListItem("", "0"));

        ddlToState.DataSource     = states;
        ddlToState.DataTextField  = "DisplayText";
        ddlToState.DataValueField = "ID";
        ddlToState.DataBind();
    }