Ejemplo n.º 1
0
        public void CreateUser(UserDto userDto)
        {
            if (this.IsExistUser(userDto.UserName))
                return;

            var user = new User(userDto.UserName, userDto.Password, userDto.EmployeeNo, userDto.Email,
                userDto.EnglishName, userDto.LocalName,
                userDto.Company, userDto.Organization, userDto.OrganizationDescription, userDto.Department, userDto.Job,
                userDto.Tel, userDto.Extension, userDto.VOIP, userDto.OnBoardDate, userDto.Manager, userDto.Agent,
                userDto.Grade, userDto.Shift, userDto.CreatedBy);

            this._userRepository.Add(user);
        }
Ejemplo n.º 2
0
        public ActionResult AttachRole(UserDto model, Guid? role)
        {
            try
            {
                using (var service = ServiceLocator.Instance.Resolve<IUserService>())
                {
                    var creator = this.LoginUser.Identity.Name;
                    service.SetRoles(this.LoginUser.NameIdentifier.Value, this.Tenant.ID, role, creator);

                    return Json(true);
                }
            }
            catch (Exception)
            {
                return Json(false, "Set the user role failure.");
            }
        }
Ejemplo n.º 3
0
        public void UpdateUser(UserDto userDto)
        {
            var spec = UserSpecification.FindUser(userDto.UserName);
            var user = this._userRepository.Find(spec);
            if (user != null)
            {
                user.Update(userDto.Password, userDto.EmployeeNo, userDto.Email,
                    userDto.EnglishName, userDto.LocalName,
                    userDto.Company, userDto.Organization, userDto.OrganizationDescription, userDto.Department,
                    userDto.Job,
                    userDto.Tel, userDto.Extension, userDto.VOIP, userDto.OnBoardDate, userDto.Manager, userDto.Agent,
                    userDto.Grade, userDto.Shift, userDto.UpdatedBy);

                this._userRepository.Update(user);
            }
        }