郑州颐和随访系统

T_Sys_UserAccount.cs 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. using CallCenterApi.Common;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace CallCenterApi.BLL
  9. {
  10. /// <summary>
  11. /// T_Sys_UserAccount
  12. /// </summary>
  13. public partial class T_Sys_UserAccount
  14. {
  15. private readonly DAL.T_Sys_UserAccount dal = new DAL.T_Sys_UserAccount();
  16. public T_Sys_UserAccount()
  17. { }
  18. #region BasicMethod
  19. /// <summary>
  20. /// 得到最大ID
  21. /// </summary>
  22. public int GetMaxId()
  23. {
  24. return dal.GetMaxId();
  25. }
  26. /// <summary>
  27. /// 是否存在该记录
  28. /// </summary>
  29. public bool Exists(int F_UserId)
  30. {
  31. return dal.Exists(F_UserId);
  32. }
  33. /// <summary>
  34. /// 增加一条数据
  35. /// </summary>
  36. public int Add(Model.T_Sys_UserAccount model)
  37. {
  38. return dal.Add(model);
  39. }
  40. /// <summary>
  41. /// 更新一条数据
  42. /// </summary>
  43. public bool Update(Model.T_Sys_UserAccount model)
  44. {
  45. CacheHelper.Remove(model.F_UserCode);
  46. return dal.Update(model);
  47. }
  48. /// <summary>
  49. /// 删除一条数据
  50. /// </summary>
  51. public bool Delete(int F_UserId)
  52. {
  53. return dal.Delete(F_UserId);
  54. }
  55. /// <summary>
  56. /// 删除一条数据
  57. /// </summary>
  58. public bool DeleteList(string F_UserIdlist)
  59. {
  60. CacheHelper.RemoveAll();
  61. return dal.DeleteList(F_UserIdlist);
  62. }
  63. /// <summary>
  64. /// 更新数据状态 批量
  65. /// </summary>
  66. public bool DeleteList(string F_UserIdlist, int state)
  67. {
  68. return dal.DeleteList(F_UserIdlist, state);
  69. }
  70. /// <summary>
  71. /// 得到一个对象实体
  72. /// </summary>
  73. public Model.T_Sys_UserAccount GetModel(int F_UserId)
  74. {
  75. return dal.GetModel(F_UserId);
  76. }
  77. /// <summary>
  78. /// 得到一个对象实体
  79. /// </summary>
  80. public Model.T_Sys_UserAccount GetModel(string F_UserCode)
  81. {
  82. var user = CacheHelper.Get(F_UserCode);
  83. if (user != null)
  84. {
  85. return user as Model.T_Sys_UserAccount;
  86. }
  87. else
  88. {
  89. var user1 = dal.GetModel(F_UserCode);
  90. CacheHelper.Insert(F_UserCode, user1, 10);
  91. return user1;
  92. }
  93. }
  94. /// <summary>
  95. /// 根据Openid 获取用户
  96. /// </summary>
  97. /// <param name="openid"></param>
  98. /// <returns></returns>
  99. public Model.T_Sys_UserAccount GetModelByOpenid(string openid)
  100. {
  101. return dal.GetModelByOpenid(openid);
  102. }
  103. /// <summary>
  104. /// 登录得到一个对象实体
  105. /// </summary>
  106. public Model.T_Sys_UserAccount LoginGetModel(string F_UserCode, string F_Password)
  107. {
  108. return dal.LoginGetModel(F_UserCode, F_Password);
  109. }
  110. ///// <summary>
  111. ///// 得到一个对象实体,从缓存中
  112. ///// </summary>
  113. //public Model.T_Sys_UserAccount GetModelByCache(int F_UserId)
  114. //{
  115. // string CacheKey = "T_Sys_UserAccountModel-" + F_UserId;
  116. // object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
  117. // if (objModel == null)
  118. // {
  119. // try
  120. // {
  121. // objModel = dal.GetModel(F_UserId);
  122. // if (objModel != null)
  123. // {
  124. // int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
  125. // Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
  126. // }
  127. // }
  128. // catch{}
  129. // }
  130. // return (Model.T_Sys_UserAccount)objModel;
  131. //}
  132. /// <summary>
  133. /// 获得数据列表
  134. /// </summary>
  135. public DataSet GetList(string strWhere)
  136. {
  137. return dal.GetList(strWhere);
  138. }
  139. public DataSet GetListView(string strWhere)
  140. {
  141. return dal.GetListView(strWhere);
  142. }
  143. /// <summary>
  144. /// 获得前几行数据
  145. /// </summary>
  146. public DataSet GetList(int Top, string strWhere, string filedOrder)
  147. {
  148. return dal.GetList(Top, strWhere, filedOrder);
  149. }
  150. /// <summary>
  151. /// 获得数据列表
  152. /// </summary>
  153. public List<Model.T_Sys_UserAccount> GetModelList(string strWhere)
  154. {
  155. DataSet ds = dal.GetList(strWhere);
  156. return DataTableToList(ds.Tables[0]);
  157. }
  158. /// <summary>
  159. /// 获得数据列表
  160. /// </summary>
  161. public List<Model.T_Sys_UserAccount> DataTableToList(DataTable dt)
  162. {
  163. List<Model.T_Sys_UserAccount> modelList = new List<Model.T_Sys_UserAccount>();
  164. int rowsCount = dt.Rows.Count;
  165. if (rowsCount > 0)
  166. {
  167. Model.T_Sys_UserAccount model;
  168. for (int n = 0; n < rowsCount; n++)
  169. {
  170. model = dal.DataRowToModel(dt.Rows[n]);
  171. if (model != null)
  172. {
  173. modelList.Add(model);
  174. }
  175. }
  176. }
  177. return modelList;
  178. }
  179. public List<Model.T_Sys_UserAccount> DataTableToList1(DataTable dt)
  180. {
  181. List<Model.T_Sys_UserAccount> modelList = new List<Model.T_Sys_UserAccount>();
  182. int rowsCount = dt.Rows.Count;
  183. if (rowsCount > 0)
  184. {
  185. Model.T_Sys_UserAccount model;
  186. for (int n = 0; n < rowsCount; n++)
  187. {
  188. model = dal.DataRowToModel1(dt.Rows[n]);
  189. if (model != null)
  190. {
  191. modelList.Add(model);
  192. }
  193. }
  194. }
  195. return modelList;
  196. }
  197. /// <summary>
  198. /// 获得数据列表
  199. /// </summary>
  200. public DataSet GetAllList()
  201. {
  202. return GetList("");
  203. }
  204. /// <summary>
  205. /// 分页获取数据列表
  206. /// </summary>
  207. public int GetRecordCount(string strWhere)
  208. {
  209. return dal.GetRecordCount(strWhere);
  210. }
  211. /// <summary>
  212. /// 分页获取数据列表
  213. /// </summary>
  214. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  215. {
  216. return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
  217. }
  218. /// <summary>
  219. /// 分页获取数据列表
  220. /// </summary>
  221. //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  222. //{
  223. //return dal.GetList(PageSize,PageIndex,strWhere);
  224. //}
  225. #endregion BasicMethod
  226. #region ExtensionMethod
  227. #endregion ExtensionMethod
  228. }
  229. }