Пример #1
0
        /// <summary>
        /// 开始入板
        /// </summary>
        /// <param name="currentRoller"></param>
        /// <param name="product"></param>
        private void start(RollerDesignerItemViewModel currentRoller, ProductBase product)
        {
            if (product == null)
            {
                return;
            }

            RunningProductVo runningProduct = new RunningProductVo {
                Product = product
            };

            lock (_lockRunningProducts)
                _runningProducts.Add(runningProduct);

            var beginRoller = _runningRollers.FirstOrDefault(a => a.RollerKey == currentRoller.Key);

            if (beginRoller == null)
            {
                throw new Exception($"起点({currentRoller.Key})不在运行时中");
            }
            beginRoller.BandProduct = runningProduct;

            // 获取默认路径
            runningProduct.TargetNode = getAutoTargetNode(currentRoller.Key);
            if (string.IsNullOrWhiteSpace(runningProduct.TargetNode))
            {
                throw new Exception($"{currentRoller.Key}目标路径路由信息为空!");
            }
            runningProduct.TargetPath = findPath(runningProduct.CurrentRollerKey, runningProduct.TargetNode);
        }
        public async Task <IActionResult> Update(int id, UpdateProductViewModel model)
        {
            if (ModelState.IsValid)
            {
                var product =
                    new ProductBase()
                {
                    Id          = id,
                    Name        = model.Name,
                    Description = model.Description,
                    Price       = model.Price
                };

                var selectedCategoriesIds =
                    model
                    .SelectedCategories?
                    .Select(x => int.Parse(x)) ?? new int[0];
                var selectedBrandId =
                    int.Parse(
                        model
                        .SelectedBrand
                        );
                if (await TryUpdateModelAsync(product))
                {
                    _productService
                    .UpdateProductBase(product, selectedBrandId, selectedCategoriesIds);
                    return(RedirectToAction("ListProducts", "Admin", null));
                }
            }
            _PopulateBrands(model);
            _PopulateCategories(model);
            _PopulateRatings(model);
            return(View(model));
        }
Пример #3
0
 private void Validate(ProductBase product)
 {
     if (product.Price < 0)
     {
         ModelState.AddModelError(nameof(product.Price), "Price must be non-negative");
     }
 }
        public async Task <ActionResult <ProductBase> > PostProductBase(ProductBase productBase)
        {
            _context.ProductBases.Add(productBase);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProductBase", new { id = productBase.PID }, productBase));
        }
Пример #5
0
        public static bool LoadProductDiscussions(ProductBase product, int startRow, int endRow)
        {
            bool res = false;

            if (product.ProductId == null ||
                !product.ProductId.HasValue)
            {
                return(res);
            }

            try
            {
                // Initiate product forum
                // For all products discussions ForumId = 0
                Forum forum = product.Forum;
                forum.UrlName = product.Catalog.UrlName;
                forum.ForumId = (Int16)Memory.Forums.ForumType.Product;
                forum.PageId  = product.ProductId.Value;

                res = LoadDiscussions(forum, startRow, endRow);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Exception:{0}", ex.ToString()));
            }

            return(res);
        }
Пример #6
0
        public void TestProduct1()
        {
            IProductFactory pf      = new MockProductFactory();
            string          xmlPath = Path.Combine(Environment.CurrentDirectory, "ProductSample.xml");
            ProductBase     product = pf.CreateProduct("TestProduct", xmlPath);

            // as if we are taking order transactions from database
            Dictionary <string, object> row = new Dictionary <string, object>();

            row.Add("Amount", 3000);
            //row.Add("Amount", (Decimal)3000);
            //row.Add("Amount", DBNull.Value);
            //row.Add("Amount", null);
            row.Add("DealPrice", (Decimal)1.25);
            row.Add("DealerID", "Somebody");

            IDataSourceStore dsStore = new DataSourceStore();
            IDataSource      ds      = new TableDataSource(row);

            dsStore.AddDataSource(ds);

            foreach (var evDef in product.GetHoldEvents(dsStore))
            {
                foreach (var result in product.TakeReactionsFor(evDef, dsStore))
                {
                    Decimal amount = (Decimal)result.Item2["Amount"];
                    Assert.AreEqual <Decimal>(-3000, amount);
                    // insert dictionary columns into database accounting table
                }
            }
        }
