Beispiel #1
0
        public static SequentNoCollection Search(SearchFilter value)
        {
            SequentNoCollection items = new SequentNoCollection();
            string key = string.Format(SETTINGS_Search_KEY, value.CompanyID + value.Keyword + value.Page + value.PageSize + value.OrderBy + value.OrderDirection);

            if (SystemConfig.AllowSearchCache)
            {
                object obj2 = HttpCache.Get(key);

                if ((obj2 != null))
                {
                    return((SequentNoCollection)obj2);
                }
            }

            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <SequentNoCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
Beispiel #2
0
        public static SequentNoCollection GetAll(int CompanyID)
        {
            SequentNoCollection items = new SequentNoCollection();
            string key  = String.Format(SETTINGS_ALL_KEY, CompanyID);
            object obj2 = HttpCache.Get(key);

            if ((obj2 != null))
            {
                return((SequentNoCollection)obj2);
            }
            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.GetAsync(string.Format(Resource + "?CompanyID={0}", CompanyID)).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <SequentNoCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }