protected void AddressCardView_CardUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            long addressId = (long)e.Keys["AddressId"];

            ITaxpayerAddress address = context.ITaxpayerAddresses.Find(addressId);

            address.StreetNo     = (String)e.NewValues["StreetNo"];
            address.AddressLine1 = (String)e.NewValues["AddressLine1"];
            address.AddressLine2 = (String)e.NewValues["AddressLine2"];
            address.CountryId    = (int?)(e.NewValues["CountryId"]);
            address.StateId      = (String)(e.NewValues["StateId"]);
            address.City         = (String)(e.NewValues["City"]);
            address.LgaId        = (int?)(e.NewValues["LgaId"]);
            address.PostCode     = (String)(e.NewValues["PostCode"]);
            address.IsPrimary    = (Boolean)(e.NewValues["IsPrimary"]);

            SaveAddress(address, "Update");

            e.Cancel = true;
            AddressCardView.CancelEdit();
        }
        protected void AddressCardView_CardInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ITaxpayerAddress address = new ITaxpayerAddress
            {
                TIN          = (string)ViewState["TIN"],
                StreetNo     = (String)e.NewValues["StreetNo"],
                AddressLine1 = (String)e.NewValues["AddressLine1"],
                AddressLine2 = (String)e.NewValues["AddressLine2"],
                CountryId    = (int)(e.NewValues["CountryId"]),
                StateId      = (String)(e.NewValues["StateId"]),
                City         = (String)(e.NewValues["City"]),
                LgaId        = (int)(e.NewValues["LgaId"]),
                PostCode     = (String)(e.NewValues["PostCode"]),
                CreateDate   = DateTime.Now,
                CreatedBy    = (String)Session["UserName"],
                IsPrimary    = (Boolean)(e.NewValues["IsPrimary"])
            };

            SaveAddress(address, "Add");

            e.Cancel = true;
            AddressCardView.CancelEdit();
        }