Пример #7
0
    /// <summary>
    /// 内容構築
    /// </summary>
    public void Set(TurretViewer turretViewerPrefab, ProductBase product, SimpleDialog dialog)
    {
        base.Set(product, dialog);

        //砲台表示設定
        this.turretContent.SetInfo(product as ProductCannon, turretViewerPrefab);
    }
Пример #8
0
 private static void UpdateEntity(ProductBase model, Entities.Product entity)
 {
     entity.Name      = model.Name;
     entity.LatinName = model.LatinName;
     entity.Price     = model.Price;
     entity.Quantity  = model.Quantity;
 }
        public void UpdateProductBase(ProductBase productBase, int selectedBrandId, IEnumerable <int> selectedCategoriesIds)
        {
            var product = _mapper.Map <ProductBase, Product>(productBase);

            product
            .BrandId = selectedBrandId;

            var existingProductCategories =
                _productCategoryRepository
                .GetAll()
                .Where(
                    x =>
                    x.ProductId == productBase.Id
                    )
                .ToList();

            _DeleteProductCategories(
                _GetToBeDeletedProductCategories(existingProductCategories, selectedCategoriesIds),
                product.Id
                );

            _AddProductCategories(
                _GetToBeAddedProductCategories(existingProductCategories, selectedCategoriesIds),
                product.Id
                );

            _productRepository
            .Update(product);

            _productRepository
            .Save();

            _cache
            .Remove($"ProdFull:{product.Id}");
        }
Пример #10
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RemoveData(object sender, CommandEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
            {
                ProductBase _PA01 = new ProductBase();
                _PA01.PA01001 = Convert.ToInt32(e.CommandArgument.ToString());
                _PA01.PA01997 = 1;
                int num = Math.Abs(_ProductBLL.RemoveProductBase(_PA01));
                new Sinoo.Common.MessageShow().RemoveMessage(this, num, string.Empty);

                if (num < 1)
                {
                    return;
                }

                int CurrentPageIndex = this.AspNetPager1.CurrentPageIndex; //当前页
                int PageCount        = this.AspNetPager1.PageCount;        //页总数
                int RecordCount      = this.AspNetPager1.RecordCount;      //记录数
                int PageSize         = this.AspNetPager1.PageSize;         //第页条数

                int PageIndex = CurrentPageIndex == PageCount ? (PageCount * PageSize - RecordCount == (PageSize - 1) ? CurrentPageIndex - 1 : CurrentPageIndex) : CurrentPageIndex;

                InitData(PageIndex, false);
            }
        }
Пример #11
0
        public ServiceResult <ProductBase> CreateProduct(ProductBase product)
        {
            bool isProductValid;

            try
            {
                isProductValid = ValidateProductBase(product);
            }
            catch (ArgumentException aex)
            {
                return(ServiceResult <ProductBase> .CreateErrorResult(aex.Message));
            }

            if (!isProductValid)
            {
                return(ServiceResult <ProductBase> .CreateErrorResult("Model is not valid"));
            }

            try
            {
                var result = _productProvider.CreateBaseProduct(product);
                return(ServiceResult <ProductBase> .CreateSuccessResult(result));
            }
            catch (Exception ex)
            {
                return(ServiceResult <ProductBase> .CreateErrorResult(ex.Message));
            }
        }
Пример #12
0
 public void setup()
 {
     wait         = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
     homepage     = new HomePageBase(driver);
     products     = new ProductBase(driver);
     registration = new RegistrationBase(driver);
 }
    /// <summary>
    /// 内容構築
    /// </summary>
    public void Set(TurretViewer turretViewerPrefab, ProductIcon icon, ProductBase product, SimpleDialog dialog, Action <UserBillingData, UserShopData, ProductIcon, ProductBase> onPurchaseCompleted, Action onNonPurchase)
    {
        base.Set(icon, product, dialog, onPurchaseCompleted, onNonPurchase);

        //砲台表示設定
        this.turretContent.SetInfo(product as ProductCannon, turretViewerPrefab);
    }
