Exemple #1
0
    protected override void OnFormBound()
    {
        base.OnFormBound();
        ClientBindingMgr.RegisterSaveButton(btnSave);
        btnDelete.OnClientClick = string.Format("return confirm('{0}');", Sage.Platform.WebPortal.PortalUtil.JavaScriptEncode(GetLocalResourceObject("btnDelete.ActionConfirmationMessage").ToString()));
        _pickListView           = (IPickListView)BindingSource.Current;
        var picklistId = Page.Session["picklistId"] as string;

        Page.Session.Add("picklistId", _pickListView.Id.ToString());
        if (picklistId == _pickListView.Id.ToString() && IsPostBack)
        {
            //there are instances where the test default item does not get updated
            AssignDefaultTestItem();
            return;
        }
        LoadView();
        if (RoleSecurityService != null && !RoleSecurityService.HasAccess("Administration/PickList/Add"))
        {
            btnNew.Visible = false;
        }
        if (RoleSecurityService != null && !RoleSecurityService.HasAccess("Administration/PickList/Delete"))
        {
            btnDelete.Visible = false;
        }
        if (RoleSecurityService != null && !RoleSecurityService.HasAccess("Administration/PickList/Edit"))
        {
            btnSave.Visible = false;
        }
    }
    protected override void OnFormBound()
    {
        base.OnFormBound();
        Hydrate();
        var str = ViewState["RunFormOnLoadLoadGrid"];

        str = str == null ? "false" : str.ToString();
        if (!IsPostBack || bool.Parse((string)str))
        {
            LoadGrid();
            ViewState.Remove("RunFormOnLoadLoadGrid");
        }
        if (RoleSecurityService != null && !RoleSecurityService.HasAccess("Administration/PickList/Add"))
        {
            btnAdd.Visible = false;
        }
        if (RoleSecurityService != null && !RoleSecurityService.HasAccess("Administration/PickList/Delete"))
        {
            grdPicklistItems.Columns[8].Visible = false;
        }
        if (RoleSecurityService != null && !RoleSecurityService.HasAccess("Administration/PickList/Edit"))
        {
            grdPicklistItems.Columns[7].Visible = false;
        }
    }
    private void LoadAccountTasks(EntityPage page)
    {
        var canPromote = RoleSecurityService.HasAccess("Entities/Account/PromoteAccount");
        var integrated = BusinessRuleHelper.IsIntegrationContractEnabled();

        if (page.IsDetailMode)
        {
            divEntityAccountList.Style.Add("display", "none");
            divEntityAccountDetails.Style.Add("display", "block");
            if (integrated)
            {
                IAccount account = EntityFactory.GetRepository <IAccount>().Get(page.EntityContext.EntityID);
                if (account == null)
                {
                    hideIntegration();
                    return;
                }
                lblLinkAccount.Visible = canPromote;
                imgLinkAccount.Visible = canPromote;
                if (account.PromotedToAccounting ?? false)
                {
                    IAppIdMapping slxFeed = IntegrationHelpers.GetSlxAccountingFeed();
                    lblLinkAccount.Text        = GetLocalResourceObject("lblLinkAnotherAccount.Caption").ToString();
                    lblNotLinkedStatus.Visible = false;
                    lblLinkedStatus.Visible    = true;
                    updateAccountPanel.Update();
                    lblLinkAccount.Visible = canPromote && !(slxFeed.RestrictToSingleAccount ?? false);
                    imgLinkAccount.Visible = canPromote && !(slxFeed.RestrictToSingleAccount ?? false);
                }
                else
                {
                    lblLinkAccount.Text        = GetLocalResourceObject("lblLinkAccount.Caption").ToString();
                    lblNotLinkedStatus.Visible = true;
                    lblLinkedStatus.Visible    = false;
                }
                lblLastUpdate.Text = String.Format(GetLocalResourceObject("lblLastUpdate.Caption").ToString(),
                                                   TimeZone.UTCDateTimeToLocalTime((DateTime)account.ModifyDate));
            }
            else
            {
                hideIntegration();
            }
            if (page.IsNewEntity)
            {
                updateAccountPanel.Update();
            }
        }
        else
        {
            if (!integrated)
            {
                hideIntegration();
            }
            else if (!canPromote)
            {
                rowlnkLinkAccount_List.Style.Add("display", "none");
            }
            divEntityAccountList.Style.Add("display", "block");
            divEntityAccountDetails.Style.Add("display", "none");
            lblLinkStatus.Visible = false;
        }
    }