Example #1
0
        /// <summary>
        /// 获取首页新品上市商品列表
        /// </summary>
        /// <returns></returns>
        public List <RecommendItemModel> GetHomeRecommendProductList()
        {
            var config = AppSettings.GetCachedConfig();
            List <RecommendItemModel> res        = new List <RecommendItemModel>();
            List <RecommendProduct>   resultList = RecommendFacade.QueryNewRecommendProduct(config.CountRecommendProductItemList, ConstValue.LanguageCode, ConstValue.CompanyCode);

            if (null != resultList && resultList.Count > 0)
            {
                foreach (var item in resultList)
                {
                    RecommendItemModel model = new RecommendItemModel()
                    {
                        Code     = item.ProductID,
                        ID       = item.SysNo,
                        ImageUrl = ProductFacade.BuildProductImage(ImageUrlHelper.GetImageSize(ImageType.Middle), item.DefaultImage),
                        Price    = new SalesInfoModel()
                        {
                            CurrentPrice = item.RealPrice, BasicPrice = item.BasicPrice, TariffPrice = item.TariffPrice, CashRebate = item.CashRebate
                        },
                        ProductTitle   = item.ProductTitle,
                        PromotionTitle = item.PromotionTitle
                    };
                    res.Add(model);
                }
            }
            return(res);
        }
Example #2
0
        public ActionResult Ajax_QueryMyFavorite()
        {
            var result = new AjaxResult {
                Success = true
            };
            int pageIndex = int.Parse(Request["PageIndex"]);

            Nesoft.ECWeb.Entity.PageInfo pageInfo = new Entity.PageInfo();
            pageInfo.PageIndex = pageIndex;
            pageInfo.PageSize  = 10;

            var user = UserManager.ReadUserInfo();

            var data       = CustomerFacade.GetMyFavoriteProductList(user.UserSysNo, pageInfo);
            var wishSysNos = CookieHelper.GetCookie <List <int> >("DeletedFavorite") ?? new List <int>();

            data.ResultList.RemoveAll(p => wishSysNos.Any(q => p.WishSysNo == q));
            data.ResultList.ForEach(p =>
            {
                p.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P60, p.DefaultImage);
            });
            result.Data = data;

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        private ProductContentModel TransformDescInfo(List <ProductContent> contentList)
        {
            contentList = contentList ?? new List <ProductContent>();
            ProductContentModel result = new ProductContentModel();

            result.Detail = GetContent(contentList, ProductContentType.Detail);
            string xmPerformance = GetContent(contentList, ProductContentType.Performance);

            result.Performance = ProductFacade.BuildProductPerformanceToHtml(xmPerformance);
            //购买须知移除html tag
            string attention = GetContent(contentList, ProductContentType.Attention);

            result.Attention = StringUtility.RemoveHtmlTag(attention);
            result.Warranty  = GetContent(contentList, ProductContentType.Warranty);

            //包装html内容
            MobileAppConfig config = AppSettings.GetCachedConfig();

            if (config != null)
            {
                result.Detail      = (config.ProductDescTemplate ?? "").Replace("${content}", result.Detail);
                result.Performance = (config.ProductSpecTemplate ?? "").Replace("${content}", result.Performance);
            }

            return(result);
        }
        public async Task Get_Paged_When_Empty_Async()
        {
            int page      = 10;
            int pageSize  = 10;
            int pageIndex = page - 1;

            // arrange
            var mapperConfiguration = new MapperConfiguration(config => config.AddProfile(new ProductMappingProfile()));
            var mapper                = new Mapper(mapperConfiguration);
            var mockLogger            = new Mock <ILogger <ProductsController> >();
            var logger                = mockLogger.Object;
            var mockProductRepository = new Mock <IProductRepository>();

            mockProductRepository.Setup(x => x.GetProductsAsync(page, pageSize)).Returns(() => Task.FromResult((IList <Product>) this.mockedProducts.Skip(pageIndex * pageSize).Take(pageSize)));
            var productRepository  = mockProductRepository.Object;
            var productService     = new ProductService(productRepository);
            var productFacade      = new ProductFacade(productService);
            var productsController = new ProductsController(productFacade, this.Configuration, mapper, logger);

            // act
            IActionResult result = await productsController.Get(page, pageSize);

            // assert
            Assert.IsType <NoContentResult>(result);
        }
