initFCL
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 税率
|
||||
/// </summary>
|
||||
public class TaxRateService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取税率信息
|
||||
/// </summary>
|
||||
/// <param name="taxRateId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_TaxRate GetTaxRateById(string taxRateId)
|
||||
{
|
||||
return Funs.DB.Base_TaxRate.FirstOrDefault(e => e.TaxRateId == taxRateId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加税率信息
|
||||
/// </summary>
|
||||
/// <param name="taxRate"></param>
|
||||
public static void AddTaxRate(Model.Base_TaxRate taxRate)
|
||||
{
|
||||
Model.Base_TaxRate newTaxRate = new Model.Base_TaxRate();
|
||||
newTaxRate.TaxRateId = taxRate.TaxRateId;
|
||||
newTaxRate.TaxRate = taxRate.TaxRate;
|
||||
newTaxRate.Remarks = taxRate.Remarks;
|
||||
Funs.DB.Base_TaxRate.InsertOnSubmit(newTaxRate);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改税率信息
|
||||
/// </summary>
|
||||
/// <param name="taxRate"></param>
|
||||
public static void UpdateTaxRate(Model.Base_TaxRate taxRate)
|
||||
{
|
||||
Model.Base_TaxRate newTaxRate = Funs.DB.Base_TaxRate.FirstOrDefault(e => e.TaxRateId == taxRate.TaxRateId);
|
||||
if (newTaxRate!=null)
|
||||
{
|
||||
newTaxRate.TaxRate = taxRate.TaxRate;
|
||||
newTaxRate.Remarks = taxRate.Remarks;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除税率信息
|
||||
/// </summary>
|
||||
/// <param name="taxRateId"></param>
|
||||
public static void DeleteTaxRateById(string taxRateId)
|
||||
{
|
||||
Model.Base_TaxRate taxRate = Funs.DB.Base_TaxRate.FirstOrDefault(e => e.TaxRateId == taxRateId);
|
||||
if (taxRate!=null)
|
||||
{
|
||||
Funs.DB.Base_TaxRate.DeleteOnSubmit(taxRate);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证是否存在相同的税率
|
||||
/// </summary>
|
||||
/// <param name="taxRate"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitTaxRate(string taxRate, string id)
|
||||
{
|
||||
var q = Funs.DB.Base_TaxRate.FirstOrDefault(x => x.TaxRate == Funs.GetNewDecimalOrZero(taxRate) && x.TaxRateId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user