Example #1
0
 partial void DeletePrice(Price instance);
Example #2
0
 partial void InsertPrice(Price instance);
Example #3
0
 partial void UpdatePrice(Price instance);
Example #4
0
        public IList<Item> GetListItems(InitDataModel inputObject)
        {
            if (inputObject.ShowCd == Logics.CD_SHOW_ITEMS_NEW)
                return GetListNewItems();
            if (inputObject.ShowCd == Logics.CD_SHOW_ITEMS_OFFER)
                return GetListOfferItems();
            if (inputObject.ShowCd == Logics.CD_SHOW_ITEMS_HOT)
                return GetListHotItems();
            if (inputObject.ShowCd == Logics.CD_SHOW_ITEMS_GROUP)
                return GetListGroupItems(inputObject.OfferGroupCd);

            // Get price
            var price = (from tbl in EntityManager.Prices
                             where tbl.PriceCd == inputObject.PriceCd
                             && tbl.DeleteFlag == false
                             select tbl).SingleOrDefault();
            if (price == null) price = new Price();

            var listItemOfferByPrice = from tbl in GetListOffers()
                     where tbl.OfferDiv == Logics.CD_OFFER_DIV_DISCOUNT
                     && EntityManager.Items.Any(sub => sub.ItemCd == tbl.ItemCd
                         && decimal.Subtract(sub.SalesPrice.Value, decimal.Multiply(sub.SalesPrice.Value, tbl.Percent.Value / 100)) >= price.PriceStart
                         && (decimal.Subtract(sub.SalesPrice.Value, decimal.Multiply(sub.SalesPrice.Value, tbl.Percent.Value / 100)) < price.PriceEnd
                         || price.PriceDiv == Logics.CD_PRICE_DIV_MORE))
                     select tbl.ItemCd;

            var listResult = from tbl in EntityManager.Items
                             where (tbl.ItemName.Contains(inputObject.SearchText)
                             || tbl.ItemSearchName.Contains(inputObject.SearchText)
                             || tbl.Category.CategoryName.Contains(inputObject.SearchText)
                             || tbl.Category.CategorySearchName.Contains(inputObject.SearchText)
                             || tbl.Brand.BrandName.Contains(inputObject.SearchText)
                             || tbl.Brand.BrandSearchName.Contains(inputObject.SearchText)
                             || DataCheckHelper.IsNull(inputObject.SearchText))
                             && (tbl.CategoryCd == inputObject.CategoryCd
                             || DataCheckHelper.IsNull(inputObject.CategoryCd))
                             && (tbl.AgeCd == inputObject.AgeCd
                             || DataCheckHelper.IsNull(inputObject.AgeCd))
                             && (tbl.GenderCd == inputObject.GenderCd
                             || DataCheckHelper.IsNull(inputObject.GenderCd))
                             && (tbl.BrandCd == inputObject.BrandCd
                             || DataCheckHelper.IsNull(inputObject.BrandCd))
                             && (DataCheckHelper.IsNull(inputObject.PriceCd)
                             || (!(from sub1 in GetListOffers()
                                   where sub1.OfferDiv == Logics.CD_OFFER_DIV_DISCOUNT
                                   select sub1.ItemCd).Contains(tbl.ItemCd)
                                   && tbl.SalesPrice >= price.PriceStart
                                   && (tbl.SalesPrice < price.PriceEnd
                                   || price.PriceDiv == Logics.CD_PRICE_DIV_MORE))
                             || listItemOfferByPrice.Contains(tbl.ItemCd))
                             && tbl.DeleteFlag == false
                             orderby tbl.SortKey ascending
                             select tbl;

            return listResult.ToList();
        }