Esempio n. 1
0
        protected void EntityContactInformationTerminateWindow_ButtonOk_OnClick(Object sender, EventArgs e)
        {
            Boolean success = true;


            if (!EntityContactInformationTerminateTerminationDate.SelectedDate.HasValue)
            {
                EntityContactInformationTerminateTerminationDate.SelectedDate = null;

                EntityContactInformationTerminateResponse.Text = "Unable to determine the requested Termination Date.";

                return;
            }


            Int64 terminatedEntityContactInformationId = Convert.ToInt64(EntityContactInformationTerminateId.Text);

            Client.Core.Entity.EntityContactInformation currentEntityContactInformation = MercuryApplication.EntityContactInformationGet(terminatedEntityContactInformationId, false);

            if (Convert.ToDateTime(EntityContactInformationTerminateTerminationDate.SelectedDate) < currentEntityContactInformation.EffectiveDate)
            {
                EntityContactInformationTerminateTerminationDate.SelectedDate = null;

                EntityContactInformationTerminateResponse.Text = "The requested Termination Date is not valid.";

                return;
            }


            success = MercuryApplication.EntityContactInformationTerminate(currentEntityContactInformation, EntityContactInformationTerminateTerminationDate.SelectedDate.Value);


            if (success)
            {
                EntityContactInformationHistoryGrid_ManualDataRebind();

                EntityContactInformationTerminateTerminationDate.SelectedDate = null;


                Telerik.Web.UI.RadAjaxManager telerikAjaxManager = (Telerik.Web.UI.RadAjaxManager)Page.FindControl("TelerikAjaxManager");

                if (telerikAjaxManager != null)
                {
                    telerikAjaxManager.ResponseScripts.Add("EntityContactInformationTerminateWindow_Close ();");
                }
            }

            else
            {
                if (MercuryApplication.LastException != null)
                {
                    EntityContactInformationTerminateResponse.Text = MercuryApplication.LastException.Message;
                }

                else
                {
                    EntityContactInformationTerminateResponse.Text = "Unknown exception occurreed. Unable to Terminate.";
                }
            }

            return;
        }