Ejemplo n.º 1
0
        public virtual IEnumerable <DNHRoles> SearchData(SearchFilter value)
        {
            DNHRolesCollection items = new DNHRolesCollection();
            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((DNHRolesCollection)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 <DNHRolesCollection>().GetAwaiter().GetResult();
                }
            }

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

            //   return Search(value);
        }
Ejemplo n.º 2
0
        public virtual DataTable ImportData(DataTable objList)
        {
            IEnumerable <DNHRoles> myList    = objList.ToList <DNHRoles>();
            DNHRolesCollection     ErrorList = new DNHRolesCollection();

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