static string getLoaderParam(this string url, XyhUserLoaderParam param) { if (param == null) { return(url); } StringBuilder p = new StringBuilder(); if (param.withUserRoleDetail) { p.Append(@"&withUserRoleDetail=true"); } if (param.withCard) { p.Append(@"&withCard=true"); } if (param.withContacts) { p.Append(@"&withContacts=true"); } if (param.withOrgExtInfo) { p.Append(@"&withOrgExtInfo=true"); } return(url + p.ToString()); }
/// <summary> /// suguo.yao 2016-11-29 /// 获取多个用户基本信息 /// </summary> public static List <XyhUser> list(string orgid, string userids, XyhUserLoaderParam param = null) { string url = string.Format(@"{0}/user/list?orgid={1}&userids={2}&oauth_token={3} ", appConfig.url, orgid, userids, getToken()); var content = getHttpContent(url.getLoaderParam(param)).Result; var JResult = JsonConvert.DeserializeObject <Result <XyhUser> >(content); if (JResult.code == 0) { return(JResult.rs); } else { return(null); } }
/// <summary> /// suguo.yao 2016-11-29 /// 分页形式获取机构下的全部用户信息 /// </summary> public static DataPage <XyhUser> all(int page, int pagesize, string orgid, string usertype = "", XyhUserLoaderParam param = null) { string url = string.Format(@"{0}/orguser/all?orgid={1}&oauth_token={2}&page={3}&pagesize={4}", appConfig.url, orgid, getToken(), page, pagesize); if (!string.IsNullOrEmpty(usertype)) { url += string.Format("&usertype={0}", usertype); } var content = getHttpContent(url.getLoaderParam(param)).Result; var JResult = JsonConvert.DeserializeObject <Result <DataPage <XyhUser> > >(content); if (JResult.code == 0) { return(JResult.r); } else { return(null); } }
/// <summary> /// suguo.yao 2016-11-29 /// 获取部门及其部门内的人员信息 /// </summary> public static List <XyhOrgnization> deptWithUsers(string orgid, List <string> deptids, XyhUserLoaderParam param = null) { string url = string.Format(@"{0}/orguser/map?orgid={1}&deptids={2}&oauth_token={3} ", appConfig.url, orgid, deptids, getToken()); var content = getHttpContent(url.getLoaderParam(param)).Result; var JResult = JsonConvert.DeserializeObject <Result <XyhOrgnization> >(content); if (JResult.code == 0) { return(JResult.rs); } else { return(null); } }
/// <summary> /// suguo.yao 2016-11-29 /// 分页形式获取机构内的用户信息 /// </summary> public static DataPage <XyhUser> deptUsers(int page, int pagesize, string orgid, List <string> deptids, XyhUserLoaderParam param = null) { string url = string.Format(@"{0}/orguser/page?orgid={1}&deptids={2}&oauth_token={3}&page={4}&pagesize={5}", appConfig.url, orgid, deptids, getToken(), page, pagesize); var content = getHttpContent(url.getLoaderParam(param)).Result; var JResult = JsonConvert.DeserializeObject <Result <DataPage <XyhUser> > >(content); if (JResult.code == 0) { return(JResult.r); } else { return(null); } }