/// <summary> /// 获分页列表 /// </summary> /// <param name="loginInfo"></param> /// <returns></returns> public PageResponse <PdProject> GetPageList(PageModel page, string keywords = "") { PageResponse <PdProject> menus = new PageResponse <PdProject>(); try { RequestBase request = new RequestBase(); request.SetValue("PageIndex", page.PageIndex); request.SetValue("PageSize", page.PageSize); request.SetValue("keywords", keywords); request.Url = GetPageUrl; string result = HttpHelper.Example.GetWebData(new BrowserPara() { Uri = request.GetReqUrl(), Method = RequestTypeEnums.GET }); JsonResponses responses = JsonConvert.DeserializeObject <JsonResponses>(result); if (responses.code == JsonResponses.SuccessCode) { object data = responses.data; menus = JsonConvert.DeserializeObject <PageResponse <PdProject> >(JsonConvert.SerializeObject(data)); return(menus); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(menus); }
/// <summary> /// 根据主键ID获取信息 /// </summary> /// <returns></returns> public JsonResponses GetInfo(int id) { try { RequestBase request = new RequestBase(); request.SetValue("id", id.ToString()); request.Url = GetInfoUrl; string result = HttpHelper.Example.GetWebData(new BrowserPara() { Uri = request.GetReqUrl(), PostData = request.GetRequestData(), Method = RequestTypeEnums.GET }); JsonResponses responses = JsonConvert.DeserializeObject <JsonResponses>(result); if (responses.code == JsonResponses.SuccessCode) { object data = responses.data; responses.data = JsonConvert.DeserializeObject <PdProject>(JsonConvert.SerializeObject(data)); } return(responses); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(JsonResponses.Failed); }
/// <summary> /// 根据主键ID获取信息 /// </summary> /// <returns></returns> public UcUsersSetting GetUserSettingInfo(string UserNo) { try { RequestBase request = new RequestBase(); request.SetValue("UserNo", UserNo); request.Url = GetUserSettingInfoUrl; string result = HttpHelper.Example.GetWebData(new BrowserPara() { Uri = request.GetReqUrl(), Method = RequestTypeEnums.GET }); JsonResponses responses = JsonConvert.DeserializeObject <JsonResponses>(result); if (responses.code == JsonResponses.SuccessCode) { object data = responses.data; return(JsonConvert.DeserializeObject <UcUsersSetting>(JsonConvert.SerializeObject(data))); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(null); }
/// <summary> /// 获取用户权限值 /// </summary> /// <param name="MenuNo"></param> /// <returns></returns> public List <ManagementOptionValue> GetUserManagementList(string UserNo) { List <ManagementOptionValue> managements = new List <ManagementOptionValue>(); try { RequestBase request = new RequestBase { Url = GetUserManagementListUrl }; request.SetValue("UserNo", UserNo); string result = HttpHelper.Example.GetWebData(new BrowserPara() { Uri = request.GetReqUrl(), PostData = request.GetRequestData(), Method = RequestTypeEnums.GET }); JsonResponses responses = JsonConvert.DeserializeObject <JsonResponses>(result); if (responses.code == JsonResponses.SuccessCode) { object data = responses.data; return(JsonConvert.DeserializeObject <List <ManagementOptionValue> >(JsonConvert.SerializeObject(data))); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(managements); }
/// <summary> /// 获取权限树 /// </summary> /// <param name="loginInfo"></param> /// <returns></returns> public List <TreeNodeInfo> GetOrganizationTreeList(long PlatformNo) { List <TreeNodeInfo> menus = new List <TreeNodeInfo>(); try { RequestBase request = new RequestBase { Url = GetOrganizationTreeListUrl }; request.SetValue("PlatformNo", PlatformNo); string result = HttpHelper.Example.GetWebData(new BrowserPara() { Uri = request.GetReqUrl(), Method = RequestTypeEnums.GET }); JsonResponses responses = JsonConvert.DeserializeObject <JsonResponses>(result); if (responses.code == JsonResponses.SuccessCode) { object data = responses.data; return(JsonConvert.DeserializeObject <List <TreeNodeInfo> >(JsonConvert.SerializeObject(data))); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(menus); }
/// <summary> /// 请求方法 /// </summary> /// <param name="bPara">设置请求参数</param> /// <returns></returns> public string GetWebData(RequestBase request) { try { BrowserPara bPara = new BrowserPara(); switch (request.contentType) { case ContentTypeEnums.POSTDATA: var boundary = "---------------" + DateTime.Now.Ticks.ToString("x"); bPara.ContentType = ContentTypeEnums.POSTDATA.GetEnumDescription() + ";boundary = " + boundary; break; default: bPara.ContentType = request.contentType.GetEnumDescription(); break; } InitializeSessionToken(request); bPara.Headers = request.HeaderValue; if (request.contentType == ContentTypeEnums.GETFORM) { bPara.Uri = request.GetReqUrl(); bPara.Method = HttpMethod.Get.Method.ToString(); return(webUtils.DoGet(bPara)); } bPara.Uri = request.Url; bPara.PostData = request.GetRequestData(); bPara.Method = HttpMethod.Post.Method.ToString(); return(webUtils.DoPost(bPara)); } catch (Exception ex) { JsonResponses responses = new JsonResponses(JsonResponses.Failed.code, ex.Message); return(JsonConvert.SerializeObject(responses)); } }