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

            if (eventArgs.EntityAddress != null)
            {
                Boolean success = false;

                success = MercuryApplication.EntityAddressSave(eventArgs.EntityAddress);

                if (success)
                {
                    List <Client.Core.Entity.EntityAddress> addresses = MercuryApplication.EntityAddressesGet(EntityId, false);

                    Response.Redirect(ReferrerUrl, true);
                }

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

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

            return;
        }
示例#2
0
        private void InitializeContentGrid()
        {
            System.Data.DataTable dataTable;

            dataTable = new System.Data.DataTable();

            dataTable.Columns.Add("EntityAddressId");

            dataTable.Columns.Add("AddressType");

            dataTable.Columns.Add("Line1");

            dataTable.Columns.Add("Line2");

            dataTable.Columns.Add("City");

            dataTable.Columns.Add("State");

            dataTable.Columns.Add("ZipCode");

            dataTable.Columns.Add("ZipPlus4");

            dataTable.Columns.Add("PostalCode");

            dataTable.Columns.Add("County");

            dataTable.Columns.Add("Longitude");

            dataTable.Columns.Add("Latitude");

            dataTable.Columns.Add("EffectiveDate");

            dataTable.Columns.Add("TerminationDate");

            dataTable.Columns.Add("CreateAccountName");

            dataTable.Columns.Add("CreateDate");

            dataTable.Columns.Add("ModifiedAccountName");

            dataTable.Columns.Add("ModifiedDate");

            List <Mercury.Client.Core.Entity.EntityAddress> addresses = new List <Mercury.Client.Core.Entity.EntityAddress> ();

            addresses = MercuryApplication.EntityAddressesGet(EntityId, false);

            foreach (Mercury.Client.Core.Entity.EntityAddress currentAddress in addresses)
            {
                dataTable.Rows.Add(

                    currentAddress.Id,

                    Mercury.Server.CommonFunctions.EnumerationToString(currentAddress.AddressType),

                    currentAddress.Line1,

                    currentAddress.Line2,

                    currentAddress.City,

                    currentAddress.State,

                    currentAddress.ZipCode,

                    currentAddress.ZipPlus4,

                    currentAddress.PostalCode,

                    currentAddress.County,

                    currentAddress.Longitude,

                    currentAddress.Latitude,

                    currentAddress.EffectiveDate.ToString("MM/dd/yyyy"),

                    currentAddress.TerminationDate.ToString("MM/dd/yyyy"),

                    currentAddress.CreateAccountInfo.UserAccountName,

                    currentAddress.CreateAccountInfo.ActionDate.ToString("MM/dd/yyyy"),

                    currentAddress.ModifiedAccountInfo.UserAccountName,

                    currentAddress.ModifiedAccountInfo.ActionDate.ToString("MM/dd/yyyy")

                    );
            } /* END FOREACH */

            EntityAddressContentGrid.MasterTableView.DataSource = dataTable;

            EntityAddressContentGrid.MasterTableView.DataBind();

            return;
        }