Example #5
0
        public JsonResult AjaxAddProductToWishList()
        {
            int productSysNo = 0;

            int.TryParse(Request.Params["productSysNo"], out productSysNo);
            LoginUser user = UserMgr.ReadUserInfo();

            //if (user == null)
            //{
            //    return new JsonResult() { Data = BuildAjaxErrorObject("请先登录!") };
            //}
            //商品已经被收藏
            if (ProductFacade.IsProductWished(productSysNo, user.UserSysNo))
            {
                return(new JsonResult()
                {
                    Data = 0
                });
            }
            CustomerFacade.AddProductToWishList(user.UserSysNo, productSysNo);
            return(new JsonResult()
            {
                Data = 1
            });
        }
Example #6
0
        protected void ucIDetail_ChildListInstanceRowDeleting(object sender, InstanceRowDeletingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
                {
                case InstanceTypes.Product:
                    ProductFacade facade = new ProductFacade(uow);
                    IFacadeUpdateResult <ProductData> result = facade.DeleteProduct(e.Instance.Id);
                    e.IsSuccessful = result.IsSuccessful;

                    if (result.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.Products = facade.RetrieveProductsBySupplier(CurrentInstance.Id, new ProductConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                    break;
                }
            }
        }
Example #7
0
        public List <RecommendItemModel> GetHomeRecommendItemList(int postionID, int count)
        {
            var recommendItemEntityList      = RecommendFacade.QueryRecommendProduct(0, 0, postionID, count, ConstValue.LanguageCode, ConstValue.CompanyCode);
            List <RecommendItemModel> result = new List <RecommendItemModel>();
            ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle);

            foreach (var itemEntity in recommendItemEntityList)
            {
                RecommendItemModel itemModel = new RecommendItemModel();
                itemModel.ID             = itemEntity.SysNo;
                itemModel.ProductTitle   = itemEntity.BriefName;
                itemModel.PromotionTitle = itemEntity.PromotionTitle;
                itemModel.Code           = itemEntity.ProductID;
                itemModel.ImageUrl       = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage);
                var priceModel = new SalesInfoModel();
                itemModel.Price         = priceModel;
                priceModel.BasicPrice   = itemEntity.BasicPrice;
                priceModel.CurrentPrice = itemEntity.RealPrice;
                priceModel.CashRebate   = itemEntity.CashRebate;
                priceModel.TariffPrice  = itemEntity.TariffPrice;
                priceModel.FreeEntryTax = itemEntity.TariffPrice <= ConstValue.TariffFreeLimit;
                decimal realTariffPrice = priceModel.TariffPrice;
                if (priceModel.FreeEntryTax)
                {
                    realTariffPrice = 0;
                }
                priceModel.TotalPrice = itemEntity.CurrentPrice + itemEntity.CashRebate + realTariffPrice;

                result.Add(itemModel);
            }

            return(result);
        }
