Пример #1
0
    /// <summary>
    /// Handles the OnClick 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_OnClick(object sender, EventArgs e)
    {
        var user   = (IUser)BindingSource.Current;
        var userId = user.Id.ToString();

        _userOptionService = PageWorkItem.BuildTransientItem <UserOptionsService>();
        _userOptionService.SetUserId(userId);
        _userOptionService.SetCommonOption("InsertSecCodeID", "General", ownAccount.LookupResultValue.ToString(), !chkbxAllowChange.Checked);
        switch (cboTemplateType.SelectedIndex)
        {
        // Contact
        case 0:
            // Contact
            _userOptionService.SetCommonOption("DefaultMemoTemplate", "General", txtEmailBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultMemoTemplateID", "General", txtEmailBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLetterTemplate", "General", txtLetterBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLetterTemplateID", "General", txtLetterBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultFaxTemplate", "General", txtFaxBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultFaxTemplateID", "General", txtFaxBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
            break;

        // Lead
        case 1:
            _userOptionService.SetCommonOption("DefaultLeadMemoTemplate", "General", txtEmailBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLeadMemoTemplateID", "General", txtEmailBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLeadLetterTemplate", "General", txtLetterBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLeadLetterTemplateID", "General", txtLetterBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLeadFaxTemplate", "General", txtFaxBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
            _userOptionService.SetCommonOption("DefaultLeadFaxTemplateID", "General", txtFaxBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
            break;
        }
    }
Пример #2
0
    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        _userOptions = await UserOptionsService.GetOptionsAsync();

        await WebExtensions.Commands.OnCommand.AddListener(OnReceivedCommand);
    }
Пример #3
0
    /// <summary>
    /// Loads the view.
    /// </summary>
    private void LoadView()
    {
        var user   = (IUser)BindingSource.Current;
        var userId = user.Id.ToString();

        if (_userOptionService == null)
        {
            _userOptionService = PageWorkItem.BuildTransientItem <UserOptionsService>();
        }
        _userOptionService.SetUserId(userId);
        ownAccount.LookupResultValue      = _userOptionService.GetCommonOption("InsertSecCodeID", "General", false, Owner.SystemEveryone, String.Empty);
        chkbxAllowChange.Checked          = !_userOptionService.GetCommonOptionLocked("InsertSecCodeID", "General");
        chkbxAllowChangeTemplates.Checked = !_userOptionService.GetCommonOptionLocked("DefaultMemoTemplate", "General");

        switch (cboTemplateType.SelectedIndex)
        {
        // Contact
        case 0:
            txtEmailBaseTemplate.Text     = _userOptionService.GetCommonOption("DefaultMemoTemplate", "General");
            txtEmailBaseTemplateId.Value  = _userOptionService.GetCommonOption("DefaultMemoTemplateID", "General");
            txtLetterBaseTemplate.Text    = _userOptionService.GetCommonOption("DefaultLetterTemplate", "General");
            txtLetterBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultLetterTemplateID", "General");
            txtFaxBaseTemplate.Text       = _userOptionService.GetCommonOption("DefaultFaxTemplate", "General");
            txtFaxBaseTemplateId.Value    = _userOptionService.GetCommonOption("DefaultFaxTemplateID", "General");
            break;

        // Lead
        case 1:
            txtEmailBaseTemplate.Text     = _userOptionService.GetCommonOption("DefaultLeadMemoTemplate", "General");
            txtEmailBaseTemplateId.Value  = _userOptionService.GetCommonOption("DefaultLeadMemoTemplateID", "General");
            txtLetterBaseTemplate.Text    = _userOptionService.GetCommonOption("DefaultLeadLetterTemplate", "General");
            txtLetterBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultLeadLetterTemplateID", "General");
            txtFaxBaseTemplate.Text       = _userOptionService.GetCommonOption("DefaultLeadFaxTemplate", "General");
            txtFaxBaseTemplateId.Value    = _userOptionService.GetCommonOption("DefaultLeadFaxTemplateID", "General");
            break;
        }

        if ((user.Type == UserType.WebViewer) || (user.Type == UserType.AddOn))
        {
            txtFaxBaseTemplate.Attributes.Add("DISABLED", "");
            txtFaxBaseTemplate.Attributes["onclick"] = "";

            txtLetterBaseTemplate.Attributes.Add("DISABLED", "");
            txtLetterBaseTemplate.Attributes["onclick"] = "";

            txtEmailBaseTemplate.Attributes.Add("DISABLED", "");
            txtEmailBaseTemplate.Attributes["onclick"] = "";

            chkbxAllowChangeTemplates.Enabled = false;
        }
    }
Пример #4
0
    /// <summary>
    /// Loads the view.
    /// </summary>
    private void LoadView()
    {
        var user = (IUser)BindingSource.Current;
        var userId = user.Id.ToString();
        if (_userOptionService == null)
            _userOptionService = PageWorkItem.BuildTransientItem<UserOptionsService>();
        _userOptionService.SetUserId(userId);
        ownAccount.LookupResultValue = _userOptionService.GetCommonOption("InsertSecCodeID", "General", false, Owner.SystemEveryone, String.Empty);
        chkbxAllowChange.Checked = !_userOptionService.GetCommonOptionLocked("InsertSecCodeID", "General");
        chkbxAllowChangeTemplates.Checked = !_userOptionService.GetCommonOptionLocked("DefaultMemoTemplate", "General");

        switch (cboTemplateType.SelectedIndex)
        {
            // Contact
            case 0:
                txtEmailBaseTemplate.Text = _userOptionService.GetCommonOption("DefaultMemoTemplate", "General");
                txtEmailBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultMemoTemplateID", "General");
                txtLetterBaseTemplate.Text = _userOptionService.GetCommonOption("DefaultLetterTemplate", "General");
                txtLetterBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultLetterTemplateID", "General");
                txtFaxBaseTemplate.Text = _userOptionService.GetCommonOption("DefaultFaxTemplate", "General");
                txtFaxBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultFaxTemplateID", "General");
                break;
            // Lead
            case 1:
                txtEmailBaseTemplate.Text = _userOptionService.GetCommonOption("DefaultLeadMemoTemplate", "General");
                txtEmailBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultLeadMemoTemplateID", "General");
                txtLetterBaseTemplate.Text = _userOptionService.GetCommonOption("DefaultLeadLetterTemplate", "General");
                txtLetterBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultLeadLetterTemplateID", "General");
                txtFaxBaseTemplate.Text = _userOptionService.GetCommonOption("DefaultLeadFaxTemplate", "General");
                txtFaxBaseTemplateId.Value = _userOptionService.GetCommonOption("DefaultLeadFaxTemplateID", "General");
                break;
        }

        if ((user.Type == UserType.WebViewer) || (user.Type == UserType.AddOn))
        {
            txtFaxBaseTemplate.Attributes.Add("DISABLED", "");
            txtFaxBaseTemplate.Attributes["onclick"] = "";

            txtLetterBaseTemplate.Attributes.Add("DISABLED", "");
            txtLetterBaseTemplate.Attributes["onclick"] = "";

            txtEmailBaseTemplate.Attributes.Add("DISABLED", "");
            txtEmailBaseTemplate.Attributes["onclick"] = "";

            chkbxAllowChangeTemplates.Enabled = false;
        }
    }
Пример #5
0
 /// <summary>
 /// Handles the OnClick 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_OnClick(object sender, EventArgs e)
 {
     var user = (IUser)BindingSource.Current;
     var userId = user.Id.ToString();
     _userOptionService = PageWorkItem.BuildTransientItem<UserOptionsService>();
     _userOptionService.SetUserId(userId);
     _userOptionService.SetCommonOption("InsertSecCodeID", "General", ownAccount.LookupResultValue.ToString(), !chkbxAllowChange.Checked);
     switch (cboTemplateType.SelectedIndex)
     {
         // Contact
         case 0:
             // Contact
             _userOptionService.SetCommonOption("DefaultMemoTemplate", "General", txtEmailBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultMemoTemplateID", "General", txtEmailBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLetterTemplate", "General", txtLetterBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLetterTemplateID", "General", txtLetterBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultFaxTemplate", "General", txtFaxBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultFaxTemplateID", "General", txtFaxBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
             break;
         // Lead
         case 1:
             _userOptionService.SetCommonOption("DefaultLeadMemoTemplate", "General", txtEmailBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLeadMemoTemplateID", "General", txtEmailBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLeadLetterTemplate", "General", txtLetterBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLeadLetterTemplateID", "General", txtLetterBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLeadFaxTemplate", "General", txtFaxBaseTemplate.Text, !chkbxAllowChangeTemplates.Checked);
             _userOptionService.SetCommonOption("DefaultLeadFaxTemplateID", "General", txtFaxBaseTemplateId.Value, !chkbxAllowChangeTemplates.Checked);
             break;
     }
 }