Beispiel #1
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/SlxOptions.css\" />"));
        GeneralSearchOptions options;

        try
        {
            options = GeneralSearchOptions.Load(Server.MapPath(_optionsMapPath));
        }
        catch
        {
            // temporary, as the service throws an exception for options not found
            // the service is not yet complete, but this allows testing of the UI
            options = GeneralSearchOptions.CreateNew(Server.MapPath(_optionsMapPath));
        }

        _logToHistory.DataSource     = options.LogToHistoryLookupList;
        _logToHistory.DataTextField  = options.DataTextField;
        _logToHistory.DataValueField = options.DataValueField;
        _logoffUnits.DataSource      = options.LogoffUnitsList;
        _logoffUnits.DataTextField   = options.DataTextField;
        _logoffUnits.DataValueField  = options.DataValueField;

        LoadIntellisyncOptions();
        BindShowOnStartup();
        Page.DataBind();
    }
Beispiel #2
0
    /// <summary>
    /// Handles the Click event of the _save control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void _save_Click(object sender, EventArgs e)
    {
        if (txtRecentTemplates.Visible)
        {
            int iCount;
            if (int.TryParse(txtRecentTemplates.Text, out iCount))
            {
                if (iCount < 0 || iCount > 10)
                {
                    throw new ValidationException(htxtMenuRangeMessage.Value);
                }
            }
            else
            {
                throw new ValidationException(htxtMenuRangeMessage.Value);
            }
        }
        // save values
        GeneralSearchOptions options = new GeneralSearchOptions(Server.MapPath(_optionsMapPath));

        options.ShowOnStartup    = GetStartupUrl(_showOnStartup.SelectedValue);
        options.DefaultOwnerTeam = _defaultOwnerTeam.LookupResultValue.ToString();
        options.LogToHistory     = _logToHistory.SelectedValue;
        //Defect 1-80914
        //  DThompson - "Please only hide the options for now.  We may re-enable them in Sawgrass depending on the direction we choose to take."
        //options.PromptForDuplicateContacts = _promptDuplicateContacts.Checked;
        //options.PromptForContactNotFound = _promptContactNotFound.Checked;
        options.UseActiveReporting = _useActiveReporting.Checked;
        options.AutoLogoff         = _autoLogoff.Checked;
        options.LogoffDuration     = Convert.ToInt32(_logoffDuration.Text);
        options.LogoffUnits        = _logoffUnits.SelectedValue;
        options.EmailBaseTemplate  = txtEmailBaseTemplateId.Text;
        options.LetterBaseTemplate = txtLetterBaseTemplateId.Text;
        options.FaxBaseTemplate    = txtFaxBaseTemplateId.Text;
        options.RecentTemplates    = txtRecentTemplates.Text;

        options.PromptForUnsavedData = chkPromptForUnsavedData.Checked;

        if (FaxProviderSelectedValue.Value != "undefined")
        {
            options.FaxProvider = FaxProviderSelectedValue.Value;
        }
        else
        {
            options.FaxProvider = txtFaxProvider.Text;
        }
        if (luMyCurrency.LookupResultValue != null)
        {
            options.MyCurrencyCode = ((IExchangeRate)(luMyCurrency.LookupResultValue)).Id.ToString();
        }

        // Saves the intellisync group
        IUserOptionsService _UserOptions = ApplicationContext.Current.Services.Get <IUserOptionsService>();

        if (_intellisyncGroup.SelectedItem != null)
        {
            _UserOptions.SetCommonOption("SyncGroup", "Intellisync", _intellisyncGroup.SelectedValue, false);
            options.Save();
        }
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/SlxOptions.css\" />"));
        try
        {
            _options = GeneralSearchOptions.Load(Server.MapPath(_optionsMapPath));
        }
        catch
        {
            // temporary, as the service throws an exception for options not found
            // the service is not yet complete, but this allows testing of the UI
            _options = GeneralSearchOptions.CreateNew(Server.MapPath(_optionsMapPath));
        }

        LoadIntellisyncOptions();
        BindShowOnStartup();
        BindLogoffUnits();
        BindLogToHistory();
        Page.DataBind();
    }
