📄 productdata.cs
字号:
namespace PowerEasy.Shop
{
using PowerEasy.IDal.Shop;
using PowerEasy.Model.Shop;
using System;
using System.Collections.Generic;
internal sealed class ProductData
{
private static readonly IProductData dal = DataAccess.CreateProductData();
private ProductData()
{
}
public static bool Add(int productId, string tableName, IList<ProductDataInfo> productDataInfoList)
{
bool flag = true;
foreach (ProductDataInfo info in productDataInfoList)
{
flag = Add(productId, tableName, info);
if (!flag)
{
dal.DeleteByProduct(productId, tableName);
return flag;
}
}
return flag;
}
public static bool Add(int productId, string tableName, ProductDataInfo dataInfo)
{
return dal.Add(productId, tableName, dataInfo);
}
public static bool AddOrderNum(int productId, string tableName, string property, int quantity)
{
return dal.AddOrderNum(productId, tableName, property, quantity);
}
public static bool AddStocks(int productId, int quantity, string propertyValue)
{
return dal.AddStocks(productId, quantity, propertyValue);
}
public static IList<ProductDataInfo> GetListByProduct(int productId, string tableName)
{
return dal.GetListByProduct(productId, tableName);
}
public static ProductDataInfo GetProductDataByPropertyValue(int productId, string tableName, string propertyValue)
{
return dal.GetProductDataByPropertyValue(productId, tableName, propertyValue);
}
public static bool Update(int productId, string tableName, IList<ProductDataInfo> infoList)
{
dal.DeleteByProduct(productId, tableName);
return Add(productId, tableName, infoList);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -