Beispiel #1
0
        /// <summary>
        /// Execute convert input.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel Convert(InitRequestModel request)
        {
            // Local variable declaration
            InitDataModel inputObject = null;

            // Variable initialize
            inputObject = new InitDataModel();

            // Convert data input
            DataHelper.ConvertInput(request, inputObject);

            inputObject = PagingHelper.CopyPagerRequest<InitDataModel>(request, inputObject);

            // Return value
            return inputObject;
        }
Beispiel #2
0
        /// <summary>
        /// Execute convert ouput.
        /// </summary>
        /// <param name="resultObject">DataModel</param>
        /// <returns>ResponseModel</returns>
        private InitResponseModel Convert(InitDataModel resultObject)
        {
            // Local variable declaration
            InitResponseModel responseModel = null;
            PagerResponse<OutputItemModel> listItems = null;
            OutputItemModel item = null;

            // Variable initialize
            responseModel = new InitResponseModel();
            listItems = new PagerResponse<OutputItemModel>();

            // Get value
            foreach (var obj in resultObject.ListItems)
            {
                item = new OutputItemModel();

                item.ItemCd = DataHelper.ToString(obj.ItemCd);
                item.ItemName = DataHelper.ToSubString(obj.ItemName, 20, false);
                item.Tooltip = DataHelper.ToString(obj.ItemName);
                item.ItemImage = DataHelper.ToString(obj.ItemImage);
                item.BrandCd = DataHelper.ToString(obj.BrandCd);
                item.BrandName = DataHelper.ToString(obj.Brand.BrandName);
                item.ItemDiv = DataHelper.ToString(obj.ItemDiv);
                item.OfferDiv = DataHelper.ToString(obj.OfferDiv);
                item.Price = DataHelper.ToString(Formats.CURRENCY, obj.SalesPrice);
                item.PriceOld = DataHelper.ToString(Formats.CURRENCY, obj.SalesPriceOld);
                item.SummaryNotes = DataHelper.ToString(obj.SummaryNotes);
                item.UpdateDate = DataHelper.ToString(Formats.UPDATE_DATE, obj.UpdateDate);
                listItems.Add(item);
            }
            listItems.AllRecordCount = resultObject.ListItems.AllRecordCount;
            listItems.Limit = resultObject.ListItems.Limit;
            listItems.Offset = resultObject.ListItems.Offset;

            // Set value
            responseModel.DiscountMember = DataHelper.ToString(Formats.PERCENT, resultObject.DiscountMember);
            responseModel.Hotline = DataHelper.ToString(resultObject.Hotline);
            //responseModel.ChatYahooIM = DataHelper.GetYahooIM(resultObject.ChatYahoo);
            //responseModel.ChatYahooIcon = DataHelper.GetYahooIcon(resultObject.ChatYahoo);
            responseModel.Title = DataHelper.ToString(resultObject.Title);
            responseModel.ListItems = listItems;

            // Return value
            return responseModel;
        }
Beispiel #3
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();
        }
Beispiel #4
0
 /// <summary>
 /// Check processing.
 /// </summary>
 /// <param name="inputObject">DataModel</param>
 private void Check(InitDataModel inputObject)
 {
 }
Beispiel #5
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            ClientItemsDao clientItemsDao = null;
            ItemCom itemCom = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            clientItemsDao = new ClientItemsDao();
            itemCom = new ItemCom();
            mParameterCom = new MParameterCom();

            // Get data
            var listItems = clientItemsDao.GetListItems(inputObject);
            var discountMember = mParameterCom.GetNumber(Logics.PR_DISCOUNT_MEMBER, false);
            var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strChatYahoo = mParameterCom.GetString(Logics.PR_CHAT_YAHOO, false);

            // Title
            var title = string.Empty;
            if (!DataCheckHelper.IsNull(inputObject.SearchText))
                title = "Tìm kiếm";
            else if (!DataCheckHelper.IsNull(inputObject.CategoryCd))
                title = clientItemsDao.GetCategoryName(inputObject.CategoryCd);
            else if (!DataCheckHelper.IsNull(inputObject.BrandCd))
                title = clientItemsDao.GetBrandName(inputObject.BrandCd);
            else if (!DataCheckHelper.IsNull(inputObject.AgeCd))
                title = clientItemsDao.GetAgeName(inputObject.AgeCd);
            else if (!DataCheckHelper.IsNull(inputObject.GenderCd))
                title = clientItemsDao.GetGenderName(inputObject.GenderCd);
            else if (!DataCheckHelper.IsNull(inputObject.OfferGroupCd))
                title = "Khuyến mãi";
            else title = "Tất cả";

            // Set value
            getResult.Title = title;
            getResult.DiscountMember = discountMember;
            getResult.Hotline = strHotline;
            getResult.ChatYahoo = strChatYahoo;
            getResult.ListItems = PagingHelper.GetPagerList(
                itemCom.ToListItemModel(listItems), inputObject);

            // Return value
            return getResult;
        }