//管理员角色绑定 private void AdminRoleBind(int AdminID) { AdminInfoBLL _AdminInfoBLL = new AdminInfoBLL(); bool IsSys = _AdminInfoBLL.IsSys(AdminID); if (IsSys) { this.DropDownRole.Items.Clear(); ListItem item = new ListItem("系统管理员"); this.DropDownRole.Items.Add(item); this.DropDownRole.Enabled = false; } else { //与角色表中的数据绑定 RoleBLL _RoleBLL = new RoleBLL(); DataTable DT = _RoleBLL.GetAllRoleInfo(); DropDownRole.Items.Clear(); DropDownRole.DataSource = DT; DropDownRole.DataTextField = "RoleName"; DropDownRole.DataValueField = "RoleID"; DropDownRole.DataBind(); //获得当前编辑对象的管理角色个数 AdminRoleBLL _AdminRoleBLL = new AdminRoleBLL(); int AdminRoleCount = _AdminRoleBLL.GetCountByAdminID(AdminID); if (AdminRoleCount > 0) { int RoleID = _RoleBLL.GetRoleIDByAdminID(AdminID); DropDownRole.SelectedValue = RoleID.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var branch = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IBranchDb>().RetrieveAll(); BranchDropDown.DataSource = branch; BranchDropDown.DataBind(); DropDownRole.DataSource = Enum.GetNames(typeof(Role)); DropDownRole.DataBind(); if (!string.IsNullOrWhiteSpace(Request.QueryString["id"])) { int id = Convert.ToInt32(Request.QueryString["id"]); User user = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IUserDb>().RetrieveById(id); TextBoxNameFName.Value = user.FirstName; TextBoxNameLName.Value = user.LastName; TextBoxNameONames.Value = user.OtherNames; TextBoxNameEmail.Value = user.Email; TextBoxNamePhone.Value = user.PhoneNumber; TextBoxNameUName.Value = user.UserName; DropDownRole.SelectedValue = user.UserRole.ToString(); BranchDropDown.SelectedValue = user.Branch.Id.ToString(); TextBoxId.Value = user.Id.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownRole.DataSource = Enum.GetNames(typeof(Role)); DropDownRole.DataBind(); } }
private void RoleBind() { RoleBLL _RoleBLL = new RoleBLL(); DataTable DT = _RoleBLL.GetAllRoleInfo(); DropDownRole.Items.Clear(); DropDownRole.DataSource = DT; DropDownRole.DataTextField = "RoleName"; DropDownRole.DataValueField = "RoleID"; DropDownRole.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { IList <Hospital> hospital = HospitalDAO.RetrieveAll().Where(x => !string.IsNullOrWhiteSpace(x.Name) && !x.Name.Equals("SuperAdminHospital")).ToList(); DropDownHospital.DataSource = hospital; DropDownHospital.DataValueField = "Id"; DropDownHospital.DataTextField = "Name"; DropDownHospital.DataBind(); DropDownRole.DataSource = Enum.GetNames(typeof(UserRole)); DropDownRole.DataBind(); } }