Example #8
0
        public ActionResult Ajax_QueryFood()
        {
            var pageIndex = int.Parse(Request["page"]);

            var pageSize = int.Parse(Request["size"]);

            var result = new AjaxResult {
                Success = true
            };

            SearchCriteriaModel filter = new SearchCriteriaModel();

            filter.Category1ID = int.Parse(ConfigurationManager.AppSettings["ECCategoryID"]);

            NameValueCollection pageInfo = new NameValueCollection();

            pageInfo.Add("pageIndex", pageIndex.ToString());
            pageInfo.Add("pageSize", pageSize.ToString());
            ProductSearchResultVM data = SearchManager.Search(filter, pageInfo);

            data.ProductList.CurrentPageData.ForEach(p => {
                p.ProductDefaultImage = ProductFacade.BuildProductImage(ImageSize.P240, p.ProductDefaultImage);
            });
            result.Data = new {
                List      = data.ProductList.CurrentPageData,
                PageCount = data.ProductList.TotalPages
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #9
0
        private void GetProductInfo(int?productSysNo, Action <ProductInfo> callback = null)
        {
            if (productSysNo == null)
            {
                return;
            }
            var productFacade = new ProductFacade();

            productFacade.GetProductInfo(productSysNo.Value, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                if (args.Result == null || args.Result.ProductBasicInfo == null || args.Result.ProductCommonInfoSysNo == null || args.Result.ProductCommonInfoSysNo.Value <= 0)
                {
                    Window.MessageBox.Show(callback == null ? "商品编号无效." : "附件编号无效.", MessageBoxType.Warning);
                    return;
                }
                if (callback != null)
                {
                    callback(args.Result);
                }
            });
        }
        public void GetProductByIdAsync_GetFromCache_Test()
        {
            // Arrange
            var            product           = _dataFixture.GetProduct();
            long           productId         = 0;
            List <Product> cachedProductList = new List <Product> {
                product
            };

            _dataFixture.GetMocks <Product>(out var mockRepository, out var mockCacheManager, out var mockOptions);

            mockCacheManager
            .Setup(cache => cache.GetFromCacheAsync <List <Product> >(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(cachedProductList);

            mockRepository
            .Setup(repo => repo.GetAsync <Product>(product => product.Sid == productId, CancellationToken.None))
            .ReturnsAsync((Product)null);

            var customerFacade = new ProductFacade(mockRepository.Object, mockCacheManager.Object, mockOptions.Object);

            // Act
            var result = customerFacade.GetProductByIdAsync(productId, CancellationToken.None).Result;

            // Assert
            Assert.NotNull(result);
            Assert.Equal(0, result.Sid);
            Assert.Equal(20, result.Price);
            Assert.Equal("Coca cola", result.Name);
        }
Example #11
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                ProductDto product = e.Instance as ProductDto;
                // Set defaulted value
                if (CurrentUserContext.IsSupplier)
                {
                    product.SupplierId = CurrentUserContext.User.MatchId;
                }
                ProductFacade facade = new ProductFacade(uow);
                IFacadeUpdateResult <ProductData> result = facade.SaveProduct(product);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    RetrieveInstances(facade);
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
Example #12
0
 public AvailableProductsUserControl(IUnitOfWork aUnitOfWork)
 {
     InitializeComponent();
     unitOfWork    = aUnitOfWork;
     productFacade = new ProductFacade(unitOfWork);
     LoadProductsList();
 }
Example #13
0
        public ActionResult Ajax_QueryOrder()
        {
            var pageIndex = int.Parse(Request["PageIndex"]);
            var queryType = int.Parse(Request["QueryType"]);

            SOQueryInfo query = new SOQueryInfo();

            //搜索类型,默认是搜索[最近三个月的-15][14-所有订单]
            query.SearchType = queryType == 1 ?
                               SOSearchType.LastThreeMonths : SOSearchType.ALL;
            query.PagingInfo           = new PageInfo();
            query.PagingInfo.PageSize  = 5;
            query.PagingInfo.PageIndex = pageIndex;
            query.CustomerID           = CurrUser.UserSysNo;
            query.Status = null;

            QueryResult <OrderInfo> orders = CustomerFacade.GetOrderList(query);

            //如果查询类型是【三个月内】下单,则需要合并最近下单的数据
            if (query.SearchType == SOSearchType.LastThreeMonths && pageIndex == 0)
            {
                var recentOrderSysNoes = CookieHelper.GetCookie <string>("SoSysNo");
                if (!string.IsNullOrWhiteSpace(recentOrderSysNoes))
                {
                    var soSysNoes    = recentOrderSysNoes.Split(',').ToList <string>();
                    var recentOrders = CustomerFacade.GetCenterOrderMasterList(query.CustomerID, soSysNoes);
                    if (recentOrders != null && orders != null && orders.ResultList != null)
                    {
                        //排除掉orders中已经存在的数据
                        recentOrders.RemoveAll(p => orders.ResultList.Any(q => q.SoSysNo == p.SoSysNo));
                        //将最近的订单加载到orders中
                        for (var i = recentOrders.Count - 1; i >= 0; i--)
                        {
                            orders.ResultList.Insert(0, recentOrders[i]);
                        }
                    }
                }
            }
            if (orders != null)
            {
                if (orders.ResultList != null)
                {
                    for (var i = 0; i < orders.ResultList.Count; i++)
                    {
                        orders.ResultList[i] = CustomerFacade.GetCenterSODetailInfo(CurrUser.UserSysNo, orders.ResultList[i].SoSysNo);
                        orders.ResultList[i].SOItemList.ForEach(q =>
                        {
                            q.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P60, q.DefaultImage);
                        });
                    }
                }
            }


            var result = new AjaxResult {
                Success = true, Data = orders
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #14
0
    public string GetProductsJson(string prefix)
    {
        List <Product> products = new List <Product>();

        if (prefix.Trim().Equals(string.Empty, StringComparison.OrdinalIgnoreCase))
        {
            products = ProductFacade.GetAllProducts();
        }
        else
        {
            products = ProductFacade.GetProducts(prefix);
        }

        //your object is your actual object (may be collection) you want to serialize to json
        DataContractJsonSerializer serializer = new DataContractJsonSerializer(products.GetType());
        //create a memory stream
        MemoryStream ms = new MemoryStream();

        //serialize the object to memory stream
        serializer.WriteObject(ms, products);
        //convert the serizlized object to string
        string jsonString = Encoding.Default.GetString(ms.ToArray());

        //close the memory stream
        ms.Close();
        return(jsonString);
    }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductsController"/> class.
 /// </summary>
 /// <param name="productFacade">An instance of the Product facade.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="mapper">An instance of the Automapper class.</param>
 /// <param name="logger">The logger.</param>
 public ProductsController(ProductFacade productFacade, IConfiguration configuration, IMapper mapper, ILogger <ProductsController> logger)
 {
     this.productFacade = productFacade;
     this.configuration = configuration;
     this.mapper        = mapper;
     this.logger        = logger;
 }
        private void BtnBatchActiveClick(object sender, RoutedEventArgs e)
        {
            if (!AuthMgr.HasFunctionPoint(AuthKeyConst.IM_ProductMaintain_ItemProductBatchActive))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("你无此操作权限");
                return;
            }

            List <int> batchOnSaleList =
                VM.GroupProductList.Where(p => p.IsChecked).Select(p => p.ProductSysNo).ToList();

            if (!batchOnSaleList.Any())
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("请选择商品", MessageType.Error);
            }
            else
            {
                var facade = new ProductFacade(CPApplication.Current.CurrentPage);
                facade.ProductBatchOnSale(batchOnSaleList, (obj, args)
                                          =>
                {
                    if (!args.FaultsHandle())
                    {
                        var successCount = 0;

                        var result = new StringBuilder();

                        foreach (var p in VM.GroupProductList.Where(p => p.IsChecked).Where(p => !args.Result.ContainsKey(p.ProductSysNo)))
                        {
                            successCount++;
                            p.ProductStatus = ProductStatus.Active;
                            if (VM.ProductID == p.ProductID)
                            {
                                ((ProductMaintain)CPApplication.Current.CurrentPage).VM.ProductMaintainBasicInfo.ProductMaintainBasicInfoStatusInfo.ProductStatus = ProductStatus.Active;
                            }
                        }

                        if (args.Result.Any())
                        {
                            foreach (var r in args.Result)
                            {
                                result.AppendLine(r.Value);
                            }
                        }

                        result.AppendLine("更新成功,影响记录数" + successCount + "条");
                        if (args.Result.Any())
                        {
                            CPApplication.Current.CurrentPage.Context.
                            Window.Alert(result.ToString());
                        }
                        else
                        {
                            CPApplication.Current.CurrentPage.Context.
                            Window.MessageBox.Show(result.ToString().Trim(), MessageBoxType.Success);
                        }
                    }
                });
            }
        }
Example #17
0
        private void PerformSave(ExcelImportEventArgs arg)
        {
            ExcelSheet excelSheet = arg.Result;
            // Extract data from imported Excel sheet
            List <ProductDto> products = new List <ProductDto>();

            for (int index = excelSheet.DataStartRowIndex; index < excelSheet.Rows.Count; index++)
            {
                ExcelSheetRow excelRow = excelSheet.Rows[index];
                ProductDto    product  = new ProductDto();
                ExtractImportedSheetRow(product, excelRow);
                product.SupplierId = SupplierId;
                products.Add(product);
            }

            // Save batch
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                ProductFacade facade = new ProductFacade(uow);
                IFacadeUpdateResult <ProductData> result = facade.SaveProducts(products);
                if (result.IsSuccessful)
                {
                    arg.IsSuccessful = true;
                    arg.Message      = string.Format("Batch save done. \\nTotal {0} rows.", products.Count);
                }
                else
                {
                    arg.IsSuccessful = false;
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
Example #18
0
        private void BindProperty(SellerProductRequestVM vm, ProductSellerPortalParameterControl sellControl)
        {
            ProductFacade _productFacade = new ProductFacade();

            _productFacade.GetPropertyValueList(vm.SellerProductRequestPropertyList.Select(p => p.PropertySysno).ToList(), (ob, arg) =>
            {
                if (arg.FaultsHandle())
                {
                    return;
                }
                foreach (var propertyVM in vm.SellerProductRequestPropertyList)
                {
                    propertyVM.PropertyValueList = new List <PropertyValueVM>();
                    foreach (var i in arg.Result.Keys)
                    {
                        if (propertyVM.PropertySysno == i)
                        {
                            propertyVM.PropertyValueList = _productFacade.ConvertPropertyValueInfoToPropertyValueVM(arg.Result[i]);
                        }
                    }
                    propertyVM.PropertyValueList.Insert(0, new PropertyValueVM
                    {
                        SysNo            = 0,
                        ValueDescription = "请选择..."
                    });
                }

                sellControl.dgPropertyQueryResult.ItemsSource = vm.SellerProductRequestPropertyList;
                sellControl.dgPropertyQueryResult.TotalCount  = vm.SellerProductRequestPropertyList.Count;
            });
        }
Example #19
0
        private void Button2_Click(object sender, System.EventArgs e)
        {
            //生产产品入库
            DataTable dtSalesSerial = GetProduct();
            ArrayList alSalesSerial = new ArrayList();

            if (dtSalesSerial.Rows.Count > 0)
            {
                foreach (DataRow dr in dtSalesSerial.Rows)
                {
                    SalesSerial ps = new SalesSerial(dr);
                    ps.cndCreateDate = Convert.ToDateTime(TextBox1.Text);
                    ps.cnvcOperID    = oper.strLoginID;
                    ps.cnvcDeptID    = ddlDept.SelectedValue;

                    alSalesSerial.Add(ps);
                }

                OperLog ol = new OperLog();
                ol.cnvcDeptID   = oper.strDeptID;
                ol.cnvcOperID   = oper.strLoginID;
                ol.cnvcOperType = "销售产品入库";

                ProductFacade pf = new ProductFacade();
                pf.AddSalesSerial(alSalesSerial, ol);

                this.Popup("销售产品入库成功!");

                //清理数据

                Session.Remove("tbSalesSerial");
                BindGrid();
            }
        }
Example #20
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         ProductFacade facade = new ProductFacade(uow);
         RetrieveInstances(facade);
     }
 }
Example #21
0
 public LoadNewProductsUserControl(IUnitOfWork aUnitOfWork, ILogStrategy aLogStrategy, string userEmail)
 {
     InitializeComponent();
     unitOfWork        = aUnitOfWork;
     logStrategy       = aLogStrategy;
     productFacade     = new ProductFacade(unitOfWork);
     signedInUserEmail = userEmail;
 }
 private ProductDto GetProduct(int id)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         ProductFacade facade = new ProductFacade(uow);
         return(facade.RetrieveOrNewProduct(id, new ProductConverter()));
     }
 }
 private IEnumerable <ProductDto> GetProductList()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         ProductFacade productFacade = new ProductFacade(uow);
         return(productFacade.RetrieveAllProduct(new ProductConverter()));
     }
 }
    private void ItemProduced(IProduciable <ItemIdentity> item, int orderSecond, float remainingSecond)
    {
        ProductFacade <ItemIdentity> product = new ProductFacade <ItemIdentity>();

        product.Product     = item;
        product.OrderSecond = orderSecond;
        this.m_FinishItemProducts.Add(product);
    }
