示例#1
0
        public virtual IEnumerable <DNHRoleSitemap> SearchData(SearchFilter value)
        {
            DNHRoleSitemapCollection items = new DNHRoleSitemapCollection();
            string key = string.Format(SETTINGS_Search_KEY, value.CompanyID, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition);

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

                if ((obj2 != null))
                {
                    return((DNHRoleSitemapCollection)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 <DNHRoleSitemapCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache && items.Count > 0)
            {
                HttpCache.Max(key, items);
            }
            return(items);

            //   return Search(value);
        }
示例#2
0
        public virtual DataTable ImportData(DataTable objList)
        {
            IEnumerable <DNHRoleSitemap> myList    = objList.ToList <DNHRoleSitemap>();
            DNHRoleSitemapCollection     ErrorList = new DNHRoleSitemapCollection();

            foreach (DNHRoleSitemap objitem in myList)
            {
                try
                {
                    Save(objitem);
                }
                catch (Exception objEx)
                {
                    objitem.ErrorMesssage = "<div class='error'>" + objEx.Message + "</div>";
                    ErrorList.Add(objitem);
                }
            }
            return(ErrorList.ToDataTable <DNHRoleSitemap>());
        }