예제 #1
0
        protected void ContactEntityControl_OnContact(Object sender, Web.Application.Controls.ContactEntityEventArgs eventArgs)
        {
            if (eventArgs.Cancel)
            {
                Response.Redirect(ReferrerUrl, true);
            }

            if (eventArgs.EntityContact != null)
            {
            }

            if (eventArgs.EntityContact != null)
            {
                Boolean success = MercuryApplication.EntityContactSave(eventArgs.EntityContact);

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

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

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

            return;
        }
        protected void EntityContactControl_OnContact(Object sender, Web.Application.Controls.ContactEntityEventArgs eventArgs)
        {
            Server.Application.WorkflowUserInteractionResponseContactEntity contactResponse = new Server.Application.WorkflowUserInteractionResponseContactEntity();

            contactResponse.InteractionType = Mercury.Server.Application.UserInteractionType.ContactEntity;


            if (!eventArgs.Cancel)
            {
                contactResponse.EntityContact = (Mercury.Server.Application.EntityContact)eventArgs.EntityContact.ToServerObject();

                // contactResponse.EntityType = eventArgs.Entity.EntityType;

                // contactResponse.EntityId = eventArgs.EntityContact.EntityId;

                //contactResponse.Entity = (Mercury.Server.Application.Entity)eventArgs.Entity.ToServerObject ();

                //contactResponse.RelatedEntity = (eventArgs.RelatedEntity != null) ? (Mercury.Server.Application.Entity)eventArgs.RelatedEntity.ToServerObject () : null;

                //contactResponse.EntityContactInformationId = eventArgs.EntityContact.EntityContactInformationId;

                //contactResponse.ContactType = eventArgs.EntityContact.ContactType;

                //contactResponse.ContactDate = eventArgs.EntityContact.ContactDate;

                //contactResponse.Direction = eventArgs.EntityContact.Direction;

                //contactResponse.Regarding = eventArgs.EntityContact.Regarding;

                //contactResponse.Remarks = eventArgs.EntityContact.Remarks;

                //contactResponse.Successful = eventArgs.EntityContact.Successful && (!eventArgs.Cancel);

                //contactResponse.ContactOutcome = eventArgs.EntityContact.ContactOutcome;
            }

            contactResponse.Cancel = eventArgs.Cancel;



            WorkflowPage.UserInteractionResponse = contactResponse;


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

                if (ajaxManager != null)
                {
                    ajaxManager.ResponseScripts.Add(ResponseScript);
                }
            }

            return;
        }