Esempio n. 1
0
 private void LoadAccountTasks(EntityPage page)
 {
     if (page.IsDetailMode)
     {
         divEntityAccountList.Style.Add("display", "none");
         divEntityAccountDetails.Style.Add("display", "block");
         IAccount account = EntityFactory.GetRepository <IAccount>().Get(page.EntityContext.EntityID);
         if (account == null)
         {
             return;
         }
         if (BusinessRuleHelper.IsIntegrationContractEnabled())
         {
             if (account.PromotedToAccounting.HasValue && account.PromotedToAccounting.Value)
             {
                 lblLinkAccount.Text        = GetLocalResourceObject("lblLinkAnotherAccount.Caption").ToString();
                 lblNotLinkedStatus.Visible = false;
                 lblLinkedStatus.Visible    = true;
                 IAppIdMapping slxFeed = IntegrationHelpers.GetSlxAccountingFeed();
                 lblLinkAccount.Enabled = !slxFeed.RestrictToSingleAccount.HasValue ||
                                          !slxFeed.RestrictToSingleAccount.Value;
                 updateAccountPanel.Update();
             }
             else
             {
                 lblLinkAccount.Text        = GetLocalResourceObject("lblLinkAccount.Caption").ToString();
                 lblNotLinkedStatus.Visible = true;
                 lblLinkedStatus.Visible    = false;
                 lblLinkAccount.Enabled     = true;
             }
         }
         else
         {
             rowlnkLinkAccount.Style.Add("display", "none");
             rowlnkLinkAccount_List.Style.Add("display", "none");
             rowlnkLinkStatus.Style.Add("display", "none");
         }
         lblLastUpdate.Text = String.Format(GetLocalResourceObject("lblLastUpdate.Caption").ToString(),
                                            TimeZone.UTCDateTimeToLocalTime((DateTime)account.ModifyDate));
         if (page.IsNewEntity)
         {
             updateAccountPanel.Update();
         }
     }
     else
     {
         divEntityAccountList.Style.Add("display", "block");
         divEntityAccountDetails.Style.Add("display", "none");
         lblLinkStatus.Visible = false;
         if (!BusinessRuleHelper.IsIntegrationContractEnabled())
         {
             rowlnkLinkAccount.Style.Add("display", "none");
             rowlnkLinkAccount_List.Style.Add("display", "none");
             rowlnkLinkStatus.Style.Add("display", "none");
         }
     }
 }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        OpportunitiesOptions options = null;

        options = OpportunitiesOptions.Load(Server.MapPath(@"App_Data\LookupValues"));
        // set defaults
        if (options.OpportunityStatus != String.Empty)
        {
            pklOpportunityStatus.PickListValue = options.OpportunityStatus;
        }
        if (options.OpportunityType != String.Empty)
        {
            pklOpportunityType.PickListValue = options.OpportunityType;
        }
        if (options.Probability != String.Empty)
        {
            pklOpportunityProbability.PickListValue = options.Probability;
        }
        Utility.SetSelectedValue(_estimatedCloseToMonths, options.EstimatedCloseToMonths);

        //Set the default to none if ther is not a match.
        try
        {
            _salesProcess.SelectedValue = options.SalesProcess;
        }
        catch (Exception)
        {
            _salesProcess.SelectedValue = "NONE";
        }

        if (options.DefaultContacts != String.Empty)
        {
            _defaultContacts.SelectedIndex = Convert.ToInt32(options.DefaultContacts);
        }
        _useDefaultNamingConventions.Checked    = options.UseDefaultNamingConventions;
        _estimatedCloseToLastDayOfMonth.Checked = options.EstimatedCloseToLastDayOfMonth;
        var systemInfo = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.SalesLogix.Services.ISystemOptionsService>(true);

        if (systemInfo.MultiCurrency)
        {
            lblDefCurrency.Visible = true;
            luDefCurrency.Visible  = true;
            if (options.DefCurrencyCode != String.Empty)
            {
                luDefCurrency.LookupResultValue = EntityFactory.GetById <IExchangeRate>(options.DefCurrencyCode);
            }
        }
        else
        {
            lblDefCurrency.Visible = false;
            luDefCurrency.Visible  = false;
        }
        _addProducts.Visible = !BusinessRuleHelper.IsIntegrationContractEnabled();
    }
    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;
        }
    }