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;
        }
    }
Exemple #2
0
 public void ResetAutoLookup()
 {
     if (Active)
     {
         LookupControl.ResetAutoLookup();
     }
 }
    protected void Save_ClickActionBRC(object sender, EventArgs e)
    {
        History history = BindingSource.Current as History;

        if (history != null)
        {
            /* Update any attachment records that were created in Insert mode. */
            Sage.Platform.Application.WorkItem workItem = PageWorkItem;
            if (workItem != null)
            {
                Object oStrTempAssociationID = workItem.State["TempAssociationID"];
                if (oStrTempAssociationID != null)
                {
                    String strTempAssociationID = oStrTempAssociationID.ToString();
                    Type   typ = EntityContext.EntityType;
                    System.Collections.Generic.IList <IAttachment> attachments =
                        Sage.SalesLogix.Attachment.Rules.GetAttachmentsFor(typ, strTempAssociationID);
                    if (attachments != null)
                    {
                        foreach (IAttachment attach in attachments)
                        {
                            attach.HistoryId = history.Id;
                            attach.Save();
                            /* Move the attachment from the \Attachment\_temporary path to the \Attachment path. */
                            Sage.SalesLogix.Attachment.Rules.MoveTempAttachment(attach);
                        }
                    }
                    workItem.State.Remove("TempAssociationID");
                }
            }

            LookupControl   Lead          = null;
            RadioButtonList ContactOrLead = null;
            TabPanel        Details       = InsertNotesDialog.Panels[0];

            foreach (Control c in Details.Controls)
            {
                Lead          = c.FindControl("Lead") as LookupControl;
                ContactOrLead = c.FindControl("ContactOrLead") as RadioButtonList;
            }

            if (ContactOrLead.SelectedValue == ContactOrLead.Items[0].Value)
            {
                history.LeadId = String.Empty;
            }
            else
            {
                history.ContactId     = String.Empty;
                history.AccountId     = String.Empty;
                history.OpportunityId = String.Empty;
                history.TicketId      = String.Empty;
            }
            if (Lead.LookupResultValue.ToString().Length == 12)
            {
                history.AccountName = EntityFactory.GetById <ILead>(history.LeadId).Company;
                history.ContactName = EntityFactory.GetById <ILead>(history.LeadId).LeadFullName;
            }
            history.Save();
        }
    }
    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);
    }
        public LookupRequest(string name, LookupControl lookupControls = null, params ILookupRequestFilter [] filters)
        {
            Name           = name;
            LookupControls = lookupControls;

            if (string.IsNullOrEmpty(name))
            {
                throw new InvalidOperationException("name cannot be null or empty.");
            }

            this.Name           = name;
            this.LookupControls = lookupControls;

            if (filters != null && filters.Any())
            {
                this.RequestFilters = filters;
            }
        }