本文整理汇总了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
{
示例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);
//.........这里部分代码省略.........
示例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();
}