protected void SendCorrespondenceEntityControl_OnSendCorrespondence(Object sender, Web.Application.Controls.SendCorrespondenceEntityEventArgs eventArgs)
        {
            if (eventArgs.Cancel)
            {
                Response.Redirect(ReferrerUrl, true);
            }

            if (eventArgs.EntityCorrespondence != null)
            {
                Boolean success = MercuryApplication.EntityCorrespondenceSave(eventArgs.EntityCorrespondence);

                if (success)
                {
                    Response.Redirect(ReferrerUrl, true);
                }

                else
                {
                    String postScript = ("alert (\"Unable to Save Correspondence. " + ((MercuryApplication.LastException != null) ? MercuryApplication.LastException.Message : String.Empty) + "\");");

                    if ((TelerikAjaxManager != null) && (!String.IsNullOrEmpty(postScript)))
                    {
                        TelerikAjaxManager.ResponseScripts.Add(postScript);
                    }
                }
            }


            return;
        }
        protected void EntitySendCorrespondenceControl_OnSendCorrespondence(Object sender, Web.Application.Controls.SendCorrespondenceEntityEventArgs eventArgs)
        {
            Server.Application.WorkflowUserInteractionResponseSendCorrespondence sendCorrespondenceResponse = new Server.Application.WorkflowUserInteractionResponseSendCorrespondence();

            sendCorrespondenceResponse.InteractionType = Mercury.Server.Application.UserInteractionType.SendCorrespondence;

            if (!eventArgs.Cancel)
            {
                sendCorrespondenceResponse.EntityCorrespondence = (Mercury.Server.Application.EntityCorrespondence)eventArgs.EntityCorrespondence.ToServerObject();
            }

            else
            {
                sendCorrespondenceResponse.EntityCorrespondence = null;
            }


            sendCorrespondenceResponse.Send = (!eventArgs.Cancel);

            sendCorrespondenceResponse.Cancel = eventArgs.Cancel;


            WorkflowPage.UserInteractionResponse = sendCorrespondenceResponse;


            if (!String.IsNullOrEmpty(ResponseScript))
            {
                Telerik.Web.UI.RadAjaxManager ajaxManager = (Telerik.Web.UI.RadAjaxManager)Page.FindControl("TelerikAjaxManager");

                ajaxManager.ResponseScripts.Add(ResponseScript);
            }

            return;
        }