protected void Page_Load(object sender, EventArgs e) { var users = Membership.GetAllUsers(); UsersRepeater.DataSource = users; UsersRepeater.DataBind(); }
protected void FilterUsers(object sender, EventArgs e) { var users = GetClients().Where(x => x.UserName.Contains(TextBoxFilter.Text)) .Select(u => new { Username = u.UserName, Id = u.Id, Email = u.Email, TotalBalance = u.Accounts.Sum(a => a.Balance) }) .ToList(); UsersRepeater.DataSource = users; UsersRepeater.DataBind(); }
/// <summary> /// on page load the function getusers that is located in usercontroller will be called and data will be bind to the repeater(UserRepeater) of the table in /// frontend /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserController userController = new UserController(); UsersRepeater.DataSource = userController.getUsers(); UsersRepeater.DataBind(); } }
/// <summary> /// In case a user tried logging in more the 4 times and failed in the 4 attempts his account gets locked /// here the admin has the authority to unlock an account by pressing unlock button and sending the Id of locked user to Usercontroller to execute the UnlockAccount func by resseting the /// islocked boolean in sql table to 0 which means unlocked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Unlock_Click(object sender, EventArgs e) { LinkButton dltbtn = (LinkButton)sender; int UserId = int.Parse(dltbtn.CommandArgument); UserController us1 = new UserController(); us1.UnlockAccount(UserId); UsersRepeater.DataSource = us1.getUsers(); UsersRepeater.DataBind(); }
/// <summary> /// on click of the delete icon on frontend the parameter ID will be sent using command argument to User Controller to execute the Deleteuser function /// the next step is reloading the updated table of users after the deleting action /// using the getusers func in UserControllers and binding the updated data to the Repeater in front end /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { LinkButton dltbtn = (LinkButton)sender; int UserId = int.Parse(dltbtn.CommandArgument); UserController us = new UserController(); us.deleteuser(UserId); UsersRepeater.DataSource = us.getUsers(); UsersRepeater.DataBind(); }
protected void UsersRepeater_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "LockUser") { User user = users[e.Item.ItemIndex]; MADUsers.SetUserLockStatus(user.UserID, !user.IsLocked); users = MADUsers.GetAllUsers(); UsersRepeater.DataSource = users; UsersRepeater.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <MetaTable> _Basetables = Abyari.AppStart.DynamicDataConfig.DefualtModel.VisibleTables.Where(x => x.Scaffold == true).ToList(); BaseRepeater.DataSource = _Basetables; BaseRepeater.DataBind(); if (global::AccessManagementService.Access.AccessControl.IsValidAccessToRight("مجوز مدیریت کاربر")) { UsersRepeater.DataSource = global:: AccessManagementService.AppStart.DynamicDataConfig.AccessManagementModel.VisibleTables.Where(x => x.Scaffold == true).ToList <MetaTable>(); UsersRepeater.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserID"] == null) { Response.Redirect("HomePage.aspx", true); } if (!IsPostBack) { Session["ShownUsers"] = null; } List <Profession> profList = Profession.GetProfessionList(); DropDownProfFilter.DataTextField = "ProfName"; DropDownProfFilter.DataValueField = "ProfessionID"; DropDownProfFilter.DataSource = profList; int this_year = DateTime.Now.Year; DropDownAgeFilter.DataSource = Enumerable.Range(1, this_year - 1940).ToList(); DropDownLanguageFilter.DataSource = GeneralMethods.GetLang(); DropDownLanguageFilter.DataTextField = "Value"; DropDownLanguageFilter.DataValueField = "Key"; DropDownWeeklyHoursFilter.DataSource = Enumerable.Range(1, 50).ToList(); List <UserInfo> users = ReturnUsersDefaultList(0); UsersRepeater.DataSource = users; UsersRepeater.DataBind(); if (!Page.IsPostBack) { if (UsersRepeater.HasControls()) { Label LastUserID = (Label)UsersRepeater.Controls[UsersRepeater.Items.Count - 1].FindControl("UserID"); if (LastUserID != null) { ShownUserIndex.Value = LastUserID.Text; } } DropDownProfFilter.DataBind(); DropDownProfFilter.Items.Insert(0, new ListItem("none", "-1")); DropDownAgeFilter.DataBind(); DropDownAgeFilter.Items.Insert(0, new ListItem("none", "-1")); DropDownLanguageFilter.DataBind(); DropDownLanguageFilter.Items.Insert(0, new ListItem("none", "-1")); DropDownWeeklyHoursFilter.DataBind(); DropDownWeeklyHoursFilter.Items.Insert(0, new ListItem("none", "0")); } }
protected void Page_Load(object sender, EventArgs e) { if (!User.IsInRole("Admin")) { Response.Redirect("/"); } var userId = User.Identity.GetUserId(); var data = new AccountSystemData(new AccountSystemDbContext()); adminRoleId = data.Roles.All().FirstOrDefault(r => r.Name == "Admin").Id; var users = this.GetClients() .Select(u => new { Username = u.UserName, Id = u.Id, Email = u.Email, TotalBalance = u.Accounts.Sum(a => a.Balance) }) .ToList(); UsersRepeater.DataSource = users; UsersRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var users = new List <User> { new User { Name = "Luke Skywalker", Email = "*****@*****.**", Group = "Admin" }, new User { Name = "Han Solo", Email = "*****@*****.**", Group = "Advisor" }, new User { Name = "Leia Organa", Email = "*****@*****.**", Group = "User" }, }; UsersRepeater.DataSource = users; UsersRepeater.DataBind(); } }
protected void SearchProject_Click(object sender, EventArgs e) { if (LoadMoreProjB.Visible == false) { LoadMoreProjB.Visible = true; } Session["ShownUsers"] = null; List <UserInfo> UsersShowcase; ShownUserIndex.Value = "0"; if (DropDownFiltered.SelectedValue == "1") { UsersShowcase = ReturnUsersDefaultList(0); } else { int langFilter = int.Parse(DropDownLanguageFilter.SelectedValue); int profFilter = int.Parse(DropDownProfFilter.SelectedValue); int AgeFilter = int.Parse(DropDownAgeFilter.SelectedValue); int RateFilter = int.Parse(DropDownRateFilter.SelectedValue); int weeklyHours = int.Parse(DropDownWeeklyHoursFilter.SelectedValue); DateTime userChosen; if (AgeFilter == -1) { userChosen = DateTime.Now; } else { int years = 365 * AgeFilter; TimeSpan t = new TimeSpan(years, 0, 0, 0); userChosen = DateTime.Now - t; } UsersShowcase = null; // remove later ************ !!!!!!!!!! and replace with the one below UsersShowcase = UserInfo.ShowUsers(profFilter, userChosen, langFilter, weeklyHours, RateFilter, int.Parse(ShownUserIndex.Value)); } List <UserInfo> sessionUsers; //if (session["ShownUsers"] UsersShowcase != null) //{ // sessionUsers = (List<UserInfo>)Session["ShownUsers"]; // sessionUsers.AddRange(UsersShowcase); //} //else //{ Session["ShownUsers"] = UsersShowcase; //} sessionUsers = (List <UserInfo>)Session["ShownUsers"]; UsersRepeater.DataSource = sessionUsers; UsersRepeater.DataBind(); if (UsersShowcase.Count != 0) { Label LastProjID = (Label)UsersRepeater.Controls[UsersRepeater.Items.Count - 1].FindControl("UserID"); if (LastProjID != null) { ShownUserIndex.Value = LastProjID.Text; } } if (UsersShowcase.Count < 3) { LoadMoreProjB.Visible = false; } }
protected void LoadMore_Click(object sender, EventArgs e) { Repeater updateReapeter = new Repeater(); updateReapeter.ItemTemplate = UsersRepeater.ItemTemplate; updateReapeter.ItemDataBound += new RepeaterItemEventHandler(UsersRepeater_OnItemDataBound); if (DropDownFiltered.SelectedValue == "1") { DateTime datetime = DateTime.Now; List <UserInfo> UsersShowcase = ReturnUsersDefaultList(int.Parse(ShownUserIndex.Value)); List <UserInfo> sessionUsers; if (Session["ShownUsers"] != null) { sessionUsers = (List <UserInfo>)Session["ShownUsers"]; sessionUsers.AddRange(UsersShowcase); } else { Session["ShownUsers"] = UsersShowcase; } sessionUsers = (List <UserInfo>)Session["ShownUsers"]; updateReapeter.DataSource = sessionUsers; updateReapeter.DataBind(); if (UsersShowcase.Count != 0) { Label LastProjID = (Label)updateReapeter.Controls[updateReapeter.Items.Count - 1].FindControl("UserID"); if (LastProjID != null) { ShownUserIndex.Value = LastProjID.Text; } } MergeRepeaters(UsersRepeater, updateReapeter); if (UsersShowcase.Count < 3) { LoadMoreProjB.Visible = false; } } else { int langFilter = int.Parse(DropDownLanguageFilter.SelectedValue); int profFilter = int.Parse(DropDownProfFilter.SelectedValue); int AgeFilter = int.Parse(DropDownAgeFilter.SelectedValue); int RateFilter = int.Parse(DropDownRateFilter.SelectedValue); int weeklyHours = int.Parse(DropDownWeeklyHoursFilter.SelectedValue); DateTime userChosen; if (AgeFilter == -1) { userChosen = DateTime.Now; } else { int years = 365 * AgeFilter; TimeSpan t = new TimeSpan(years, 0, 0, 0); userChosen = DateTime.Now - t; } List <UserInfo> UsersShowcase = UserInfo.ShowUsers(profFilter, userChosen, langFilter, weeklyHours, RateFilter, int.Parse(ShownUserIndex.Value)); List <UserInfo> sessionUsers; if (Session["ShownUsers"] != null) { sessionUsers = (List <UserInfo>)Session["ShownUsers"]; sessionUsers.AddRange(UsersShowcase); } else { Session["ShownUsers"] = UsersShowcase; } sessionUsers = (List <UserInfo>)Session["ShownUsers"]; updateReapeter.DataSource = (List <UserInfo>)Session["ShownUsers"]; updateReapeter.DataBind(); if (UsersShowcase.Count < 3) { LoadMoreProjB.Visible = false; } if (UsersShowcase.Count != 0) { Label LastProjID = (Label)updateReapeter.Controls[updateReapeter.Items.Count - 1].FindControl("UserID"); if (LastProjID != null) { ShownUserIndex.Value = LastProjID.Text; } } UsersRepeater.DataSource = null; UsersRepeater.DataBind(); MergeRepeaters(UsersRepeater, updateReapeter); } }
protected override void OnInit(EventArgs e) { users = MADUsers.GetAllUsers(); UsersRepeater.DataSource = users; UsersRepeater.DataBind(); }