private void BindUser() { if (Application["online"] == null) { bl_top.InnerHtml = "IM"; } else { hidSender.Value = StringHelper.DesDecrypt(Request.Params["login"]); Users users = new Users(); DataTable userTree = users.GetUserTree(); UserGroup userGroup = new UserGroup(); DataTable groupList = userGroup.GetUserGroup(hidSender.Value); DataRow[] userRow = userTree.Select( string.Format("id = '{0}'", hidSender.Value) ); if (userRow.Length == 0) { hidCnSender.Attributes["outter"] = "1"; changepassword.Attributes["outter"] = "1"; hidCnSender.Value = StringHelper.DesDecrypt(Request.Params["userName"]); hidCnSender.Attributes["lname"] = StringHelper.DesDecrypt(Request.Params["loginName"]); } else { if (userRow[0]["theme"].ToString().Length > 0) { theme = userRow[0]["theme"].ToString(); } hidCnSender.Value = userRow[0]["username"].ToString(); hidrevertMessage.Value = userRow[0]["revertMessage"].ToString(); hidCnSender.Attributes["lname"] = userRow[0]["loginname"].ToString(); hidCnSender.Attributes["outter"] = userRow[0]["isoutter"].ToString(); changepassword.Attributes["outter"] = userRow[0]["isoutter"].ToString(); } GroupRelation groupRelation = new GroupRelation(); DataTable relationList = groupRelation.GetGroupRelation(hidSender.Value); userTreeBuilder = new StringBuilder(); OnLineUser onLineUser = new OnLineUser(); foreach (DataRow group in groupList.Rows) { bool flag = false; if (group["groupname"].ToString().Equals(Profile.unknowGroup)) { flag = true; hidSender.Attributes["unknow"] = group["id"].ToString(); } CreateGroupTop(group["id"].ToString(), group["groupname"].ToString(), true, flag); DataRow[] relationshiperList = relationList.Select( string.Format("usergroup = '{0}'", group["id"]) ); userTreeBuilder.AppendFormat( "<ul class=\"group\" id=\"ul{0}Group\" groupid=\"{0}\" style=\"display : none;\">", group["id"] ); foreach (DataRow relationshiper in relationshiperList) { DataRow[] user = userTree.Select( string.Format("id = '{0}'", relationshiper["relationshiper"]), "username" ); if (user.Length == 1) { int userStatus = onLineUser.GetUserStatus(user[0]["id"].ToString(), Application["online"]); CreateBuddyList( user[0]["id"].ToString(), user[0]["username"].ToString(), user[0]["scratch"].ToString(), user[0]["headImg"].ToString(), userStatus, true ); } } userTreeBuilder.Append("</ul>"); } //����Ԥ�����Լ����� CreateGroupTop("owner", Profile.ownerGroup, true, true); userTreeBuilder.Append("<ul class=\"group\" id=\"ulownerGroup\" groupid=\"owner\" style=\"display : none;\">"); int status = onLineUser.GetUserStatus(hidSender.Value, Application["online"]); statusSettings.Attributes["userstatus"] = status.ToString(); CreateBuddyList( hidSender.Value, hidCnSender.Value, (userRow.Length > 0 ? userRow[0]["scratch"].ToString() : string.Empty), (userRow.Length > 0 ? userRow[0]["headImg"].ToString() : string.Empty), status, false ); userTreeBuilder.Append("</ul>"); buddylist.InnerHtml = userTreeBuilder.ToString(); } if (hidCnSender.Attributes["outter"].Equals("1")) { imgLogout.Attributes["style"] += "display: none;"; changepassword.Attributes["style"] = "display:none"; } hidSender.Attributes["theme"] = theme; bl_top.InnerHtml = string.Format("IM {0}", hidCnSender.Value); hidSender.Attributes["current"] = DateTime.Now.ToString("yyyy-MM-dd"); imgLogout.Src = string.Format("../include/themes/{0}/window/signoff.png", theme); joinroom.Src = string.Format("../include/themes/{0}/window/joinroom.png", theme); addbuddy.Src = string.Format("../include/themes/{0}/window/addbuddy.png", theme); changepassword.Src = string.Format("../include/themes/{0}/window/changepassword.png", theme); }