Exemplo n.º 1
0
        public long SaveDefaultUserforOrganization(long organizationId, OrganizationType type, User user)
        {
            _addressService.SaveAfterSanitizing(user.Address);
            Roles defaultRole = 0;

            switch (type)
            {
            case OrganizationType.Franchisee:
                defaultRole = Roles.FranchiseeAdmin;
                break;

            case OrganizationType.CallCenter:
                defaultRole = Roles.CallCenterManager;
                break;

            case OrganizationType.MedicalVendor:
                defaultRole = Roles.MedicalVendorAdmin;
                break;
            }
            if (user.Id == 0)
            {
                user.DefaultRole = defaultRole;
                user.UserLogin.IsSecurityQuestionVerified = false;
            }
            long userId = _userRepository.SaveUser(user).Id;

            _orgRoleUserRepository.SaveOrganizationRoleUser(new OrganizationRoleUser(userId, (long)defaultRole, organizationId));

            return(userId);
        }
Exemplo n.º 2
0
        public CallCenterRep SaveCallCenterRep(CallCenterRep callCenterRep, long organizationId)
        {
            if (callCenterRep == null)
            {
                throw new ArgumentNullException("CallCenterRep");
            }

            if (callCenterRep.Address != null)
            {
                callCenterRep.Address = _addressService.SaveAfterSanitizing(callCenterRep.Address);
            }
            callCenterRep.DefaultRole = Roles.CallCenterRep;
            callCenterRep             = _userRepository.SaveUser(callCenterRep);
            var orgRoleUser = _orgRoleUserRepository.SaveOrganizationRoleUser(new OrganizationRoleUser(callCenterRep.Id, (long)Roles.CallCenterRep,
                                                                                                       organizationId));

            _callcenterRepository.Save(callCenterRep, orgRoleUser.Id);
            return(callCenterRep);
        }