郑州颐和随访系统

T_Sys_UserAccount.cs 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. if (user1!=null)
  91. CacheHelper.Insert(F_UserCode, user1, 10);
  92. return user1;
  93. }
  94. }
  95. /// <summary>
  96. /// 根据Openid 获取用户
  97. /// </summary>
  98. /// <param name="openid"></param>
  99. /// <returns></returns>
  100. public Model.T_Sys_UserAccount GetModelByOpenid(string openid)
  101. {
  102. return dal.GetModelByOpenid(openid);
  103. }
  104. /// <summary>
  105. /// 登录得到一个对象实体
  106. /// </summary>
  107. public Model.T_Sys_UserAccount LoginGetModel(string F_UserCode, string F_Password)
  108. {
  109. return dal.LoginGetModel(F_UserCode, F_Password);
  110. }
  111. ///// <summary>
  112. ///// 得到一个对象实体,从缓存中
  113. ///// </summary>
  114. //public Model.T_Sys_UserAccount GetModelByCache(int F_UserId)
  115. //{
  116. // string CacheKey = "T_Sys_UserAccountModel-" + F_UserId;
  117. // object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
  118. // if (objModel == null)
  119. // {
  120. // try
  121. // {
  122. // objModel = dal.GetModel(F_UserId);
  123. // if (objModel != null)
  124. // {
  125. // int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
  126. // Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
  127. // }
  128. // }
  129. // catch{}
  130. // }
  131. // return (Model.T_Sys_UserAccount)objModel;
  132. //}
  133. /// <summary>
  134. /// 获得数据列表
  135. /// </summary>
  136. public DataSet GetList(string strWhere)
  137. {
  138. return dal.GetList(strWhere);
  139. }
  140. public DataSet GetListView(string strWhere)
  141. {
  142. return dal.GetListView(strWhere);
  143. }
  144. /// <summary>
  145. /// 获得前几行数据
  146. /// </summary>
  147. public DataSet GetList(int Top, string strWhere, string filedOrder)
  148. {
  149. return dal.GetList(Top, strWhere, filedOrder);
  150. }
  151. /// <summary>
  152. /// 获得数据列表
  153. /// </summary>
  154. public List<Model.T_Sys_UserAccount> GetModelList(string strWhere)
  155. {
  156. DataSet ds = dal.GetList(strWhere);
  157. return DataTableToList(ds.Tables[0]);
  158. }
  159. /// <summary>
  160. /// 获得数据列表
  161. /// </summary>
  162. public List<Model.T_Sys_UserAccount> DataTableToList(DataTable dt)
  163. {
  164. List<Model.T_Sys_UserAccount> modelList = new List<Model.T_Sys_UserAccount>();
  165. int rowsCount = dt.Rows.Count;
  166. if (rowsCount > 0)
  167. {
  168. Model.T_Sys_UserAccount model;
  169. for (int n = 0; n < rowsCount; n++)
  170. {
  171. model = dal.DataRowToModel(dt.Rows[n]);
  172. if (model != null)
  173. {
  174. modelList.Add(model);
  175. }
  176. }
  177. }
  178. return modelList;
  179. }
  180. public List<Model.T_Sys_UserAccount> DataTableToList1(DataTable dt)
  181. {
  182. List<Model.T_Sys_UserAccount> modelList = new List<Model.T_Sys_UserAccount>();
  183. int rowsCount = dt.Rows.Count;
  184. if (rowsCount > 0)
  185. {
  186. Model.T_Sys_UserAccount model;
  187. for (int n = 0; n < rowsCount; n++)
  188. {
  189. model = dal.DataRowToModel1(dt.Rows[n]);
  190. if (model != null)
  191. {
  192. modelList.Add(model);
  193. }
  194. }
  195. }
  196. return modelList;
  197. }
  198. /// <summary>
  199. /// 获得数据列表
  200. /// </summary>
  201. public DataSet GetAllList()
  202. {
  203. return GetList("");
  204. }
  205. /// <summary>
  206. /// 分页获取数据列表
  207. /// </summary>
  208. public int GetRecordCount(string strWhere)
  209. {
  210. return dal.GetRecordCount(strWhere);
  211. }
  212. /// <summary>
  213. /// 分页获取数据列表
  214. /// </summary>
  215. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  216. {
  217. return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
  218. }
  219. /// <summary>
  220. /// 分页获取数据列表
  221. /// </summary>
  222. //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  223. //{
  224. //return dal.GetList(PageSize,PageIndex,strWhere);
  225. //}
  226. #endregion BasicMethod
  227. #region ExtensionMethod
  228. #endregion ExtensionMethod
  229. }
  230. }