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();
        }
    }
Пример #2
0
 void ProcessSessionEnd()
 {
     if (Session[0] != null)
     {
         // assumes the work item is the first entry added to the session
         Sage.Platform.Application.WorkItem workItem = Session[0] as Sage.Platform.Application.WorkItem;
         if (workItem != null)
         {
             IDataService wds = workItem.Services.Get <IDataService>();
             if (wds != null)
             {
                 ((SLXWebDataService)wds).CleanupSession();
             }
         }
     }
 }