public override oluUserInfo CreateMember(string IdentityName) { string nick = string.Format(IdentityName); oluUserInfo ui = new UserExtend(IdentityName, nick, false, null); return ui; //DemoPassportUser ppUser = DemoPassportProvider.Instance.GetUser(IdentityName); //return new oluUserInfoExtend(IdentityName, ppUser.ScreenName, false, ppUser); }
public override oluUserInfo CreateGuest() { oluUserInfo ui = new UserExtend("Guest", "路人甲", true, null); return ui; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string strPageSize = context.Request.QueryString["pageSize"].ToString(); string strCurrentPage = context.Request.QueryString["currentPage"].ToString(); string strGender = context.Request.QueryString["gender"].ToString(); string strUnit = context.Request.QueryString["unit"].ToString(); string strUserType = context.Request.QueryString["usertype"].ToString(); int pageSize =0,currentPage=0,gender=0,usertype=0,j=0; if(!int.TryParse(strPageSize,out pageSize) || !int.TryParse(strCurrentPage,out currentPage) || currentPage<1 || pageSize<1 || !int.TryParse(strGender, out gender) || !int.TryParse(strUserType,out usertype)) { context.Response.Write("{success:false,msg:'参数错误'}"); } try { ArrayList al = oluMonitor.GetAllUsers(); List<UserExtend> oluList = new List<UserExtend>(); for (int i = 0; i < al.Count; i++) { oluUserInfo o = al[i] as oluUserInfo; CY.CSTS.Core.Business.User user = CY.CSTS.Core.Business.User.GetUserByUserId(o.Username); if (user == null) { continue; } if (gender != 0 && getGenderId(user.Gender) != gender) { continue; } else if (strUnit != "0" && strUnit != user.UnitID.ToString()) { continue; } else if (usertype != 0 && usertype != user.UserType) { continue; } if (j >= pageSize * (currentPage - 1) && j <= pageSize * currentPage - 1) { UserExtend ue = new UserExtend("test", "test", false, ""); ue = al[i] as UserExtend; if (ue == null) { continue; } ue.PicUrl = user.PicURL; ue.UserGender = user.Gender; ue.UserTypeName = GetUserTypeName(user.UserType); ue.UserId = user.Id; ue.Unit = user.UnitInfo.UnitName; oluList.Add(ue); } j++; } StringBuilder sb = new StringBuilder(); sb.Append("{success:true,list:["); foreach (UserExtend ue in oluList) { sb.Append("{"); sb.Append("UserName:'******',"); sb.Append("EncodeName:'" + System.Web.HttpUtility.UrlEncode(ue.Username) + "',"); sb.Append("UserTypeName:'" + ue.UserTypeName+ "',"); sb.Append("PicUrl:'" + ue.PicUrl + "',"); sb.Append("Gender:'" + ue.UserGender + "',"); sb.Append("Unit:'" + ue.Unit + "'"); sb.Append("},"); } if(oluList.Count!=0) sb.Remove(sb.Length - 1, 1); sb.Append("],UserCount:'" + j + "'}"); context.Response.Write(sb.ToString()); } catch(Exception ex) { context.Response.Write("{success:false,msg:'" + ex.Message + "'}"); } }