Пример #14
0
    /// <summary>
    /// 内容構築
    /// </summary>
    public virtual void Set(ProductIcon icon, ProductBase product, SimpleDialog dialog, Action <UserBillingData, UserShopData, ProductIcon, ProductBase> onPurchaseCompleted, Action onNonPurchase)
    {
        this.icon    = icon;
        this.product = product;
        this.dialog  = dialog;
        //現状では購入数の指定を行う仕様がないため、定数で設定
        this.buyNum = 1;

        this.onPurchaseCompleted = onPurchaseCompleted;
        this.onNonPurchase       = onNonPurchase;

        //確認メッセージ設定
        this.SetConfirmMessage();

        //コインコンテンツ設定
        this.SetCoinContent();

        //ジェムコンテンツ設定
        this.SetGemContent();

        if (this.product is ProductBilling)
        {
            //購入ボタンを表示
            this.PurchaseProduct();
        }
    }
Пример #15
0
 public void Execute(IPayoutMonitor monitor, ProductBase product)
 {
     if (monitor.IsPayoutTriggered)
     {
         _behaviourFactory.Create(product, BehaviourEnum.Payout).Execute();
     }
 }
Пример #16
0
        internal ProductBO(ProductBase product, ProductRating rating, List<Review> reviews = null)
        {


            AverageRating = rating.AverageRating;
            Reviews = reviews;
            Id = product.Id;
            LanguageId = product.LanguageId;
            PublisherId = product.PublisherId;
            CategoryId = product.CategoryId;
            StateId = product.StateId;
            BookId = product.BookId;

            Name = product.Name;
            PicAddress = product.PicAddress;
            Text = product.Text;
            Price = product.Price;
            PageCount = product.PageCount;
            Year = product.Year;
            ISBN = product.ISBN;
            EAN = product.EAN;

            Format = product.Format;
            State = product.State;
            Publisher = product.Publisher;
            Language = product.Language;
            Category = product.Category;
            Book = product.Book;
        }
