protected void DropDownListUsers_SelectedIndexChanged(object sender, EventArgs e) { string guid = this.DropDownListUsers.SelectedValue; if (!string.IsNullOrEmpty(guid)) { this.LabelMessage.Text = string.Empty; UserBusiness business = new UserBusiness(); User currentUser = business.QueryByGuid(guid); if (currentUser != null) { this.TextBoxName.Text = currentUser.Name; this.TextBoxAccount.Text = currentUser.Account; this.TextBoxPassword.Attributes["value"] = currentUser.Password; this.TextBoxRepassword.Attributes["value"] = currentUser.Password; business.Refresh(currentUser); this.CheckBoxListRooms.ClearSelection(); if (currentUser.Rooms != null) { for (int i = 0; i < currentUser.Rooms.Count; i++) { for (int j = 0; j < this.CheckBoxListRooms.Items.Count; j++) { if (string.Equals(currentUser.Rooms[i].Guid, this.CheckBoxListRooms.Items[j].Value, StringComparison.CurrentCulture)) { this.CheckBoxListRooms.Items[j].Selected = true; break; } } } } this.CheckBoxListModules.ClearSelection(); if (currentUser.UserModules != null) { for (int i = 0; i < currentUser.UserModules.Count; i++) { for (int j = 0; j < this.CheckBoxListModules.Items.Count; j++) { if (string.Equals(currentUser.UserModules[i].ModuleCode, this.CheckBoxListModules.Items[j].Value, StringComparison.CurrentCulture)) { this.CheckBoxListModules.Items[j].Selected = true; break; } } } } } } }
public void RefreshUser() { User sessionUser = this.Session[Constant.SESSION_KEY_USER] as User; if (sessionUser != null) { if ((sessionUser.Authentication) || (sessionUser.Prerogative)) { UserBusiness business = new UserBusiness(); business.Refresh(sessionUser); this.Session[Constant.SESSION_KEY_USER] = sessionUser; } } }