Пример #1
0
        public CreateUserOut Create(CreateUserIn input)
        {
            var output = new CreateUserOut()
            {
                result = Entities.Common.Result.Error
            };
            var request = new Business.User.User();

            var getUserInfoOut = request.GetUsers(new MethodParameters.User.GetUsersIn()
            {
            }).listUsers.FirstOrDefault(x => x.usrID == input.currentUser.usrID);
            var permissionRequest        = new Business.Permission.Permission();
            var validateAccesFunctionOut = permissionRequest.GetPermissionByRole(new MethodParameters.Permission.GetPermissionByRoleIn()
            {
                role = getUserInfoOut.usr_role
            });

            if (validateAccesFunctionOut.result == Entities.Common.Result.Success &&
                validateAccesFunctionOut.listPermissions.FirstOrDefault(x => x.pm_code == "01") != null)
            {
                var password       = Common.Security.Encryption.Encrypt(input.usr_password, input.usr_userName);
                var createUsertOut = request.CreateUser(new MethodParameters.User.CreateUserIn()
                {
                    user = new Entities.Database.User()
                    {
                        usr_userName       = input.usr_userName,
                        usr_password       = password,
                        usr_fullName       = input.usr_fullName,
                        usr_documentType   = input.usr_documentType,
                        usr_numberDocument = input.usr_numberDocument,
                        usr_email          = input.usr_email,
                        usr_role           = input.usr_role
                    }
                });

                if (createUsertOut.result == Entities.Common.Result.Success)
                {
                    output.result = Entities.Common.Result.Success;
                }
            }
            else if (validateAccesFunctionOut.result == Entities.Common.Result.Success)
            {
                output.message = "Esta funcionalidad no se encuentra disponible para usuarios no Administrador";
            }

            return(output);
        }
Пример #2
0
 public void CreateUser(string data)
 {
     user = new Business.User.User();
     user.CreateUser(data);
 }