Exemplo n.º 1
0
    private void UpdateDataView()
    {
        lbError.Visible = false;

        if (linkTypeId == -1)         // new link type
        {
            // Default value
            cbBidirectional.Checked = true;
            wneTypeId.Value         = -1;

            // hide Id of the link type
            pnlId.Visible = false;

            // hide Delete button
            UITools.HideToolBarButton(uwToolbar, "Delete");
            UITools.HideToolBarSeparator(uwToolbar, "DeleteSep");
        }
        else         // update link type
        {
            LinkType linkType = LinkType.GetByKey(linkTypeId);
            if (linkType != null)
            {
                // update field
                wneTypeId.Value         = linkType.Id;
                txtTypeName.Text        = linkType.Name;
                cbBidirectional.Checked = linkType.IsBidirectional;
                txtIcon.Text            = linkType.Icon;
                txtDescription.Text     = linkType.Description;

                // show Id of the link type but it is disable
                lbTypeId.Visible  = true;
                wneTypeId.Visible = true;
                wneTypeId.Enabled = false;

                int linkCount = linkType.GetLinkCount();
                cbBidirectional.Enabled = !(linkCount > 0);
            }
        }
    }