private async void SaveAction() { if (string.IsNullOrWhiteSpace(CurrentItem.Title)) { _dialog.ShowMessage("Error", "Invalid Title"); } else if (string.IsNullOrWhiteSpace(CurrentItem.Message)) { _dialog.ShowMessage("Error", "Invalid Message"); } else { CurrentItem.EventTime = CurrentDate.Add(CurrentTime); CurrentItem.ParticementUserIds = AllUsers.Where(x => x.IsChecked).Select(m => m.Id).ToList(); CurrentItem.ParticementUserIds.Add(AppService.CurrentUser.Id); CurrentItem.OwnerId = AppService.CurrentUser.Id; IsBusy = true; if (CurrentItem.Id == 0) { var resp = await _todoHandler.AddToDoItem(CurrentItem); ShowResponse(resp, true); } else { var resp = await _todoHandler.UpdateToDoItem(CurrentItem); ShowResponse(resp, true); } IsBusy = false; } }
private void LoadAllUsers() { AllUsers.Clear(); var users = _userRepository.GetAll(); AllUsers.AddRange(users); }
/// <summary> /// Au changement de rôle. /// </summary> /// <param name="e"></param> /// <param name="idUser"></param> public void OnChangeRole(ChangeEventArgs e, string idUser) { try { var selectedValue = e.Value.ToString(); UserView currentUser = AllUsers.Where(x => x.User.Id == idUser).FirstOrDefault(); if (string.IsNullOrEmpty(selectedValue)) { return; } if (selectedValue == "Inactif") { UserManager.RemoveFromRoleAsync(currentUser.User, currentUser.Role); } else { UserManager.RemoveFromRoleAsync(currentUser.User, currentUser.Role); UserManager.AddToRoleAsync(currentUser.User, selectedValue); } AllUsers = GetAllUser().ToList(); } catch (Exception ex) { Log.Error(ex, "Erreur sur changement de role."); } }
public async Task <IActionResult> GetListOfUsers() { AllUsers users = await _accountsService.GetListOfUsers(); if (users.IsNull) { return(new JsonResult(await Errors .GetGenericErrorResponse( new GetAllUsersResponse() { ListOfAllUsers = null, StatusCode = 400, Error = "Server was unable to get a list of users", Description = "The server could not get the list of users.", Code = "server_was_unable_to_a_get_list_of_users" }))); } return(new JsonResult( Wrappyfier.WrapAPIList( 200, users._AllUsers.Count == 0 ? Constants.APIMessages.ListOfUsersEmpty : Constants.APIMessages.ListOfUsers, users._AllUsers ))); }
void ShowDataWinrate(AllUsers allUsers) { foreach (var userData in allUsers.userDatas) { Debug.Log("----------------"); var userName = userData.name; foreach (var gameData in userData.gameDatas) { var nameOfGameType = GetNameByGameType(gameData); Debug.Log($"Game type name: {nameOfGameType}"); int amountOfCorrect = 0; int amountOfIncorrect = 0; foreach (var specificGame in gameData.specificGameDatas) { var specificGameTime = specificGame.time; var specificGameIsCorrect = specificGame.isCorrect; if (specificGameIsCorrect) { amountOfCorrect++; } else { amountOfIncorrect++; } } } print("Saved users: " + userName); } }
private void asdf() { string token = Session.Token; //findByIdPurchaseRequestStatusInTwoNineAndExpirationDateGreatherThanNow //Servicio para obtener una lista de todos los productos de una solicitud de compra rechazado y que la fecha de expiración sea mayor que la fecha actual var purchaseRequestStatus = VirtualFairIntegration.FindByIdPurchaseRequestStatusInTwoNineAndExpirationDateGreatherThanNow(token); if (purchaseRequestStatus.countRows != 0) { List <AllUsers> lstProducts = new List <AllUsers>(); foreach (var item in purchaseRequestStatus.purchaseRequestProducts) { AllUsers cmb = new AllUsers(); cmb.id = Convert.ToInt32(item.id); cmb.nameUser = Convert.ToInt32(item.product.id); cmb.profileUser = item.product.name.ToString(); lstProducts.Add(cmb); } cmbUsers.DataSource = lstProducts; cmbUsers.ValueMember = "id"; cmbUsers.DisplayMember = "nameUserProfileUser"; cmbUsers.DropDownStyle = ComboBoxStyle.DropDownList; } }
public (int, int) CountUsersInTeamsInProject(Project p) { int c1 = AllUsers.Where(team => team.Team.ProjectId == p.ProjectId).Where(u => u.User.Course == 1).Count(); int c2 = AllUsers.Where(team => team.Team.ProjectId == p.ProjectId).Where(u => u.User.Course == 2).Count(); return(c1, c2); }
/// <summary> /// To save the Client User association /// </summary> /// <param name="clientUserMapViewModel"></param> /// <returns></returns> public bool SaveClientUsers(ClientUserMapViewModel clientUserMapViewModel) { try { if (clientUserMapViewModel != null) { ClientUserMap clientUserMap = new ClientUserMap(); clientUserMap.ClientCode = clientUserMapViewModel.ClientCode; foreach (AllUsersViewModel clientUserViewModel in clientUserMapViewModel.ClientUsers) { AllUsers clientUser = new AllUsers(); clientUser.Email = clientUserViewModel.Email; clientUser.RoleName = clientUserViewModel.Role; clientUserMap.ClientUsers.Add(clientUser); } return(_clientUserRepository.SaveClientUsers(clientUserMap)); } return(false); } catch (Exception ex) { _logger.Log(ex, LogLevel.Error, ex.Message); return(false); } }
/// <summary> /// Sucht den User und filtert die Ansicht /// </summary> public void SearchUser() { // Prüft damit nicht der selbe Text nochmal gesucht wird if ((string.IsNullOrEmpty(LastSearchTextUser) && string.IsNullOrEmpty(SearchTextUser)) || string.Equals(LastSearchTextUser, SearchTextUser)) { return; } // Wenn wir keinen Suchtext haben if (string.IsNullOrEmpty(SearchTextUser)) { // Mache gefilterte Liste gleich Allen Usern UsersFiltered = new ObservableCollection <UserPrincipal>(AllUsers); // Setze letzte Suche LastSearchTextUser = SearchTextUser; return; } // Finde alle Items die den Text enthalten UsersFiltered = new ObservableCollection <UserPrincipal>( AllUsers.Where(x => x.Name.ToLower().Contains(SearchTextUser.ToLower()))); // Setze letzte Suche LastSearchTextUser = SearchTextUser; }
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { BookTicketRepository bkRepo = new BookTicketRepository(); AllUsersRepository userRepo = new AllUsersRepository(); if (e.RowIndex >= 0) { AllUsers u = userRepo.GetUserById(passId); DataGridViewRow row = bookTicketGridView.Rows[e.RowIndex]; int x = bkRepo.TicketCount(); int y; y = x + 2; Console.WriteLine(passId + " " + u.UserId + " " + u.UserName + " " + u.UserFullName + " - " + x); this.bookTicketTabs.SelectTab(1); flightIdLabel.Text = row.Cells["FlightId"].Value.ToString(); airplaneLabel.Text = row.Cells["AirlineName"].Value.ToString(); ticketIdLabel.Text = y.ToString(); passengerIdLabel.Text = passId.ToString(); passengerFullNameLabel.Text = u.UserFullName; usernameLabel.Text = u.UserName; sourceLabel.Text = row.Cells["Source"].Value.ToString(); destinationLabel.Text = row.Cells["Destination"].Value.ToString(); departureLabel.Text = row.Cells["Departure"].Value.ToString(); costLabel.Text = row.Cells["Cost"].Value.ToString(); } }
/// <summary> /// Au changement de rôle. /// </summary> /// <param name="e"></param> /// <param name="idUser"></param> public async Task OnChangeRole(ChangeEventArgs e, string idUser) { try { var selectedValue = e.Value.ToString(); UserView currentUser = AllUsers.Where(x => x.User.Id == idUser).FirstOrDefault(); if (string.IsNullOrEmpty(selectedValue)) { return; } Log.Information("USER - Changement ROLE pour {username} - ancien {role} - nouveau {selectedValue} ", currentUser.User.UserName, currentUser.Role, selectedValue); // Utilisateur qui a déjà un rôle. if (currentUser.Role != null) { await UserManager.RemoveFromRoleAsync(currentUser.User, currentUser.Role); } if (selectedValue != "SansRole") { await UserManager.AddToRoleAsync(currentUser.User, selectedValue); } AllUsers = await GetAllUser(); } catch (Exception ex) { Log.Error(ex, "UserViewModel - OnChangeRole"); } }
private void ClientReceiveMessage(object sender, ReceiveMessageEventArgs e) { if (e.Type != MessageType.System && e.Type != MessageType.Private) { return; } Dispatcher.BeginInvoke(new Action <ReceiveMessageEventArgs>(args => { switch (args.Type) { case MessageType.Private: using (var client = ClientModel.Get()) { UserViewModel senderUser = AllUsers.Single(uvm => string.Equals(uvm.Info.Nick, args.Sender)); UserViewModel receiverUser = AllUsers.Single(uvm => string.Equals(uvm.Info.Nick, client.User.Nick)); SelectedRoom.AddPrivateMessage(senderUser, receiverUser, args.Message); } break; case MessageType.System: SelectedRoom.AddSystemMessage(Localizer.Instance.Localize(args.SystemMessage, args.SystemMessageFormat)); break; } Alert(); }), e); }
private void LoadUsers() { string token = Session.Token; var allUsers = VirtualFairIntegration.GetFindAllUsers(token); if (allUsers.countRows != 0) { List <AllUsers> lstUsers = new List <AllUsers>(); foreach (var item in allUsers.users) { AllUsers cmb = new AllUsers(); cmb.id = Convert.ToInt32(item.id); cmb.nameUser = item.fullName.ToString(); cmb.profileUser = item.profile.name.ToString(); lstUsers.Add(cmb); } cmbUsers.DataSource = lstUsers; cmbUsers.ValueMember = "id"; cmbUsers.DisplayMember = "nameUserProfileUser"; //cmbUsers.DisplayMember = String.Concat("country","|", "fullName"); cmbUsers.DropDownStyle = ComboBoxStyle.DropDownList; } }
public User ValidateLogin(LoginViewModel model) { string encryptedPassword = RijndaelHelper.Encrypt(model.Password, cryptographyKey); var user = new User(); //get username with loginname var currentUser = AllUsers.SingleOrDefault(us => us.LoginName == model.LoginName && !us.DelDate.HasValue); if (currentUser != null) { if (currentUser.Password == encryptedPassword) { user = AllUsers.SingleOrDefault(x => x.UserName == currentUser.UserName && x.Password == encryptedPassword); } else { return(null); } } else { return(null); } return(user); }
public IActionResult submitInfo(AllUsers model) { // CHeck if models received any validation errors. if (ModelState.IsValid) { // Check if email already exists in DB. string CheckEmail = $"SELECT email FROM users WHERE email = '{model.Reg.Email}'"; var EmailExists = DbConnector.Query(CheckEmail); if (EmailExists.Count <= 0) { string NowTime = "NOW()"; DbConnector.Execute($"INSERT INTO users (first_name, last_name, email, password, created_at, updated_at) VALUES ('{model.Reg.FirstName}', '{model.Reg.LastName}', '{model.Reg.Email}', '{model.Reg.Password}',{NowTime}, {NowTime}) "); ViewBag.email = ""; return(RedirectToAction("main")); } else if (EmailExists.Count > 0) { ViewBag.email = "There is already a user with that email address. Please try again."; return(View("index")); } else { ViewBag.email = ""; return(View("index")); } } else { ViewBag.email = ""; return(View("index")); } }
private async Task LoadComments() { Comments.Clear(); var result = await _commentService.Get <List <Model.UserCommentPost> >(new UserCommentPostSearchRequest() { PostId = postId }); AllUsers = await _userService.Get <List <Model.UserProfile> >(null); foreach (var item in result) { CommentHelperVM local = new CommentHelperVM() { CommentDate = item.CommentDate, CommentText = item.CommentText, PostId = item.PostId, UserId = item.UserId }; local.CommenterPhoto = AllUsers.Where(a => a.UserId == item.UserId).Select(a => a.UserPhoto).FirstOrDefault(); local.CommenterName = AllUsers.Where(a => a.UserId == item.UserId).Select(a => a.Username).FirstOrDefault(); Comments.Add(local); } Comments.OrderBy(x => x.CommentDate); }
/// <summary> /// Десериализует данные пользователей. /// </summary> public static AllUsers OpenAll() { BinaryFormatter bf = new BinaryFormatter(); AllUsers users; try { using (FileStream fs = new FileStream(@"Data/Users.dat", FileMode.OpenOrCreate)) { if (fs.Length == 0) { users = new AllUsers(); } else { users = (AllUsers)bf.Deserialize(fs); } } return(users); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }
public static List <ValidationMessage> SaveUserDetails( ValidatableParameter <Guid> userId, ValidatableParameter <string> userName, ValidatableParameter <string> displayName ) { List <ValidationMessage> errors = new List <ValidationMessage>(); if (displayName == null || string.IsNullOrEmpty(displayName.Value) || displayName.Value.Trim().Length == 0) { errors.Add(new ValidationMessage { MessageText = "Display Name must be supplied", Source = displayName.Source }); } if (errors.Count == 0) { AllUsers items = new AllUsers(); User existItem = items.Where(i => i.UserId == userId.Value).Single(); existItem.DisplayName = displayName.Value; items.Save(); } return(errors); }
public void ShowStatsFromGivenPlayer(AllUsers allUsers, int givenUserId) { var specificUser = GetSpecificUser(allUsers, givenUserId); Debug.Log("-----------"); GameData mockedGameData; for (int i = 0; i < exampleDataSet.Count; i++) { var gameDataTypeIndex = i; mockedGameData = GetMockedGameDataByIndex(gameDataTypeIndex); var currentGameData = GetCurrentGameData(specificUser, mockedGameData); var barIndex = 0; // 0 = winrate, 1 = games played var winRate = GetWinrate(currentGameData); exampleDataSet[gameDataTypeIndex].ListOfBars[barIndex].YValue = winRate; barIndex = 1; // 0 = winrate, 1 = games played var playedAmount = GetTotalPlayed(currentGameData); exampleDataSet[gameDataTypeIndex].ListOfBars[barIndex].YValue = playedAmount; } if (exampleDataSet.Count == 0) { Debug.LogError("ExampleDataSet is Empty!"); return; } barGraphGenerator.GeneratBarGraph(exampleDataSet); }
protected async void GetJson() { string json = await Api.Helper.GetUsers(); AllUsers = JsonConvert.DeserializeObject <List <User> >(json); AllUsers = AllUsers.OrderBy(x => x.ToString()).ToList(); FilteredUsers = AllUsers; }
/// <summary> /// Constructor with AllUsers param /// </summary> /// <param name="AllUsers">opens the all uers window</param> public AllUsersViewModel(AllUsers usersOpen) { allUsers = usersOpen; AllInfoManagerList = service.GetAllManagersInfo().ToList(); AllInfoEmployeeList = service.GetAllEmployeesInfo().ToList(); ManagerList = service.GetAllManagers().ToList(); EmployeeList = service.GetAllEmployees().ToList(); UserList = service.GetAllUsers().ToList(); }
public static IEnumerable TestCaseForRegistration() { var data = AllUsers.DeserialiseUsers(RegisterUsersPath); foreach (var user in data.Users) { yield return(new TestCaseData(user.Email, user.Password, user.CompanyName, user.Name)); } }
public static IEnumerable TestCaseWithUsers() { var data = AllUsers.DeserialiseUsers(UsersPath); foreach (var user in data.Users) { yield return(new TestCaseData(user.Email, user.Password)); } }
private void submitBtn_Click(object sender, EventArgs e) { AllUsers a = new AllUsers(); AllUsersRepository aRepo = new AllUsersRepository(); a.UserFullName = this.textBox1.Text; a.UserName = textBox2.Text; a.UserType = "Passenger"; a.UserQuestion = textBox10.Text; if (this.textBox5.Text == this.textBox4.Text) { a.UserPassword = this.textBox5.Text; PassengerRepository pRepo = new PassengerRepository(); Passenger p = new Passenger(); int x = pRepo.PassengerCount(); x++; p.PassengerId = x; p.Pname = this.textBox1.Text; p.Pusername = this.textBox2.Text; p.Pemail = this.textBox3.Text; p.Ppassword = this.textBox5.Text; p.Pgender = this.textBox6.Text; p.Page = Convert.ToInt32(this.textBox7.Text); p.Paddress = this.textBox9.Text; p.Pquestion = this.textBox10.Text; if (pRepo.Insert(p) && aRepo.Insert(a)) { MessageBox.Show("New User Added"); } else { MessageBox.Show("New User not Added. \nCould not connect to database", "Insert Error"); } this.textBox1.Text = ""; this.textBox2.Text = ""; this.textBox3.Text = ""; this.textBox4.Text = ""; this.textBox5.Text = ""; this.textBox6.Text = ""; this.textBox7.Text = ""; this.textBox9.Text = ""; this.textBox10.Text = ""; //this.textBox11.Text = ""; } else { wrongPasslabel.Text = "Password Don't match"; this.textBox4.Text = ""; this.textBox5.Text = ""; } }
private void CreateUser() { SelectedUser = new User(); SelectedUser.Username = NewUsername; AllUsers.Add(SelectedUser); SelectedUserNotSaved = true; usekeyfile = false; // HostedServer.settingsrepo.AddUser(new User() { Username = NewUsername }); }
private List <int> GetUserGameIds() { var allGameIds = _allGames.Select(f => f.AppId).Distinct().ToList(); var userGameIds = AllUsers.SelectMany(u => u.Games).Distinct().ToList(); allGameIds = allGameIds.Where(userGameIds.Contains).ToList(); allGameIds.Sort(); return(allGameIds); }
private void PopulateUsers() { AllUsers.Add(PurpleUser); AllUsers.Add(PeachUser); AllUsers.Add(AquaUser); AllUsers.Add(BlueUser); AllUsers.Add(PinkUser); AllUsers.Add(GreenUser); }
public IHttpActionResult GetAllUser() { using (var _context = new TaskManagerContext()) { var potUsers = _context.Users.Include(u => u.Roles).ToList(); var chkRoleuser = _context.Roles.Where(e => e.Name == "User").Select(e => e.Id).FirstOrDefault(); var chkRoleAdmin = _context.Roles.Where(e => e.Name == "Admin").Select(e => e.Id).FirstOrDefault(); AllDetail alldetail = new AllDetail(); List <AllAdmin> alladmin = new List <AllAdmin>(); List <AllUsers> alluser = new List <AllUsers>(); foreach (var user in potUsers) { foreach (var role in user.Roles) { if (role.RoleId == chkRoleAdmin) { AllAdmin admin = new AllAdmin(); admin.Email = user.Email; admin.FirstName = user.FirstName; admin.LastName = user.LastName; admin.Organization = user.Organization; alladmin.Add(admin); } if (role.RoleId == chkRoleuser) { AllUsers users = new AllUsers(); users.Email = user.Email; users.FirstName = user.FirstName; users.LastName = user.LastName; users.Organization = user.Organization; users.Task = _context.UserTask.Where(e => e.Email == user.Email).Select(e => new TaskDetail() { Description = e.Description, Name = e.Name, Status = e.Status }).ToList(); alluser.Add(users); } } } alldetail.Admins = alladmin; alldetail.Users = alluser; if (alldetail != null) { return(Ok(new APIResponse() { Message = "User Details has been retrieved successfully.", Data = alldetail })); } else { return(NotFound()); //No Data Found } } }
public UserDetailViewModel(TeamFoundationIdentity identity, IServiceProvider serviceProvider) : base(serviceProvider) { this.identity = identity; FillModelData(); if (this.identity != null && !AllUsers.Contains(this.identity)) { this.identity = AllUsers.FirstOrDefault(i => i.TeamFoundationId == this.identity.TeamFoundationId) ?? identity; } }
private TestUser GenerateRandomUser() { var userName = "******" + UserCount++; var user = new TestUser { Id = userName, Password = GenerateRandomPassword(userName), Groups = new HashSet <string>(), Permissions = new Permission() }; AllUsers.Add(user); return(user); }
IEnumerator<IResult> GetAllUsers() { yield return Show.Busy(); var allUsers = new AllUsers().AsQuery(); yield return allUsers; Users = allUsers.Response; yield return Show.NotBusy(); }