Example #25
0
 private void LoadProducts()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         ProductFacade facade = new ProductFacade(uow);
         ucProductExplorer.Instances = facade.RetrieveGlobalProducts(WebContext.Current.ApplicationOption.GlobalProductCatalogId, new ProductInfoConverter(CurrentUserContext.CurrentLanguage.Id));
     }
 }
Example #26
0
        private SalesInfoModel TransformSalesInfo(ProductBasicInfo basicInfo, ProductSalesInfo salesInfo)
        {
            SalesInfoModel priceModel = new SalesInfoModel();
            //预计到货时间(单位:天)
            int shippingDays = int.Parse(Nesoft.ECWeb.Facade.CommonFacade.GetSysConfigByKey("仓库处理时间"));

            shippingDays  += int.Parse(Nesoft.ECWeb.Facade.CommonFacade.GetSysConfigByKey("快递配送时间"));
            shippingDays  += basicInfo.ProductEntryInfo.LeadTimeDays;
            priceModel.ETA = shippingDays;

            priceModel.BasicPrice       = salesInfo.MarketPrice;
            priceModel.CurrentPrice     = salesInfo.CurrentPrice;
            priceModel.CashRebate       = salesInfo.CashRebate;
            priceModel.TariffPrice      = salesInfo.EntryTax ?? 0;
            priceModel.TotalPrice       = salesInfo.TotalPrice;
            priceModel.MinCountPerOrder = salesInfo.MinCountPerOrder;
            priceModel.MaxCountPerOrder = salesInfo.MaxCountPerOrder;
            priceModel.PresentPoint     = salesInfo.Point;
            //是否免关税
            priceModel.FreeEntryTax = salesInfo.FreeEntryTax;
            //是否免运费
            priceModel.FreeShipping = false;
            priceModel.OnlineQty    = salesInfo.OnlineQty;

            //计算库存状态
            string inventoryStatus = "";

            if (basicInfo.ProductStatus == ProductStatus.OnlyShow ||
                salesInfo.OnlineQty <= 0)
            {
                inventoryStatus = "已售罄";
            }
            else if (salesInfo.OnlineQty <= ConstValue.ProductWarnInventory)
            {
                inventoryStatus = "即将售完";
            }
            else
            {
                inventoryStatus = "有货";
            }
            priceModel.InventoryStatus = inventoryStatus;

            //计算是否已加入收藏夹
            bool      productIsWished = false;
            LoginUser currUser        = UserMgr.ReadUserInfo();

            if (currUser == null || currUser.UserSysNo <= 0)
            {
                productIsWished = false;
            }
            else
            {
                productIsWished = ProductFacade.IsProductWished(basicInfo.ID, currUser.UserSysNo);
            }
            priceModel.IsWished = productIsWished;

            return(priceModel);
        }
 private IFacadeUpdateResult <ProductData> SaveProduct(ProductDto instance)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         ProductFacade facade = new ProductFacade(uow);
         IFacadeUpdateResult <ProductData> result = facade.SaveProduct(instance);
         return(result);
     }
 }
