示例#1
0
文件: Cql.cs 项目: yarivat/Admin
        private Dictionary <string, object> GetInner(string name, int page, int pageSize, string filter, string sort)
        {
            CqlConfig   cqlConfig = GetCqlConfig();
            RestClient  client    = new RestClient(cqlConfig.ApiUrl + GetCql(cqlConfig, name, page, pageSize, filter, sort));
            RestRequest request   = new RestRequest(Method.GET);

            request.AddHeader("Authorization", cqlConfig.AuthorizationHeader);
            var response = client.Execute(request);

            if (response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                throw new CqlException(response.ErrorMessage ?? response.Content, response.ErrorException);
            }
            try
            {
                JavaScriptSerializer jss = new JavaScriptSerializer();
                var result = (Dictionary <string, object>)jss.Deserialize <dynamic>(response.Content);
                return(result);
            }
            catch
            {
                throw new CqlException(response.Content);
            }
        }
示例#2
0
文件: Cql.cs 项目: yarivat/Admin
 private string GetCql(CqlConfig cqlConfig, string name, int page, int pageSize, string filter, string sort)
 {
     return(System.Web.HttpContext.Current.Server.UrlEncode(string.Format(cqlConfig.Cqls[name], Maps.Instance.GetMap().AppName, filter, sort, pageSize)));
 }