人民医院API

T_Sys_Department.cs 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using System;
  2. using System.Data;
  3. using System.Collections.Generic;
  4. namespace RMYY_CallCenter_Api.Bll
  5. {
  6. /// <summary>
  7. /// T_Sys_Department
  8. /// </summary>
  9. public partial class T_Sys_Department
  10. {
  11. private readonly Dal.T_Sys_Department dal = new Dal.T_Sys_Department();
  12. public T_Sys_Department()
  13. { }
  14. #region BasicMethod
  15. /// <summary>
  16. /// 是否存在该记录
  17. /// </summary>
  18. public bool Exists(string F_DeptCode)
  19. {
  20. return dal.Exists(F_DeptCode);
  21. }
  22. /// <summary>
  23. /// 增加一条数据
  24. /// </summary>
  25. public int Add(Model.T_Sys_Department model)
  26. {
  27. return dal.Add(model);
  28. }
  29. /// <summary>
  30. /// 更新一条数据
  31. /// </summary>
  32. public bool Update(Model.T_Sys_Department model)
  33. {
  34. return dal.Update(model);
  35. }
  36. /// <summary>
  37. /// 删除一条数据
  38. /// </summary>
  39. public bool Delete(int F_DeptId)
  40. {
  41. return dal.Delete(F_DeptId);
  42. }
  43. /// <summary>
  44. /// 删除一条数据
  45. /// </summary>
  46. public bool DeleteList(string F_DeptIdlist)
  47. {
  48. return dal.DeleteList(F_DeptIdlist);
  49. }
  50. /// <summary>
  51. /// 得到一个对象实体
  52. /// </summary>
  53. public Model.T_Sys_Department GetModel(int F_DeptId)
  54. {
  55. return dal.GetModel(F_DeptId);
  56. }
  57. /// <summary>
  58. /// 得到一个对象实体
  59. /// </summary>
  60. public Model.T_Sys_Department GetModel(string F_DeptCode)
  61. {
  62. return dal.GetModel(F_DeptCode);
  63. }
  64. /// <summary>
  65. /// 获得数据列表
  66. /// </summary>
  67. public DataSet GetList(string strWhere)
  68. {
  69. return dal.GetList(strWhere);
  70. }
  71. /// <summary>
  72. /// 获得前几行数据
  73. /// </summary>
  74. public DataSet GetList(int Top, string strWhere, string filedOrder)
  75. {
  76. return dal.GetList(Top, strWhere, filedOrder);
  77. }
  78. /// <summary>
  79. /// 获得数据列表
  80. /// </summary>
  81. public List<Model.T_Sys_Department> GetModelList(string strWhere)
  82. {
  83. DataSet ds = dal.GetList(strWhere);
  84. return DataTableToList(ds.Tables[0]);
  85. }
  86. /// <summary>
  87. /// 获得数据列表
  88. /// </summary>
  89. public List<Model.T_Sys_Department> DataTableToList(DataTable dt)
  90. {
  91. List<Model.T_Sys_Department> modelList = new List<Model.T_Sys_Department>();
  92. int rowsCount = dt.Rows.Count;
  93. if (rowsCount > 0)
  94. {
  95. Model.T_Sys_Department model;
  96. for (int n = 0; n < rowsCount; n++)
  97. {
  98. model = dal.DataRowToModel(dt.Rows[n]);
  99. if (model != null)
  100. {
  101. modelList.Add(model);
  102. }
  103. }
  104. }
  105. return modelList;
  106. }
  107. /// <summary>
  108. /// 获得数据列表
  109. /// </summary>
  110. public DataSet GetAllList()
  111. {
  112. return GetList("");
  113. }
  114. /// <summary>
  115. /// 分页获取数据列表
  116. /// </summary>
  117. public int GetRecordCount(string strWhere)
  118. {
  119. return dal.GetRecordCount(strWhere);
  120. }
  121. #endregion BasicMethod
  122. public int GetDeplayer(int deptid)
  123. {
  124. int layer = 1;
  125. var model = dal.GetModel(deptid);
  126. if (model != null)
  127. {
  128. if (model.F_ParentId != 0)
  129. {
  130. layer++;
  131. GetDeplayer(Convert.ToInt32(model.F_ParentId));
  132. }
  133. }
  134. return layer;
  135. }
  136. }
  137. }