namespace Clock.IDAL
{
using Clock.Model;
public interface IUsersClock
{
/// <summary>
/// 获得所有打卡记录
/// </summary>
/// <returns></returns>
List<UsersClock> GetUsersClocks();
}
}
namespace Clock.Factory
{
using System.Configuration;
using System.Reflection;
public class DALFactory
{
private static readonly string AssemblyName = ConfigurationManager.AppSettings["ClockDAL"];
/// <summary>
/// 实例化DAL
/// </summary>
/// <param name="typeName">DAL类型名</param>
/// <returns></returns>
public static T CreateDAL<T>(string typeName)
{
return (T)Assembly.Load(AssemblyName).CreateInstance(AssemblyName + typeName);
}
}
}
namespace Clock.BLL
{
using Clock.DAL;
using Clock.Model;
using Clock.Factory;
using Clock.IDAL;
using System.Data.SqlClient;
public class UsersClockBLL
{
IUsersClock clockDAL = null;
public UsersClockBLL()
{
clockDAL = DALFactory.CreateDAL<UsersClockDAL>(".UsersClockDAL");
}
/// <summary>
/// 获得所有打卡记录
/// </summary>
/// <returns></returns>
public List<UsersClock> GetUsersClocks()
{
return clockDAL.GetUsersClocks();
}
}
}