当前位置: 首页>>代码示例>>C#>>正文


C# SKUInfo.Update方法代码示例

本文整理汇总了C#中SKUInfo.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SKUInfo.Update方法的具体用法?C# SKUInfo.Update怎么用?C# SKUInfo.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SKUInfo的用法示例。


在下文中一共展示了SKUInfo.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: gridData_OnExternalDataBound


//.........这里部分代码省略.........
                    return GetString("com.inventory.nottracked");
                }

                // Ensure correct values for unigrid export
                if (sender == null)
                {
                    return availableItems;
                }

                // Tracking by products
                InlineEditingTextBox inlineAvailableItems = new InlineEditingTextBox();
                inlineAvailableItems.Text = availableItems.ToString();
                inlineAvailableItems.DelayedReload = DocumentListingDisplayed;
                inlineAvailableItems.EnableEncode = false;

                inlineAvailableItems.Formatting += (s, e) =>
                {
                    var reorderAt = sku.SKUReorderAt;

                    // Emphasize the number when product needs to be reordered
                    if (availableItems <= reorderAt)
                    {
                        // Format message informing about insufficient stock level
                        string reorderMsg = string.Format(GetString("com.sku.reorderatTooltip"), reorderAt);
                        string message = string.Format("<span class=\"alert-status-error\" onclick=\"UnTip()\" onmouseout=\"UnTip()\" onmouseover=\"Tip('{1}')\">{0}</span>", availableItems, reorderMsg);
                        inlineAvailableItems.FormattedText = message;
                    }
                };

                // Unigrid with delayed reload in combination with inline edit control requires additional postback to sort data.
                // Update data only if external data bound is called for the first time.
                if (!forceReloadData)
                {
                    inlineAvailableItems.Update += (s, e) =>
                    {
                        var newNumberOfItems = ValidationHelper.GetInteger(inlineAvailableItems.Text, availableItems);

                        if (ValidationHelper.IsInteger(inlineAvailableItems.Text) && (-1000000000 <= newNumberOfItems) && (newNumberOfItems <= 1000000000))
                        {
                            CheckModifyPermission(sku);

                            // Ensures that grid will display inserted value
                            sku.SKUAvailableItems = newNumberOfItems;

                            // Document list is used to display products -> document has to be updated to ensure correct sku mapping
                            if (DocumentListingDisplayed)
                            {
                                int documentId = ValidationHelper.GetInteger(row.Row["DocumentID"], 0);

                                // Create an instance of the Tree provider and select edited document with coupled data
                                TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
                                TreeNode document = tree.SelectSingleDocument(documentId);

                                if (document == null)
                                {
                                    return;
                                }

                                document.SetValue("SKUAvailableItems", newNumberOfItems);
                                document.Update();

                                forceReloadData = true;
                            }
                            // Stand-alone product -> only product has to be updated
                            else
                            {
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:67,代码来源:Product_List.aspx.cs

示例2: grid_OnExternalDataBound

    private object grid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
            case "skuprice":
                var optionRow = parameter as DataRowView;
                var option = new SKUInfo(optionRow.Row);

                if (sender == null)
                {
                    return option.SKUPrice;
                }

                var inlineSkuPrice = new InlineEditingTextBox();
                inlineSkuPrice.Text = option.SKUPrice.ToString();

                inlineSkuPrice.Formatting += (s, e) =>
                {
                    // Format price
                    inlineSkuPrice.FormattedText = CurrencyInfoProvider.GetRelativelyFormattedPrice(option.SKUPrice, option.SKUSiteID);
                };

                inlineSkuPrice.Update += (s, e) =>
                {
                    CheckModifyPermission();

                    CheckDepartmentPermission(option.SKUDepartmentID);

                    var valid = false;
                    var price = option.SKUPrice;
                    // Update price if new value is valid
                    if (ValidationHelper.IsDouble(inlineSkuPrice.Text))
                    {
                        price = ValidationHelper.GetDouble(inlineSkuPrice.Text, option.SKUPrice);
                        // Accessory price can not be negative
                        if (!option.IsAccessoryProduct || !(price < 0.0))
                        {
                            valid = true;
                        }
                    }

                    if (valid)
                    {
                        option.SKUPrice = price;
                        option.MakeComplete(true);
                        option.Update();

                        ugOptions.ReloadData();
                    }
                    else
                    {
                        inlineSkuPrice.ErrorText = GetString("com.productedit.priceinvalid");
                    }
                };

                return inlineSkuPrice;

            case "skuavailableitems":
                var row = parameter as DataRowView;
                var optionStock = new SKUInfo(row.Row);

                int availableItems = optionStock.SKUAvailableItems;

                // Inventory tracking disabled
                if (optionStock.SKUTrackInventory == TrackInventoryTypeEnum.Disabled)
                {
                    return GetString("com.inventory.nottracked");
                }

                // Ensure correct values for unigrid export
                if (sender == null)
                {
                    return availableItems;
                }

                var inlineSkuAvailableItems = new InlineEditingTextBox();
                inlineSkuAvailableItems.Text = availableItems.ToString();
                inlineSkuAvailableItems.EnableEncode = false;

                inlineSkuAvailableItems.Formatting += (s, e) =>
                {
                    var reorderAt = optionStock.SKUReorderAt;

                    // Emphasize the number when product needs to be reordered
                    if (availableItems <= reorderAt)
                    {
                        // Format message informing about insufficient stock level
                        string reorderMsg = string.Format(GetString("com.sku.reorderatTooltip"), reorderAt);
                        string message = string.Format("<span class=\"alert-status-error\" onclick=\"UnTip()\" onmouseout=\"UnTip()\" onmouseover=\"Tip('{1}')\">{0}</span>", availableItems, reorderMsg);
                        inlineSkuAvailableItems.FormattedText = message;
                    }
                };

                inlineSkuAvailableItems.Update += (s, e) =>
                {
                    CheckModifyPermission();

                    CheckDepartmentPermission(optionStock.SKUDepartmentID);

                    var newNumberOfItems = ValidationHelper.GetInteger(inlineSkuAvailableItems.Text, availableItems);
//.........这里部分代码省略.........
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:101,代码来源:OptionCategory_Edit_Options.aspx.cs

示例3: UpdateVariant

    /// <summary>
    /// Updates variant price.
    /// </summary>
    /// <param name="variantInfo">Variant SKU info</param>
    /// <param name="newPrice">New price of variant</param>
    private void UpdateVariant(SKUInfo variantInfo, double newPrice)
    {
        AddLog(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(variantInfo.SKUName)) + GetString("com.variant.priceisbeingupdated"));

        // Change price
        variantInfo.SKUPrice = newPrice;
        variantInfo.Update();
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:13,代码来源:Product_Edit_Variants.aspx.cs


注:本文中的SKUInfo.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。