📄 package.cs
字号:
namespace PowerEasy.Shop
{
using PowerEasy.Common;
using PowerEasy.IDal.Shop;
using PowerEasy.Model.Shop;
using System;
using System.Collections.Generic;
public sealed class Package
{
private static readonly IPackage dal = DataAccess.CreatePackage();
private Package()
{
}
public static bool Add(PackageInfo packageInfo)
{
if (packageInfo != null)
{
packageInfo.PackageName = DataSecurity.HtmlEncode(packageInfo.PackageName);
return dal.Add(packageInfo);
}
return false;
}
public static bool BatchDelete(string id)
{
return (DataValidator.IsValidId(id) && dal.Delete(id));
}
public static bool Delete(int packageId)
{
return dal.Delete(packageId);
}
public static bool ExistsPackage(string packageName)
{
if (string.IsNullOrEmpty(packageName))
{
return false;
}
return dal.ExistsPackage(packageName);
}
public static bool ExistsPackage(double goodsWeightMin, double goodsWeightMax)
{
return dal.ExistsPackage(goodsWeightMin, goodsWeightMax);
}
public static bool ExistsPackage(string packageName, int currentPackageId)
{
return ((!string.IsNullOrEmpty(packageName) && (currentPackageId > 0)) && dal.ExistsPackage(packageName, currentPackageId));
}
public static bool ExistsPackage(double goodsWeightMin, double goodsWeightMax, int currentPackageId)
{
if (currentPackageId <= 0)
{
return false;
}
return dal.ExistsPackage(goodsWeightMin, goodsWeightMax, currentPackageId);
}
public static IList<PackageInfo> GetList()
{
return dal.GetList();
}
public static PackageInfo GetPackageByGoodsWeight(double goodsWeight)
{
return dal.GetPackageByGoodsWeight(goodsWeight);
}
public static PackageInfo GetPackageByGoodsWeight(double goodsWeight, bool isDecode)
{
PackageInfo packageByGoodsWeight = GetPackageByGoodsWeight(goodsWeight);
if (!packageByGoodsWeight.IsNull && isDecode)
{
packageByGoodsWeight.PackageName = DataSecurity.HtmlDecode(packageByGoodsWeight.PackageName);
}
return packageByGoodsWeight;
}
public static PackageInfo GetPackageById(int id)
{
return dal.GetPackageById(id);
}
public static PackageInfo GetPackageById(int id, bool isDecode)
{
PackageInfo packageById = GetPackageById(id);
if ((packageById != null) && isDecode)
{
packageById.PackageName = DataSecurity.HtmlDecode(packageById.PackageName);
}
return packageById;
}
public static bool Update(PackageInfo packageInfo)
{
if (packageInfo != null)
{
packageInfo.PackageName = DataSecurity.HtmlEncode(packageInfo.PackageName);
return dal.Update(packageInfo);
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -