CarUse.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:3k
源码类别:

OA系统

开发平台:

C#

  1. //------------------------------------------------------------------------------
  2. // 创建标识: Copyright (C) 2009 Socansoft.com 版权所有
  3. // 创建描述: SocanCode代码生成器 V4.3.3.5 自动创建于 2009-12-25 15:18:14
  4. //
  5. // 功能描述: 
  6. //
  7. // 修改标识: 
  8. // 修改描述: 
  9. //------------------------------------------------------------------------------
  10. using System;
  11. using System.Data;
  12. using System.Collections.Generic;
  13. using System.Text;
  14. using System.Web;
  15. using System.Web.Caching;
  16. using System.Text.RegularExpressions;
  17. namespace BLL
  18. {
  19. /// <summary>
  20. /// 业务逻辑类 CarUse
  21. /// </summary>
  22. public class CarUse
  23. {
  24. private readonly SqlServerDAL.CarUse dal = new SqlServerDAL.CarUse();
  25. public CarUse()
  26. { }
  27.         /// <summary>
  28. /// 增加一条数据
  29. /// </summary>
  30.         public void Add(Model.CarUse model)
  31.         {
  32.             CheckModel(model);
  33.             dal.Add(model);
  34.         }
  35.         /// <summary>
  36. /// 更新一条数据
  37. /// </summary>
  38.         public void Update(Model.CarUse model)
  39.         {
  40.             CheckModel(model);
  41.             dal.Update(model);
  42.         }
  43.         /// <summary>
  44. /// 删除一条数据
  45. /// </summary>
  46.         public void Delete(int ID)
  47.         {
  48.             CheckConditionArgument(ID);
  49.             dal.Delete(ID);
  50.         }
  51.         /// <summary>
  52. /// 是否存在该记录
  53. /// </summary>
  54.         public bool Exists(int ID)
  55.         {
  56.             CheckConditionArgument(ID);
  57.             return dal.Exists(ID);
  58.         }
  59.         /// <summary>
  60. /// 得到一个对象实体
  61. /// </summary>
  62.         public Model.CarUse GetModel(int ID)
  63.         {
  64.             CheckConditionArgument(ID);
  65.             return dal.GetModel(ID);
  66.         }
  67.         /// <summary>
  68. /// 获得泛型数据列表
  69. /// </summary>
  70.         public List<Model.CarUse> GetList()
  71.         {
  72.             return dal.GetList();
  73.         }
  74.         /// <summary>
  75. /// 取得数据行数,不建议直接使用此方法,请根据业务逻辑重写
  76. /// </summary>
  77.         public int GetCount(string condition)
  78.         {
  79.             return dal.GetCount(condition);
  80.         }
  81.         /// <summary>
  82. /// 分页获取泛型数据列表,不建议直接使用此方法,请根据业务逻辑重写
  83. /// </summary>
  84.         public List<Model.CarUse> GetPageList(int pageSize, int pageIndex, string fldSort, bool fldDir, string condition)
  85.         {
  86.             if (pageSize <= 0)
  87.                 throw new Exception("每页数据条数必须大于0。");
  88.             if (pageIndex <= 0)
  89.                 throw new Exception("页索引必须大于0。");
  90.             if (string.IsNullOrEmpty(fldSort))
  91.                 throw new Exception("排序字段不能为空。如果是默认排序,可以填写主键字段。");
  92.             return dal.GetPageList(pageSize, pageIndex, fldSort, fldDir, condition);
  93.         }
  94. #region 验证参数的有效性,请在此加入更多业务逻辑的验证
  95. /// <summary>
  96. /// 验证实体的有效性
  97. /// </summary>
  98. private void CheckModel(Model.CarUse model)
  99. {
  100. if (model == null)
  101. throw new ArgumentNullException("参数不能为空。");
  102. }
  103. /// <summary>
  104. /// 验证条件参数的有效性
  105. /// </summary>
  106. private void CheckConditionArgument(int ID)
  107. { }
  108. #endregion
  109. }
  110. }