narsil/Tanshu.Accounts.Repository/BusinessLayer/TaxBI.cs

61 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using Tanshu.Accounts.Contracts;
using System.Data.SqlClient;
using Tanshu.Data.DAO;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.SqlDAO;
using NHibernate.Criterion;
using Tanshu.Accounts.Entities.Auth;
namespace Tanshu.Accounts.Repository
{
public static class TaxBI
{
public static void Insert(Tax tax)
{
using (var session = SessionManager.Session)
{
session.Save(tax);
}
}
public static void Update(Tax tax)
{
using (var session = SessionManager.Session)
{
using (var trans = session.BeginTransaction())
{
session.Update(tax);
trans.Commit();
}
}
}
public static void Delete(int taxID)
{
using (var session = SessionManager.Session)
{
session.Delete(new Tax() { TaxID = taxID });
}
}
public static Tax GetTax(int taxID)
{
using (var session = SessionManager.Session)
{
return session.Get<Tax>(taxID);
}
}
public static IList<Tax> GetTaxes()
{
using (var session = SessionManager.Session)
{
return session.CreateCriteria<Tax>()
.List<Tax>();
}
}
}
}