Exemplo n.º 1
0
        public override void BusinessRulesFor(ControllerCreateEditParameter parm)
        {
            base.BusinessRulesFor(parm);
            Country country = parm.Entity as Country;

            //Make sure a blank state exists for the country... if not, create one.
            createCreateBlankStateForCountry(parm);
            country.Abbreviation = country.Abbreviation.ToUpper();
        }
Exemplo n.º 2
0
        public override void Fix(ControllerCreateEditParameter parm)
        {
            ApplicationUser appUser = parm.Entity as ApplicationUser;

            appUser.IsNullThrowException("Unable to unbox user");

            appUser.Name = appUser.UserName;
            base.Fix(parm);

            //if (appUser.CountryId.IsNullOrWhiteSpace())
            //    appUser.CountryId = null;

            if (appUser.PersonId.IsNullOrWhiteSpace())
            {
                appUser.PersonId = null;
            }

            bool newBlackListed   = !appUser.BlackListOldValue && appUser.BlackListed.Value;
            bool newUnBlackListed = appUser.BlackListOldValue && !appUser.BlackListed.Value;

            bool newSuspended   = !appUser.SuspendedOldValue && appUser.Suspended.Value;
            bool newUnSuspended = appUser.SuspendedOldValue && !appUser.Suspended.Value;

            if (newBlackListed)
            {
                appUser.BlackListed.Activate(UserId, UserName);
            }

            if (newUnBlackListed)
            {
                appUser.BlackListed.Deactivate(UserId, UserName);
            }

            if (newSuspended)
            {
                appUser.Suspended.Activate(UserId, UserName);
            }

            if (newUnSuspended)
            {
                appUser.Suspended.Deactivate(UserId, UserName);
            }
        }
Exemplo n.º 3
0
        private void createCreateBlankStateForCountry(ControllerCreateEditParameter parm)
        {
            Country country = parm.Entity as Country;

            if (StateBiz.BlankStateExistsForCountryId(country.Id))
            {
                return;
            }

            State s = StateBiz.Factory() as State;

            s.Country               = country;
            s.CountryId             = country.Id;
            s.MetaData.IsEditLocked = true;

            ControllerCreateEditParameter parmState = new ControllerCreateEditParameter();

            parmState.Entity = s as ICommonWithId;
            StateBiz.Create(parmState);
        }