Пример #17
0
        static void Main(string[] args)
        {
            ProductFactory productFactory = new ProductFactory();
            ProductBase    product        = productFactory.GetProductTablet();

            // ADD
            // ProductBase product = productFactory.GetProductTablet("SKUTEST","tablet","Test","Test_desc","8col","testimg");
            // product.AddProduct();

            // GET
            product.SKU = "TB1234";
            List <ProductBase> products = product.GetProducts();


            // UPDATE
            products[0].Description += "_UPD";
            products[0].UpdateProduct();


            // DELETE
            products[0].RemoveProduct();


            Console.ReadKey();
        }
        public async Task <IActionResult> PutProductBase(int id, ProductBase productBase)
        {
            if (id != productBase.PID)
            {
                return(BadRequest());
            }

            _context.Entry(productBase).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductBaseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #19
0
        public ServiceResult <bool> UpdateProduct(int productId, ProductBase product)
        {
            if (productId < 1)
            {
                return(ServiceResult <bool> .CreateErrorResult($"{nameof(productId)} must be more than 0"));
            }

            bool isProductValid;

            try
            {
                isProductValid = ValidateProductBase(product);
            }
            catch (ArgumentException aex)
            {
                return(ServiceResult <bool> .CreateErrorResult(aex.Message));
            }

            if (!isProductValid)
            {
                return(ServiceResult <bool> .CreateErrorResult("Model is not valid"));
            }

            try
            {
                var result = _productProvider.UpdateBaseProduct(productId, product);
                return(ServiceResult <bool> .CreateSuccessResult(result));
            }
            catch (Exception ex)
            {
                return(ServiceResult <bool> .CreateErrorResult(ex.Message));
            }
        }
Пример #20
0
        public static GeneralDatabaseList GetFeatured(string cultureId)
        {
            GeneralDatabaseList ret      = new GeneralDatabaseList();
            List <ProductBase>  products = null;
            string query = "FeaturedList";

            using (SqlConnection cnn = new SqlConnection(Configurations.ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand(query, cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@CultureId", cultureId));
                    foreach (SqlParameter Parameter in cmd.Parameters)
                    {
                        if (Parameter.Value == null)
                        {
                            Parameter.Value = DBNull.Value;
                        }
                    }

                    cnn.Open();

                    products = new List <ProductBase>();

                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null && reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            ProductBase product = new ProductBase();

                            product.ProductId             = Repository.Utils.Convert.ToInt64(reader[1]);
                            product.ProductName           = Repository.Utils.Convert.ToString(reader[2]);
                            product.Price                 = Repository.Utils.Convert.ToDecimal(reader[3]);
                            product.ProductReleaseDate    = Repository.Utils.Convert.ToDateTime(reader[4]);
                            product.BriefDescription      = Repository.Utils.Convert.ToString(reader[5]);
                            product.MultiLanguage         = Repository.Utils.Convert.ToBool(reader[6]);
                            product.Catalog.EditorRating  = Repository.Utils.Convert.ToDecimal(reader[7]);
                            product.Catalog.UserRating    = Repository.Utils.Convert.ToDecimal(reader[8]);
                            product.Catalog.UrlName       = Repository.Utils.Convert.ToString(reader[9]);
                            product.ProductVersion        = Repository.Utils.Convert.ToString(reader[10]);
                            product.Catalog.IsFeatured    = Repository.Utils.Convert.ToBool(reader["IsFeatured"]);
                            product.Catalog.UpdateDate    = Repository.Utils.Convert.ToDateTime(reader["UpdateDate"]);
                            product.Catalog.FeatureRating = Repository.Utils.Convert.ToDecimal(reader["FeatureRating"]);
                            product.Catalog.Popularity    = Repository.Utils.Convert.ToDecimal(reader["Popularity"]);

                            products.Add(product);

                            ret.TotalCount++;
                        }
                    }

                    cnn.Close();
                }
            }

            ret.List = products;
            return(ret);
        }
Пример #21
0
    /// <summary>
    /// 商品アイコンクリック時
    /// </summary>
    private void OnClickProductIcon(ProductBase product, ProductIcon icon)
    {
        //購入確認ダイアログ開く
        var dialog  = SharedUI.Instance.ShowSimpleDialog();
        var content = dialog.AddContent(this.purchaseConfirmDialogContentPrefab);

        content.Set(icon, product, dialog, this.OnPurchaseCompleted, null);
    }
Пример #22
0
        public ProductBase UpdateProduct(ProductBase product)
        {
            var oldProduct = GetProduct(product.Id);

            _context.Entry(oldProduct).CurrentValues.SetValues(product);
            _context.SaveChanges();
            return(product);
        }
Пример #23
0
        public ProductBase CreateBaseProduct(ProductBase product)
        {
            var entityEntry = db.Products.Add((Product)product);

            db.SaveChanges(true);

            return(entityEntry.Entity);
        }
 /// <summary>
 /// 内容構築
 /// </summary>
 public override void Setup(ProductBase product)
 {
     this.icon.Set(product.addItems[0].itemType, product.addItems[0].itemId, false);
     this.icon.SetFrameVisible(product.isVisibleProductIconFrame);
     product.SetCommonIcon(this.icon);
     this.nameText.text        = product.productName;
     this.descriptionText.text = product.description;
 }
Пример #25
0
        public Guid AddProduct(Guid StoreId, ProductBase obj)
        {
            var store = storeRepository.GetStore(StoreId);

            store.Products.Add(obj);
            UpdateOne(store);
            return(obj.Id);
        }
