Beispiel #1
0
        public CreateUserOut CreateUser(CreateUserIn input)
        {
            CreateUserOut output = new CreateUserOut()
            {
                result = Entities.Common.Result.Error
            };

            using (var dataContext = DataContextHelper.GetDataContext <UserDataContext>())
            {
                var linqResult = dataContext.spr_setUser(input.user.usr_userName,
                                                         input.user.usr_password,
                                                         input.user.usr_fullName,
                                                         input.user.usr_documentType,
                                                         input.user.usr_numberDocument,
                                                         input.user.usr_email,
                                                         input.user.usr_role,
                                                         input.user.usr_creationUser);
                if (linqResult > 0)
                {
                    output.usrID  = linqResult;
                    output.result = Entities.Common.Result.Success;
                }
            }
            return(output);
        }
Beispiel #2
0
 //[CustomAuthorizationFilterAttribute]
 public IHttpActionResult CreateUser(CreateUserIn input)
 {
     if (ModelState.IsValid)
     {
         var user          = new SystemManagement.Business.Controllers.User();
         var createUserOut = user.Create(input);
         return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.OK, createUserOut)));
     }
     else
     {
         var output = new CreateUserOut();
         output.result  = SystemManagement.Entities.Common.Result.Error;
         output.message = DetailErrorBadRequest(ModelState);
         return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest, output)));
     }
 }
Beispiel #3
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);
        }
Beispiel #4
0
        public IActionResult Create(CreateUserIn userIn)
        {
            if (_userSvc.Create(userIn, out var user) == false)
            {
                return(Ok(new
                {
                    success = false,
                    reason = "Failed to Create User",
                }));
            }

            return(Ok(new
            {
                success = true,
                user,
            }));
        }
Beispiel #5
0
        public static async Task createuser()
        {
            var p = new CreateUserIn
            {
                Email     = u.Email,
                Password  = u.Password,
                FirstName = u.FirstName,
                LastName  = u.LastName,
                Deviceid  = deviceid
            };
            var userdata = await client.PostAsJsonAsync <CreateUserOut>("user/createuser", p);

            sessionid = userdata.Sessionid.ToString();

            Assert.AreEqual(u.FirstName, userdata.Firstname);
            Assert.AreEqual(u.LastName, userdata.Lastname);
            Assert.AreEqual(u.Email, userdata.Email);

            fs.WriteLine("deviceid: " + deviceid);
        }
        public CreateUserOut CreateUser(CreateUserIn input)
        {
            var User = new SystemManagement.DataAccess.User.User();

            return(User.CreateUser(input));
        }