public void CreateProfile(dtoBaseProfile profile, Int32 idProfileType, String ProfileName, Int32 idOrganization) { List <ProfilerError> errors = InternalService.VerifyProfileInfo(profile); if (errors.Count == 0) { InternalAuthenticationProvider provider = InternalService.GetActiveProvider(); ProfileSubscriptionMessage message = View.CreateProfile(profile, idProfileType, ProfileName, idOrganization, AuthenticationProviderType.Internal, (provider == null) ? (long)0 : provider.Id); Int32 idPerson = View.IdProfile; if (idPerson > 0) { PolicyService.SaveUserSelection(CurrentManager.GetPerson(idPerson), View.GetPolicyInfo); } if (message == ProfileSubscriptionMessage.CreatedWithAutoLogon && idPerson > 0) { Person person = CurrentManager.GetPerson(View.IdProfile); View.LogonUser(person, provider.Id, lm.Comol.Core.BaseModules.AuthenticationManagement.RootObject.InternalLogin(false), true, CurrentManager.GetUserDefaultIdOrganization(idPerson)); } else { if (message == ProfileSubscriptionMessage.CreatedWithAutoLogon) { message = ProfileSubscriptionMessage.Created; } View.LoadRegistrationMessage(message); } } else { if (errors.Contains(ProfilerError.loginduplicate)) { View.LoadRegistrationMessage(ProfileSubscriptionMessage.LoginDuplicated); } else if (errors.Contains(ProfilerError.mailDuplicate)) { View.LoadRegistrationMessage(ProfileSubscriptionMessage.MailDuplicated); } else if (errors.Contains(ProfilerError.taxCodeDuplicate)) { View.LoadRegistrationMessage(ProfileSubscriptionMessage.TaxCodeDuplicated); } else if (errors.Contains(ProfilerError.uniqueIDduplicate)) { View.LoadRegistrationMessage(ProfileSubscriptionMessage.MatriculaDuplicated); } else { View.LoadRegistrationMessage(ProfileSubscriptionMessage.UnknownError); } } }