예제 #1
0
        public ItemSearchGeneralResponseModel ItemBySimpleSearch(ItemSimpleSearchModel item)
        {
            ItemSearchResultModel          singleItem = new ItemSearchResultModel();
            ItemSearchGeneralResponseModel result     = new ItemSearchGeneralResponseModel();

            result.SearchResult = new List <ItemSearchResultModel>();

            var query      = _itemDataAccess.SimpleSearchItems(item.ItemName, (item.NextBatch - 1) * 10);
            var codeDetail = _itemDataAccess.GetAllItemStatus();

            result.RecordCount = query.RecordCount;

            for (int i = 0; i < query.SearchResult.Count; i++)
            {
                singleItem.Id       = query.SearchResult[i].Id;
                singleItem.ItemName = query.SearchResult[i].ItemName;
                singleItem.Brand    = query.SearchResult[i].Brand;
                singleItem.Status   = codeDetail.Where(x => x.Id == query.SearchResult[i].Status)
                                      .Select(x => x.CodeValue).FirstOrDefault();
                singleItem.CreateDttm   = query.SearchResult[i].CreateDttm;
                singleItem.LocationName = query.SearchResult[i].LocationName;
                singleItem.StocksLeft   = query.SearchResult[i].StockLeft;
                singleItem.Notes        = query.SearchResult[i].Notes;

                result.SearchResult.Add(singleItem);
                singleItem = new ItemSearchResultModel();
            }

            return(result);
        }
예제 #2
0
        public ItemSearchGeneralResponseModel ItemAdvancedSearch(ItemSearchQueryModel item)
        {
            ItemSearchResultModel          singleItem = new ItemSearchResultModel();
            ItemSearchGeneralResponseModel result     = new ItemSearchGeneralResponseModel();

            result.SearchResult = new List <ItemSearchResultModel>();
            ItemSearchModel searchTerm = new ItemSearchModel();

            searchTerm.ModuleName    = "items";
            searchTerm.Id            = item.Id;
            searchTerm.ItemName      = item.ItemName;
            searchTerm.Brand         = item.Brand;
            searchTerm.CategoryId    = item.CategoryId;
            searchTerm.SubCategoryId = item.SubCategoryId;
            searchTerm.Location      = item.Location;
            searchTerm.Tag           = item.Tag;
            searchTerm.Sku           = item.Sku;
            searchTerm.StatusCd      = item.StatusCd;
            searchTerm.NextBatch     = (item.NextBatch - 1) * 10;

            var query      = _itemDataAccess.AdvancedSearchItems(searchTerm);
            var codeDetail = _itemDataAccess.GetAllItemStatus();

            result.RecordCount = query.RecordCount;

            for (int i = 0; i < query.SearchResult.Count; i++)
            {
                singleItem.Id         = query.SearchResult[i].Id;
                singleItem.ItemName   = query.SearchResult[i].ItemName;
                singleItem.Brand      = query.SearchResult[i].Brand;
                singleItem.Status     = codeDetail.Where(x => x.Id == query.SearchResult[i].Status).Select(x => x.CodeValue).FirstOrDefault();
                singleItem.CreateDttm = query.SearchResult[i].CreateDttm;

                result.SearchResult.Add(singleItem);
                singleItem = new ItemSearchResultModel();
            }

            return(result);
        }