Beispiel #4
0
    /// <summary>
    /// Handles the PreRender event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_PreRender(object sender, EventArgs e)
    {
        GeneralSearchOptions options;

        options = GeneralSearchOptions.Load(Server.MapPath(_optionsMapPath));
        // set defaults
        Utility.SetSelectedValue(_showOnStartup, GetStartupValFromUrl(options.ShowOnStartup));
        if (options.DefaultOwnerTeam != string.Empty)
        {
            _defaultOwnerTeam.LookupResultValue = EntityFactory.GetById <IOwner>(options.DefaultOwnerTeam);
        }
        Utility.SetSelectedValue(_logToHistory, "T");
        const string falseValues = "F,FALSE,N,NO,0";

        if (falseValues.IndexOf(options.LogToHistory.ToUpperInvariant()) > -1)
        {
            Utility.SetSelectedValue(_logToHistory, "F");
        }
        //Defect 1-80914
        //  DThompson - "Please only hide the options for now.  We may re-enable them in Sawgrass depending on the direction we choose to take."
        //_promptDuplicateContacts.Checked = options.PromptForDuplicateContacts;
        //_promptContactNotFound.Checked = options.PromptForContactNotFound;
        _useActiveReporting.Checked = options.UseActiveReporting;
        _autoLogoff.Checked         = options.AutoLogoff;
        _logoffDuration.Text        = options.LogoffDuration.ToString();
        Utility.SetSelectedValue(_logoffUnits, options.LogoffUnits);
        txtEmailBaseTemplateId.Text     = options.EmailBaseTemplate;
        txtLetterBaseTemplateId.Text    = options.LetterBaseTemplate;
        txtFaxBaseTemplateId.Text       = options.FaxBaseTemplate;
        txtRecentTemplates.Text         = options.RecentTemplates;
        txtFaxProvider.Text             = options.FaxProvider;
        chkPromptForUnsavedData.Checked = options.PromptForUnsavedData;

        txtEmailBaseTemplate.Text  = Utility.GetSingleValue("Name", "Plugin", "PluginId", txtEmailBaseTemplateId.Text);
        txtLetterBaseTemplate.Text = Utility.GetSingleValue("Name", "Plugin", "PluginId", txtLetterBaseTemplateId.Text);
        txtFaxBaseTemplate.Text    = Utility.GetSingleValue("Name", "Plugin", "PluginId", txtFaxBaseTemplateId.Text);

        var systemInfo = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.SalesLogix.Services.ISystemOptionsService>(true);

        if (systemInfo.MultiCurrency)
        {
            lblMyCurrency.Visible = true;
            luMyCurrency.Visible  = true;
            if (!String.IsNullOrEmpty(options.MyCurrencyCode))
            {
                luMyCurrency.LookupResultValue = EntityFactory.GetById <IExchangeRate>(options.MyCurrencyCode);
            }
        }
        else
        {
            lblMyCurrency.Visible = false;
            luMyCurrency.Visible  = false;
        }
        txtEmailBaseTemplateId.Attributes.Add("style", "display:none");
        txtLetterBaseTemplateId.Attributes.Add("style", "display:none");
        txtFaxBaseTemplateId.Attributes.Add("style", "display:none");
        txtRecentTemplates.Attributes.Add("onchange", "javascript:checkMenuRange()");

        var       optionSvc = ApplicationContext.Current.Services.Get <Sage.SalesLogix.Services.ISystemOptionsService>(true);
        int       dbType    = optionSvc.DbType;
        const int dbRemote  = 2;

        if (dbType != dbRemote)
        {
            // If this is *not* a remote database then hide the "Use ActiveReporting" option.
            _useActiveReporting.Attributes.Add("style", "display:none");
        }

        IUserOptionsService _UserOptions = ApplicationContext.Current.Services.Get <IUserOptionsService>();
        string _group = _UserOptions.GetCommonOption("SyncGroup", "Intellisync");

        _defaultOwnerTeam.Enabled = !_UserOptions.GetCommonOptionLocked("InsertSecCodeID", "General");

        if (!string.IsNullOrEmpty(_group))
        {
            Utility.SetSelectedValue(_intellisyncGroup, _group);
            _intellisyncGroup.Enabled = false;
        }
        else
        {
            _intellisyncGroup.Enabled = true;
        }

        bool AllowUserToChange = !_UserOptions.GetCommonOptionLocked("DefaultMemoTemplate", "General");

        txtEmailBaseTemplate.Enabled  = AllowUserToChange;
        txtLetterBaseTemplate.Enabled = AllowUserToChange;
        txtFaxBaseTemplate.Enabled    = AllowUserToChange;
        if (!AllowUserToChange)
        {
            txtEmailBaseTemplateImg.Attributes.Add("onclick", "");
            txtLetterBaseTemplateImg.Attributes.Add("onclick", "");
            txtFaxBaseTemplateImg.Attributes.Add("onclick", "");
        }
        LoadScript();
    }
    /// <summary>
    /// Handles the Click event of the _save control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void _save_Click(object sender, EventArgs e)
    {
        if (txtRecentTemplates.Visible)
        {
            int iCount;
            if (int.TryParse(txtRecentTemplates.Text, out iCount))
            {
                if (iCount < 0 || iCount > 10)
                {
                    throw new ValidationException(htxtMenuRangeMessage.Value);
                }
            }
            else
                throw new ValidationException(htxtMenuRangeMessage.Value);
        }
        // save values
        GeneralSearchOptions options = new GeneralSearchOptions(Server.MapPath(_optionsMapPath));
        options.ShowOnStartup = GetStartupUrl(_showOnStartup.SelectedValue);
        options.DefaultOwnerTeam = _defaultOwnerTeam.LookupResultValue.ToString();
        options.LogToHistory = _logToHistory.SelectedValue;
        options.PromptForDuplicateContacts = _promptDuplicateContacts.Checked;
        options.PromptForContactNotFound = _promptContactNotFound.Checked;
        options.UseActiveReporting = _useActiveReporting.Checked;
        options.AutoLogoff = _autoLogoff.Checked;
        options.LogoffDuration = Convert.ToInt32(_logoffDuration.Text);
        options.LogoffUnits = _logoffUnits.SelectedValue;
        options.EmailBaseTemplate = txtEmailBaseTemplateId.Text;
        options.LetterBaseTemplate = txtLetterBaseTemplateId.Text;
        options.FaxBaseTemplate = txtFaxBaseTemplateId.Text;
        options.RecentTemplates = txtRecentTemplates.Text;

        options.PromptForUnsavedData = chkPromptForUnsavedData.Checked;

        if (FaxProviderSelectedValue.Value != "undefined")
        {
            options.FaxProvider = FaxProviderSelectedValue.Value;
        }
        else
        {
            options.FaxProvider = txtFaxProvider.Text;
        }
        if (luMyCurrency.LookupResultValue != null)
        {
            options.MyCurrencyCode = ((IExchangeRate)(luMyCurrency.LookupResultValue)).Id.ToString();
        }

        // Saves the intellisync group
        IUserOptionsService _UserOptions = ApplicationContext.Current.Services.Get<IUserOptionsService>();

        if (_intellisyncGroup.SelectedItem != null)
        {

            _UserOptions.SetCommonOption("SyncGroup", "Intellisync", _intellisyncGroup.SelectedValue, false);
            options.Save();
        }
    }