Пример #26
0
 public void Post([FromBody] ProductBase document)
 {
     productRepository.Create(new Product
     {
         Name      = document.Name,
         UnitPrice = document.UnitPrice,
     });
 }
 public static ValidationResult CheckPriceCost(ProductBase product)
 {
     if (product.Price < product.Cost)
     {
         List<string> properties = new List<string>() { "Price", "Cost" };
         return new ValidationResult("Price must be >= Cost.", properties);
     }
     return ValidationResult.Success;
 }
Пример #28
0
    /// <summary>
    /// 表示構築
    /// </summary>
    public void BuildView(ProductBase product)
    {
        this.Initialize();

        //長押し時コールバック
        this.onLongPress = () =>
        {
            this.infoDialogData.OpenDialog(product);
        };

        //CommonIcon表示構築
        this.commonIcon.Set(product.addItems[0].itemType, product.addItems[0].itemId, false);

        //CommonIconのフレームと背景表示切り替え
        this.commonIcon.SetFrameVisible(product.isVisibleProductIconFrame);

        //CommonIconのサイズ変更
        this.commonIcon.rectTransform.sizeDelta = product.iconSize;

        //CommonIconに対する追加処理
        product.SetCommonIcon(this.commonIcon);

        //商品名
        this.productNameText.text = product.productName;

        //値段テキスト
        string priceText = product.price.ToString("#,0");

        if (product is ProductBilling)
        {
            //一次通貨で購入する場合は¥マーク表示になるので、支払いアイコンは非表示
            this.paymentItemIconImage.gameObject.SetActive(false);

            //値段テキスト
            priceText = Masters.LocalizeTextDB.GetFormat("Price", priceText);
        }
        else
        {
            var payInfo = CommonIconUtility.GetItemInfo((uint)product.payType, 0);
            if (payInfo.IsCommonSprite())
            {
                //支払いアイコン設定
                this.paymentItemIconImage.gameObject.SetActive(true);
                this.paymentItemIconImage.sprite = SharedUI.Instance.commonAtlas.GetSprite(payInfo.GetSpritePath());
            }
        }

        //値段テキスト
        this.priceText.text = priceText;

        //残り購入回数表示
        this.SetPurchasesCountText(product.remainCount);

        //おすすめの設定 (α版では表示したくないとのこと)
        this.recommendContent.SetActive(false);//(product.Recommended > 0);
    }
    /// <summary>
    /// 内容構築
    /// </summary>
    public override void Set(ProductIcon icon, ProductBase product, SimpleDialog dialog, Action <UserBillingData, UserShopData, ProductIcon, ProductBase> onPurchaseCompleted, Action onNonPurchase)
    {
        base.Set(icon, product, dialog, onPurchaseCompleted, onNonPurchase);

        //CommonIcon表示構築
        this.commonIcon.Set(this.product.addItems[0].itemType, this.product.addItems[0].itemId, false);

        //商品説明
        this.productInfoText.text = this.product.description;
    }
Пример #30
0
        // *******************************************************************
        // Public methods.
        // *******************************************************************

        #region Public methods

        /// <summary>
        /// This method exposes the <see cref="IBuilderProduct.Providers"/> method on a
        /// <see cref="ProductBase"/> object, in order to avoid the need to
        /// constantly downcast.
        /// </summary>
        /// <param name="product">A <see cref="ProductBase"/> reference.</param>
        /// <returns>A collection of providers.</returns>
        public static IEnumerable <IBuilderProvider> Providers(
            this ProductBase product
            )
        {
            // Validate the parameter before attempting to use it.
            new Guard().ThrowIfNull(product, nameof(product));

            // Downcast and perform the operation.
            return(((IBuilderProduct)product).Providers);
        }
Пример #31
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            var         selected = cmbType.SelectedItem.ToString();
            ProductType pt;

            Enum.TryParse(selected, out pt);

            SelectedItem = ProductHelper.GetProduct(pt);
            //ürün tipine (pt) göre class ı çağır
        }
        public DataTable GetRecommendProductDefaultSKUList(string strWhere)
        {
            var dt = dal.GetRecommendProductDefaultSKUList(strWhere);
            BLL.ProductBase pB = new ProductBase ();

            return pB.GetGroupPurchasePrice(dt);
        }