private void InitPage() { //账号状态 ControlHelper.ListContolDataBindFromEnum(rbtAccountStatus, typeof(ShareEnum.AccountStatus), "", "", ShareEnum.AccountStatus.Normal.ToString("d")); rbtAccountStatus.Items.Remove(rbtAccountStatus.Items.FindByValue(ShareEnum.AccountStatus.Del.ToString("d"))); //账号Id hidAccountId.Value = PageAccountId.ToString(); string strRoleIds = string.Empty; hidCompanyCode.Value = CompanyCode.ToString(); if (PageAccountId > 0)//修改页面 { USER_SHARE_ACCOUNTMODEL accountModel = AccountBusiness.GetAccountModel(PageAccountId); if (accountModel != null) { txtAccountName.Text = accountModel.ACCOUNTNAME; txtRealName.Text = accountModel.REALNAME; txtPwd.Attributes["value"] = accountModel.ORIGNALPWD; txtPwd2.Attributes["value"] = accountModel.ORIGNALPWD; txtLinkPhone.Text = CommonMethod.FinalString(accountModel.LINKPHONE); hidEmail.Value = CommonMethod.FinalString(accountModel.EMAIL); hidCompanyCode.Value = accountModel.COMPANYID.ToString(); ControlHelper.SelectFlg(rbtAccountStatus, accountModel.STATUS.ToString()); strRoleIds = CommonMethod.FinalString(accountModel.ROLEIDS); } else { Response.Write("不存在的账号信息!"); Response.End(); } } #region 角色 if (!IsInit) { DataTable dtProjects = CompanyBusiness.GetCompanyProjects(CompanyCode.ToString()); DataTable dtRoles = RoleBusiness.GetAccountRoleList(" AND R.COMPANYID=" + CompanyId); if (dtProjects != null && dtProjects.Rows.Count > 0 && dtRoles != null) { StringBuilder sbContent = new StringBuilder(""); foreach (DataRow dr in dtProjects.Rows) { sbContent.Append("<table class=\"table\" style=\"float:left; width:33%; margin-left:3px;\">"); sbContent.AppendFormat("<tr><td class='rhead' style=\"text-align:left;background-image: url('../../Resource/images/searchthead.gif');\" >{0}</td></tr>", dr["ProjectName"]); DataRow[] drRoles = dtRoles.Select("PROJECTID=" + dr["PROJECTID"], " ROLEID ASC "); foreach (DataRow drRole in drRoles) { sbContent.AppendFormat("<tr><td><input type='checkbox' name='role' id='{0}' value='{0}' {2} />{1}</td></tr>", drRole["ROLEID"], drRole["ROLENAME"], strRoleIds.IndexOf("," + drRole["ROLEID"] + ",") >= 0 ? "checked='checked'" : ""); } sbContent.Append("</table>"); } tdRoles.InnerHtml = sbContent.ToString(); } } else { trRoles.Visible = false; hidCompanyCode.Value = Enc.Decrypt(CommonMethod.FinalString(Request.QueryString["code"]), UrlEncKey); } #endregion }