Example #28
0
 private void RetrieveProductData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         ProductFacade  facade  = new ProductFacade(uow);
         ProductInfoDto product = facade.RetrieveProductInfo(ProductId, new ProductInfoConverter(CurrentUserContext.CurrentLanguage.Id));
         lblTitle.Text = product.Name;
     }
 }
    private void ArmyProduced(IProduciable <ArmyIdentity> army, int orderSecond, float remainingSecond)
    {
        ProductFacade <ArmyIdentity> product = new ProductFacade <ArmyIdentity>();

        product.Product        = army;
        product.OrderSecond    = orderSecond;
        product.RemainingSeond = remainingSecond;
        this.m_FinishArmyProducts.Add(product);
    }
Example #30
0
        private StoreBasicInfoModel Transformstoreinfo(StoreBasicInfo storeinfo)
        {
            StoreBasicInfoModel result = new StoreBasicInfoModel();

            result.Address             = storeinfo.Address;
            result.BrandAuthorize      = storeinfo.BrandAuthorize;
            result.ContactName         = storeinfo.ContactName;
            result.CooperationMode     = storeinfo.CooperationMode;
            result.CurrentECChannel    = storeinfo.CurrentECChannel;
            result.ECExpValue          = storeinfo.ECExpValue;
            result.EditDate            = storeinfo.EditDate;
            result.EditUserName        = storeinfo.EditUserName;
            result.EditUserSysNo       = storeinfo.EditUserSysNo;
            result.Email               = storeinfo.Email;
            result.ExportExpValue      = storeinfo.ExportExpValue;
            result.HaveECExp           = storeinfo.HaveECExp;
            result.HaveExportExp       = storeinfo.HaveExportExp;
            result.InDate              = storeinfo.InDate;
            result.InUserName          = storeinfo.InUserName;
            result.InUserSysNo         = storeinfo.InUserSysNo;
            result.MainBrand           = storeinfo.MainBrand;
            result.MainProductCategory = storeinfo.MainProductCategory;
            result.Mobile              = storeinfo.Mobile;
            result.Name        = storeinfo.Name;
            result.Phone       = storeinfo.Phone;
            result.QQ          = storeinfo.QQ;
            result.Remark      = storeinfo.Remark;
            result.SellerSysNo = storeinfo.SellerSysNo;
            result.Site        = storeinfo.Site;
            result.Status      = storeinfo.Status;
            result.StoreName   = storeinfo.StoreName;
            result.SysNo       = storeinfo.SysNo;
            result.ValidDate   = storeinfo.ValidDate;

            //构造商品图片
            ImageSize imageSizeMiddle = ImageUrlHelper.GetImageSize(ImageType.Middle);

            result.LogoURL = ProductFacade.BuildProductImage(imageSizeMiddle, storeinfo.LogoURL);


            //是否被收藏
            #region 是否被收藏
            LoginUser CurrUser      = UserMgr.ReadUserInfo();
            bool      StoreIsWished = false;
            if (CurrUser == null || CurrUser.UserSysNo < 0)
            {
                StoreIsWished = false;
            }
            else
            {
                StoreIsWished = CustomerFacade.IsMyFavoriteSeller(CurrUser.UserSysNo, storeinfo.SellerSysNo.Value);
            }
            #endregion
            result.StoreIsWished = StoreIsWished;
            return(result);
        }