public ActionResult Create(UserViewModel collection) { UserViewModel item = new UserViewModel(); item._Roles = ProcessUser.GetRoles(); item._Category = ProcessUser.GetCategory(); try { var status = ProcessUser.CreateUser(collection); if (status == "success") { return(RedirectToAction("Index")); } if (status == "exist") { ViewBag.ErrorMessage = "User Already Exist"; return(View(item)); } else if (status == "error") { ViewBag.ErrorMessage = "An Error Occurred during Creation"; return(View(item)); } else { ViewBag.ErrorMessage = "Invalid Username"; return(View(item)); } } catch { return(View()); } }
public ActionResult Edit(int id, UserViewModel collection) { var _user = ProcessUser.GetAllUsers(id); _user._Category = ProcessUser.GetCategory(); _user._Roles = ProcessUser.GetRoles(); try { // TODO: Add update logic here var status = ProcessUser.EditUser(id, collection); if (status == true) { return(RedirectToAction("Index")); } else { ViewBag.ErrorMessage = "An Error Occurred"; return(View(_user)); } } catch { return(View(_user)); } }
private static bool UserFilterPredicate(ProcessUser u, string keyword) { return((u.Address?.Contains(keyword, StringComparison.InvariantCultureIgnoreCase) ?? false) || (u.Description?.Contains(keyword, StringComparison.InvariantCultureIgnoreCase) ?? false) || (string.IsNullOrWhiteSpace(u.Name) ? true : u.Name.Contains(keyword, StringComparison.InvariantCultureIgnoreCase)) || u.Roles.Any(r => r.Name.Contains(keyword, StringComparison.InvariantCultureIgnoreCase))); }
// GET: User/Edit/5 public ActionResult Edit(int id) { var _user = ProcessUser.GetAllUsers(id); _user._Category = ProcessUser.GetCategory(); _user._Roles = ProcessUser.GetRoles(); return(View(_user)); }
public void RemoveUser(ProcessUser removedUser) { RedoableCommands.Clear(); var removeCommand = new RemoveUserCommand(_contractManager, removedUser); removeCommand.Execute(); UndoableCommands.Push(removeCommand); }
public void OnUserRemove(ProcessUser removedUser) { RedoableCommands.Clear(); var removeCommand = new RemoveUserCommand(_userModelManager, removedUser); removeCommand.Execute(); UndoableCommands.Push(removeCommand); }
public void RemoveUser(ProcessUser user) { if (!Contract.Users.Contains(user)) { throw new InvalidIdException($"User id {user.Id} could not be removed, contract does not contain user"); } Contract.Users.Remove(user); UserRemoved?.Invoke(this, user); }
public void AddUser(ProcessUser user) { if (Contract.Users.Any(u => user.Id == u.Id)) { throw new DuplicateIdException($"Contract already contains user id {user.Id}"); } Contract.Users.Add(user); UserAdded?.Invoke(this, user); }
// GET: User/Create public ActionResult Create() { UserViewModel item = new UserViewModel(); item._Roles = ProcessUser.GetRoles(); item._Category = ProcessUser.GetCategory(); ViewBag.Users = Common.GetUsersInProcurement(); return(View(item)); }
public ProcessUser AddNewUser() { var user = new ProcessUser { Id = Guid.NewGuid().ToString() }; Contract.Users.Add(user); UserAdded?.Invoke(this, user); return(user); }
public override void Execute() { if (AddedUser != null) { UserModelManager.AddUser(AddedUser); } else { AddedUser = UserModelManager.AddNewUser(); } }
public override void Execute() { if (AddedUser != null) { ContractManager.AddUser(AddedUser); } else { AddedUser = ContractManager.AddNewUser(); } }
public void AddUser_ShouldAdd() { var addedUser = new ProcessUser { Id = "User1" }; _userModelManager.AddUser(addedUser); Assert.Single(_contract.Users); Assert.Contains(addedUser, _contract.Users); Assert.Equal(_contract.Users, _userModelManager.GetProcessUsers()); }
public override bool Equals(object obj) { var other = obj as ReAttachTarget; if (other == null) { return(false); } return(ProcessPath.Equals(other.ProcessPath, StringComparison.OrdinalIgnoreCase) && ProcessUser.Equals(other.ProcessUser, StringComparison.OrdinalIgnoreCase) && ServerName.Equals(other.ServerName, StringComparison.OrdinalIgnoreCase)); }
public NetRoomReader() { foodObjectReader = new ProcessFood(); drinkObjectReader = new ProcessDrink(); cardObjectReader = new ProcessCard(); categoryObjectReader = new ProcessCategory(); clientObjectReader = new ProcessClient(); memberObjectReader = new ProcessMember(); groupClientObjectReader = new ProcessGroupClient(); groupUserObjectReader = new ProcessGroupUser(); userObjectReader = new ProcessUser(); billObjectReader = new ProcessBill(); }
public async Task <IActionResult> UpdateUserAsync(int id, [FromBody] ProcessUser resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var user = mapper.Map <ProcessUser, User>(resource); var result = await this.userService.UpdateAsync(id, user); if (!result.Success) { return(BadRequest(result.Message)); } return(Ok(result.User)); }
private void loginForm_Load(object sender, EventArgs e) { try { txtUsername.Focus(); ProcessUser processUser = new ProcessUser(); if (Properties.Settings.Default.Username != string.Empty) { txtUsername.Text = Properties.Settings.Default.Username; txtPassword.Text = Properties.Settings.Default.userPassword; checkBoxRemember.Checked = true; } } catch (Exception) { } }
public async Task <IActionResult> PostUserAsync([FromBody] ProcessUser resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var user = mapper.Map <ProcessUser, User>(resource); var result = await this.userService.CreateAsync(user); if (!result.Success) { return(BadRequest(result.Message)); } rabbitMqService.Send(result); return(Ok(result.User)); }
public void RemoveUserAndUndo_ShouldMatch() { var addedUser = new ProcessUser { Id = "USER1" }; _userModelManagerMock.Setup(x => x.AddNewUser()).Returns(addedUser).Verifiable(); _userModelManagerMock.Setup(x => x.AddUser(addedUser)).Verifiable(); _userModelManagerMock.Setup(x => x.AddUser(addedUser)).Verifiable(); _usersRolesFacade.OnUserAdd(); _userModelManagerMock.Verify(x => x.AddNewUser(), Times.Once); _usersRolesFacade.OnUserRemove(addedUser); _userModelManagerMock.Verify(x => x.RemoveUser(addedUser), Times.Once); _usersRolesFacade.Undo(); _userModelManagerMock.Verify(x => x.AddUser(addedUser), Times.Once); }
public PostManager() { users = ProcessUser.ProcessUsers("users.csv"); pets = ProcessPet.ProcessPets("pets.csv"); posts = ProcessPost.ProcessPosts("post.csv"); }
public override int GetHashCode() { return(ProcessPath.ToLower().GetHashCode() + ProcessUser.ToLower().GetHashCode() + ServerName.ToLower().GetHashCode()); }
public RemoveUserCommand(IUserModelManager userModelManager, ProcessUser removedUser) : base(userModelManager) { RemovedUser = removedUser; }
public RemoveUserCommand(IContractManager contractManager, ProcessUser removedUser) : base(contractManager) { RemovedUser = removedUser; }
protected void OnUserRemoved(object sender, ProcessUser removedUser) { _select2Components.Remove(removedUser.Id); FilterUsers(UsersFilter); }
protected void OnUserAdded(object sender, ProcessUser addedUser) { FilterUsers(UsersFilter); StateHasChanged(); }
// GET: User public ActionResult Index() { var _user = ProcessUser.GetAllUsers(); return(View(_user)); }