private Control FindCompActControl(string controlID)
    {
        TabWorkspace ActivityTabs = PageWorkItem.Workspaces["TabControl"] as TabWorkspace;

        if (ActivityTabs != null)
        {
            Control tabControl = ActivityTabs.GetSmartPartByID("ActivityDetails");
            return(tabControl.FindControl(controlID));
        }
        return(null);
    }
Beispiel #2
0
    protected void btnSave_ClickActionBRC(object sender, EventArgs e)
    {
        TabWorkspace ActivityTabs = PageWorkItem.Workspaces["TabControl"] as TabWorkspace;

        if (ActivityTabs != null)
        {
            Control     historyDetails       = ActivityTabs.GetSmartPartByID("HistoryDetails");
            SLXCheckBox CarryOverAttachments = historyDetails.FindControl("CarryOverAttachments") as SLXCheckBox;
            if (CarryOverAttachments == null)
            {
                throw new ApplicationException("CarryOverAttachments control not found.");
            }
            SLXCheckBox CarryOverNotes = historyDetails.FindControl("CarryOverNotes") as SLXCheckBox;
            if (CarryOverNotes == null)
            {
                throw new ApplicationException("CarryOverNotes control not found.");
            }
            ListBox FollowUpActivity = historyDetails.FindControl("FollowUpActivity") as ListBox;
            if (FollowUpActivity == null)
            {
                throw new ApplicationException("FollowUpActivity control not found.");
            }

            if (FollowUpActivity.SelectedValue == "None")
            {
                return;
            }

            Dictionary <string, string> args = new Dictionary <string, string>();
            args.Add("type", FollowUpActivity.SelectedValue);

            if (CarryOverNotes.Checked || CarryOverAttachments.Checked)
            {
                args.Add("historyid", EntityContext.EntityID.ToString());
            }
            if (CarryOverNotes.Checked)
            {
                args.Add("carryovernotes", "true");
            }
            if (CarryOverAttachments.Checked)
            {
                args.Add("carryoverattachments", "true");
            }
            var hist = BindingSource.Current as IHistory;
            if (hist != null)
            {
                args.Add("leadname", hist.LeadName);
            }

            new LinkHandler(Page).ScheduleActivity(args);
        }
    }
    public void OkButton_Click(object sender, EventArgs e)
    {
        RadioButton    rbLead           = null;
        DurationPicker ReminderDuration = null;

        TabWorkspace ActivityTabs = PageWorkItem.Workspaces["TabControl"] as TabWorkspace;

        if (ActivityTabs != null)
        {
            Control tabControl = ActivityTabs.GetSmartPartByID("ActivityDetails");
            rbLead           = tabControl.FindControl("rbLead") as RadioButton;
            ReminderDuration = tabControl.FindControl("ReminderDuration") as DurationPicker;
        }

        //break associations if not on that radio button per 1-61398
        if (rbLead != null)
        {
            if (rbLead.Checked)
            {
                Activity.ContactId     = null;
                Activity.OpportunityId = null;
                Activity.TicketId      = null;
                Activity.AccountId     = null;
                Activity.ContactName   = null;
                if (Activity.LeadId == null)
                {
                    Activity.AccountName = null;
                }
                Activity.OpportunityName = null;
                Activity.TicketNumber    = null;
            }
            else
            {
                Activity.LeadName = null;
                if (Activity.AccountId == null)
                {
                    Activity.AccountName = null;
                }
                Activity.LeadId = null;
            }
        }

        // save insert mode status since save will change it
        bool insertMode = Activity.ActivityId.Length != 12;
        bool recurring  = Activity.RecurrenceState == RecurrenceState.rstOccurrence;

        if (recurring)
        {
            ActivityOccurrence occ = (ActivityOccurrence)Activity;
            if (ReminderDuration != null)
            {
                occ.ReminderDuration = ReminderDuration.Value;
            }
            occ.Save();
        }
        else
        {
            if (ReminderDuration != null)
            {
                Activity.ReminderDuration = ReminderDuration.Value;
            }
            Activity.Save();
        }

        if (insertMode)
        {
            UpdateTempAttachments();
            if (recurring)
            {
                HandleRecurringAttachments();
            }
        }

        CloseParentDialog(true);
    }