Example #1
0
        public ActionResult UserAddress()
        {
            LoadCountries();

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            UserAddressModel model = new UserAddressModel();

            BootBaronLib.AppSpec.DasKlub.BOL.UserAddress uadress = new UserAddress();

            uadress.GetUserAddress(ua.UserAccountID);

            if (BootBaronLib.Configs.GeneralConfigs.IsGiveAway && uadress.UserAddressID > 0) return View("NotAllowed");

            if (uadress.UserAddressID == 0)
            {
                model.PostalCode = uad.PostalCode;
                model.Country = uad.Country;
            }
            else
            {
                model.AddressLine1 = uadress.AddressLine1;
                model.AddressLine2 = uadress.AddressLine2;
                model.AddressLine3 = uadress.AddressLine3;
                model.City = uadress.City;
                model.Country = uadress.CountryISO;
                model.FirstName = uadress.FirstName;
                model.LastName = uadress.LastName;
                model.PostalCode = uadress.PostalCode;
                model.RegionState = uadress.Region;
            }

            return View(model);
        }
Example #2
0
        public ActionResult UserAddress(UserAddressModel model)
        {
            LoadCountries();

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            BootBaronLib.AppSpec.DasKlub.BOL.UserAddress uadress = new UserAddress();

            uadress.GetUserAddress(ua.UserAccountID);

            TryUpdateModel(model);

            if (ModelState.IsValid)
            {
                uadress.AddressLine1 = model.AddressLine1;
                uadress.AddressLine2 = model.AddressLine2;
                uadress.AddressLine3 = model.AddressLine3;
                uadress.City = model.City;
                uadress.CountryISO = model.Country;
                uadress.FirstName = model.FirstName;
                uadress.LastName = model.LastName;
                uadress.PostalCode = model.PostalCode;
                uadress.Region = model.RegionState;
                uadress.UserAccountID = ua.UserAccountID;

                if (uadress.UserAddressID == 0) uadress.AddressStatus = 'U';

                ViewBag.ProfileUpdated = uadress.Set();
            }
            //if (BootBaronLib.AppSpec.DasKlub.BOL.UserAddress.IsBlank(ua.UserAccountID))
            //{
            //    newUAdd.UserAccountID = ua.UserAccountID;
            //    newUAdd.CreatedByUserID = ua.UserAccountID;

            //    if (Request.Form["no_button"] != null &&
            //        Request.Form["no_button"] == "no")
            //    {
            //        newUAdd.AddressStatus = 'N';
            //    }
            //    else
            //    {
            //        newUAdd.AddressStatus = 'U';
            //    }

            //    if (!string.IsNullOrEmpty(newUAdd.PostalCode) && (string.IsNullOrEmpty(newUAdd.City) || string.IsNullOrEmpty(newUAdd.Region)))
            //    {
            //        // for those those who think the system can figure them out
            //        SiteEnums.CountryCodeISO coiso = GeoData.GetCountryISOForCountryCode(newUAdd.CountryISO);

            //        SiteStructs.CityRegion cr = GeoData.GetCityRegionForPostalCodeCountry(newUAdd.PostalCode, coiso);

            //        newUAdd.Region = cr.Region;
            //        newUAdd.City = cr.CityName;
            //    }

            //    newUAdd.Create();
            //}
            ////Response.Redirect("/" + ua.UserName);
            //Response.Redirect("~/thanks.htm");

            //uad = new UserAccountDetail();
            //uad.GetUserAccountDeailForUser(ua.UserAccountID);

            return View(model);
        }