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();
    }
    protected void _save_Click(object sender, EventArgs e)
    {
        // save values
        OpportunitiesOptions options = new OpportunitiesOptions(Server.MapPath(@"App_Data\LookupValues"));

        options.OpportunityStatus              = pklOpportunityStatus.PickListValue;
        options.OpportunityType                = pklOpportunityType.PickListValue;
        options.Probability                    = pklOpportunityProbability.PickListValue;
        options.EstimatedCloseToMonths         = _estimatedCloseToMonths.SelectedValue;
        options.SalesProcess                   = _salesProcess.SelectedValue;
        options.DefaultContacts                = _defaultContacts.SelectedValue;
        options.UseDefaultNamingConventions    = _useDefaultNamingConventions.Checked;
        options.EstimatedCloseToLastDayOfMonth = _estimatedCloseToLastDayOfMonth.Checked;
        if (luDefCurrency.LookupResultValue != null)
        {
            options.DefCurrencyCode = ((IExchangeRate)luDefCurrency.LookupResultValue).CurrencyCode;
        }
        options.Save();
    }
 protected void _save_Click(object sender, EventArgs e)
 {
     // save values
     OpportunitiesOptions options = new OpportunitiesOptions(Server.MapPath(@"App_Data\LookupValues"));
     options.OpportunityStatus = pklOpportunityStatus.PickListValue;
     options.OpportunityType = pklOpportunityType.PickListValue;
     options.Probability = pklOpportunityProbability.PickListValue;
     options.EstimatedCloseToMonths = _estimatedCloseToMonths.SelectedValue;
     options.SalesProcess = _salesProcess.SelectedValue;
     options.DefaultContacts = _defaultContacts.SelectedValue;
     options.UseDefaultNamingConventions = _useDefaultNamingConventions.Checked;
     options.EstimatedCloseToLastDayOfMonth = _estimatedCloseToLastDayOfMonth.Checked;
     if (luDefCurrency.LookupResultValue != null)
     {
         options.DefCurrencyCode = ((IExchangeRate)luDefCurrency.LookupResultValue).Id.ToString();
     }
     options.Save();
 }