コード例 #1
0
    protected override void OnFormBound()
    {
        base.OnFormBound();

        if (IsActivating)
        {
            ResetForm();
            SetValuesFromEntityHistory();
            ClientBindingMgr.SetFocusTo(rbContact);
        }

        btnContinue.Enabled    = NewUnscheduledActivity.Checked;
        OpenActivities.Visible = false;

        if (CompleteScheduledActivity.Checked)
        {
            LookupControl lookup = GetBoundLookup();
            Session["entityName"] = lookup != null ? lookup.LookupEntityName : null;
            Session["entityId"]   = lookup != null?GetId(lookup.LookupResultValue) : null;

            OpenActivities.DataBind();
            OpenActivities.Visible = OpenActivities.Rows.Count > 0;
        }
        if (Account.LookupResultValue != null)
        {
            SetSeedValues();
        }
        if (LeadId.LookupResultValue == null)
        {
            Company.Text = string.Empty;
        }
    }
コード例 #2
0
    protected override void OnFormBound()
    {
        // TODO: Need to research and fix the cause of the double post back that attempts to fire a second
        // OnFormBound while the dialog is closing.  This null check should not be necessary.
        if (BindingSource.Current == null)
        {
            return;
        }

        base.OnFormBound();

        if (IsActivating)
        {
            if (Form != null)
            {
                Form.Reset(Controls);
                if (Form.IsInsert)
                {
                    if (Activity.RecurrenceState != RecurrenceState.rstOccurrence)
                    {
                        Activity.Type = Params.Type;
                    }
                }
                ClientBindingMgr.SetFocusTo(Description);
            }
        }

        // TODO: can we use OnRegisterClientScript instead?
        RegisterScripts();

        FillForm();
    }
コード例 #3
0
    protected override void OnFormBound()
    {
        base.OnFormBound();

        if (IsActivating)
        {
            ResetForm();
            SetValuesFromEntityHistory();
            ClientBindingMgr.SetFocusTo(rbContact);
        }

        btnContinue.Enabled = NewUnscheduledActivity.Checked;
        divResults.Visible  = false;

        if (CompleteScheduledActivity.Checked)
        {
            LookupControl lookup = GetBoundLookup();
            Session["entityName"] = lookup != null ? lookup.LookupEntityName : null;
            Session["entityId"]   = lookup != null?GetId(lookup.LookupResultValue) : null;

            OpenActivities.DataBind();
            divResults.Visible = true;
        }
        if (Account.LookupResultValue != null)
        {
            SetSeedValues();
        }
        if (LeadId.LookupResultValue == null)
        {
            Company.Text = string.Empty;
        }

        ScriptManager.RegisterClientScriptInclude(this, GetType(), "ScheduleCompleteActivity", Page.ResolveUrl("~/SmartParts/Activity/ScheduleCompleteActivity.js"));
        var script = new StringBuilder();

        if (Page.IsPostBack)
        {
            script.Append(" Sage.UI.Forms.ScheduleCompleteActivity.init(" + GetWorkSpace() + " );");
        }
        else
        {
            script.Append("require(['dojo/ready'], function(ready) { " +
                          "ready(function () { Sage.UI.Forms.ScheduleCompleteActivity.init(" + GetWorkSpace() + "); }); " +
                          "});");
        }
        ScriptManager.RegisterStartupScript(this, GetType(), "initialize_ScheduleCompleteActivity", script.ToString(), true);
    }