GeneralMethod.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. using Microsoft.AspNetCore.Authentication;
  2. using Microsoft.AspNetCore.Authentication.Cookies;
  3. using Microsoft.AspNetCore.Mvc.TagHelpers;
  4. using Microsoft.International.Converters.PinYinConverter;
  5. using OASystem.API.OAMethodLib.JuHeAPI;
  6. using OASystem.Domain;
  7. using OASystem.Domain.Dtos.Financial;
  8. using OASystem.Domain.Entities.Customer;
  9. using OASystem.Domain.Entities.District;
  10. using OASystem.Domain.Entities.Financial;
  11. using OASystem.Domain.Entities.Groups;
  12. using OASystem.Domain.Entities.PersonnelModule;
  13. using OASystem.Domain.Entities.System;
  14. using OASystem.Domain.ViewModels.Financial;
  15. using OASystem.Domain.ViewModels.JuHeExchangeRate;
  16. using OASystem.Domain.ViewModels.PersonnelModule;
  17. using OASystem.Infrastructure.Repositories.CRM;
  18. using OASystem.Infrastructure.Repositories.Groups;
  19. using System.Collections.Generic;
  20. using System.IdentityModel.Tokens.Jwt;
  21. using System.Security.Claims;
  22. namespace OASystem.API.OAMethodLib
  23. {
  24. public static class GeneralMethod
  25. {
  26. //团组信息
  27. private readonly static DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
  28. private readonly static TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
  29. private readonly static IJuHeApiService _juHeApiService = AutofacIocManager.Instance.GetService<IJuHeApiService>();
  30. private readonly static SetDataRepository _setDataRep = AutofacIocManager.Instance.GetService<SetDataRepository>();
  31. private readonly static TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
  32. private readonly static HttpContext _httpContext ;
  33. #region 消息
  34. #endregion
  35. #region md5 加密
  36. /// <summary>
  37. /// MD5加密,和动网上的16/32位MD5加密结果相同,
  38. /// 使用的UTF8编码
  39. /// </summary>
  40. /// <param name="source">待加密字串</param>
  41. /// <param name="length">16或32值之一,其它则采用.net默认MD5加密算法</param>
  42. /// <returns>加密后的字串</returns>
  43. public static string Encrypt(string source, int length = 32)
  44. {
  45. if (string.IsNullOrWhiteSpace(source))
  46. return string.Empty;
  47. HashAlgorithm hashAlgorithm = CryptoConfig.CreateFromName("MD5") as HashAlgorithm;
  48. byte[] bytes = Encoding.UTF8.GetBytes(source);
  49. byte[] hashValue = hashAlgorithm.ComputeHash(bytes);
  50. StringBuilder sb = new StringBuilder();
  51. switch (length)
  52. {
  53. case 16://16位密文是32位密文的9到24位字符
  54. for (int i = 4; i < 12; i++)
  55. {
  56. sb.Append(hashValue[i].ToString("x2"));
  57. }
  58. break;
  59. case 32:
  60. for (int i = 0; i < 16; i++)
  61. {
  62. sb.Append(hashValue[i].ToString("x2"));
  63. }
  64. break;
  65. default:
  66. for (int i = 0; i < hashValue.Length; i++)
  67. {
  68. sb.Append(hashValue[i].ToString("x2"));
  69. }
  70. break;
  71. }
  72. return sb.ToString();
  73. }
  74. #endregion
  75. #region jwt
  76. /// <summary>
  77. /// 获取token
  78. /// </summary>
  79. /// <param name="_config"></param>
  80. /// <param name="Number"></param>
  81. /// <param name="exp"></param>
  82. /// <returns></returns>
  83. public static async Task< string> GetToken(IConfiguration _config, string Number, int uId, string uName, DateTime exp)
  84. {
  85. string userId = Guid.NewGuid().ToString().Replace("-", "");
  86. var claims = new[] {
  87. new Claim(ClaimTypes.NameIdentifier, uName),
  88. new Claim(ClaimTypes.NameIdentifier, uId.ToString()),
  89. new Claim(ClaimTypes.NameIdentifier, userId),
  90. new Claim("Number",Number)
  91. };
  92. var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["JwtSecurityKey"]));
  93. var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
  94. var token = new JwtSecurityToken(
  95. issuer: "OASystem.com",
  96. audience: "OASystem.com",
  97. claims: claims,
  98. expires: exp,
  99. signingCredentials: creds);
  100. //var indentity = new ClaimsIdentity(claims, "formlogin");
  101. //var principal = new ClaimsPrincipal(indentity);
  102. // await _httpContext.SignInAsync (CookieAuthenticationDefaults.AuthenticationScheme, principal);
  103. return new JwtSecurityTokenHandler().WriteToken(token);
  104. }
  105. #endregion
  106. #region 数据类型转换
  107. /// <summary>
  108. /// object 转 Int
  109. /// </summary>
  110. /// <param name="obj"></param>
  111. /// <returns></returns>
  112. public static int GetInt(this object obj)
  113. {
  114. if (obj == null)
  115. return 0;
  116. int _number = 0;
  117. bool reslut = Int32.TryParse(obj.ToString(), out _number);
  118. return _number;
  119. }
  120. private static DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
  121. private static long longTime = 621355968000000000;
  122. private static int samllTime = 10000000;
  123. /// <summary>
  124. /// 时间戳 转 datetime
  125. /// </summary>
  126. /// <param name="timeStamp"></param>
  127. /// <returns></returns>
  128. public static DateTime GetTimeSpmpToDate(this object timeStamp)
  129. {
  130. if (timeStamp == null) return dateStart;
  131. DateTime dateTime = new DateTime(longTime + Convert.ToInt64(timeStamp) * samllTime, DateTimeKind.Utc).ToLocalTime();
  132. return dateTime;
  133. }
  134. #endregion
  135. #region 用户页面操作功能 权限
  136. /// <summary>
  137. /// 用户页面操作功能(可使用)
  138. /// </summary>
  139. /// <param name="userId">用户Id</param>
  140. /// <param name="PageId">页面Id</param>
  141. /// <returns></returns>
  142. public static async Task<PageFunAuthViewBase> PostUserPageFuncDatas(int userId,int PageId)
  143. {
  144. PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
  145. List<UserPageFuncView> userPageFuncDatas = new List<UserPageFuncView>();
  146. string sql = string.Format(@"Select ua.UId As UserId, u.CnName As UserName, pa.ModuleId,pa.ModuleName,pa.PageId,pa.PageName,pa.PageIsEnable,
  147. pa.PagePhoneIsEnable,pa.FuncId,pa.FuncName,pa.FuncIsEnable
  148. From Sys_UserAuthority ua
  149. Left Join Sys_Users u On ua.UId = u.Id
  150. Left Join (
  151. Select sd.Id As ModuleId,sd.Name As ModuleName, smp.Id As PageId,smp.Name As PageName,smp.IsEnable As PageIsEnable,
  152. smp.phoneIsEnable As PagePhoneIsEnable,pfp.Id As FuncId,pfp.FunctionName As FuncName,pfp.IsEnable As FuncIsEnable
  153. From Sys_SystemMenuAndFunction smaf
  154. Left Join Sys_SystemMenuPermission smp On smaf.SmId = smp.Id
  155. Left Join Sys_SetData sd On sd.STid = 5 And smp.Mid = sd.Id
  156. Left Join Sys_PageFunctionPermission pfp On smaf.FId = pfp.Id
  157. Where smaf.IsDel = 0 And smp.IsDel = 0 And pfp.IsDel = 0 And sd.IsDel = 0 And smp.IsEnable = 1
  158. ) As pa On ua.SmId = pa.PageId And ua.FId = pa.FuncId
  159. Where ua.IsDel = 0 And ua.UId = {0} And pa.PageId = {1}
  160. Order By ModuleId,PageId,FuncId Asc", userId, PageId);
  161. userPageFuncDatas = await _dirRep._sqlSugar.SqlQueryable<UserPageFuncView>(sql).ToListAsync();
  162. if (userPageFuncDatas.Count <= 0)
  163. {
  164. return pageFunAuth;
  165. }
  166. UserPageFuncView userPageFunc = new UserPageFuncView();
  167. //查询 1
  168. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 1).FirstOrDefault();
  169. if (userPageFunc != null) pageFunAuth.CheckAuth = 1;
  170. //删除 2
  171. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 2).FirstOrDefault();
  172. if (userPageFunc != null) pageFunAuth.DeleteAuth = 1;
  173. //编辑 3
  174. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 3).FirstOrDefault();
  175. if (userPageFunc != null) pageFunAuth.EditAuth = 1;
  176. //下载 4
  177. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 4).FirstOrDefault();
  178. if (userPageFunc != null) pageFunAuth.FilesDownloadAuth = 1;
  179. //上传 5
  180. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 5).FirstOrDefault();
  181. if (userPageFunc != null) pageFunAuth.FilesUploadAuth = 1;
  182. //添加 11
  183. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 11).FirstOrDefault();
  184. if (userPageFunc != null) pageFunAuth.AddAuth = 1;
  185. //审核 12
  186. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 12).FirstOrDefault();
  187. if (userPageFunc != null) pageFunAuth.AuditAuth = 1;
  188. return pageFunAuth;
  189. }
  190. #endregion
  191. #region 业务模块 团组权限
  192. /// <summary>
  193. /// 业务模块 团组操作权限
  194. /// 验证
  195. /// </summary>
  196. /// <param name="diId">团组Id</param>
  197. /// <param name="userId">用户Id</param>
  198. /// <param name="CTable">业务模块Id</param>
  199. /// <returns></returns>
  200. public static async Task<Result> PostGroupOperationAuth(int diId, int userId, int CTable )
  201. {
  202. Result _result = new Result { Code = -1,Msg = "No Operation Authorty!" };
  203. if (CTable < 1)
  204. {
  205. _result.Msg = "请填写正确的用户Id!";
  206. return _result;
  207. }
  208. var data = await _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(it => it.DIId == diId && it.UId == userId && it.CTId == CTable && it.IsDel == 0).FirstAsync();
  209. if (data == null)
  210. {
  211. _result.Msg = "你没有本团下的该业务模块操作,请联系主管分配操作权限!";
  212. }
  213. else
  214. {
  215. _result.Code = 0;
  216. }
  217. return _result;
  218. }
  219. #endregion
  220. #region 团组相关
  221. #region 建团按国家默认添加汇率 / 默认权限分配
  222. /// <summary>
  223. /// 团组汇率
  224. /// 建团时 添加基础汇率 CNY
  225. /// 按国家 添加 默认币种
  226. /// </summary>
  227. /// <param name="userId"></param>
  228. /// <param name="diId"></param>
  229. /// <returns></returns>
  230. public static async Task<Result> PostGroupRateAddInit(int userId, int diId)
  231. {
  232. Result result = new() { Code = -2 };
  233. if (userId < 0)
  234. {
  235. result.Msg = string.Format(@"请传入正确的userId");
  236. return result;
  237. }
  238. if (diId < 0)
  239. {
  240. result.Msg = string.Format(@"请传入正确的DiId");
  241. return result;
  242. }
  243. //美元(USD):1.0000|欧元(EUR):1.0000|墨西哥比索(MXN):1.0000
  244. string CNYInit = string.Format(@"人名币(CNY):1.0000");
  245. var gropInfo = await _dirRep._sqlSugar.Queryable<Grp_DelegationInfo>().Where( it => it.IsDel == 0 && it.Id == diId).FirstAsync();
  246. if (gropInfo != null)
  247. {
  248. if (!string.IsNullOrEmpty(gropInfo.VisitCountry))
  249. {
  250. var countryCueencyCodes = await _setDataRep.GetSetDataBySTId(_setDataRep, 66);
  251. string countrys = gropInfo.VisitCountry;
  252. string[] countryItems = new string[] { };
  253. if (countrys.Contains("|"))
  254. {
  255. countryItems = countrys.Split('|');
  256. }
  257. else
  258. {
  259. countryItems = new string[] { countrys };
  260. }
  261. var countryInfos = await _dirRep._sqlSugar.Queryable<Dis_Country>().Where(it => it.IsDel == 0).ToListAsync();
  262. List<string> currencyCodes = new List<string>();
  263. if (countryItems.Length > 0)
  264. {
  265. foreach (var item in countryItems)
  266. {
  267. Dis_Country country = new Dis_Country();
  268. country = countryInfos.Where(it => it.CnShortName.Equals(item)).FirstOrDefault();
  269. if (country != null)
  270. {
  271. if (!item.Equals("中国"))
  272. {
  273. currencyCodes.Add(country.CurrencyCode);
  274. }
  275. }
  276. }
  277. }
  278. if (currencyCodes.Count > 0)
  279. {
  280. List<ExchangeRateModel> exchangeRateModels = await _juHeApiService.PostItemRateAsync(currencyCodes.ToArray());
  281. if (exchangeRateModels.Count > 0)
  282. {
  283. var codes = await _dirRep._sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.IsDel == 0).ToListAsync();
  284. for (int i = 0; i < exchangeRateModels.Count; i++)
  285. {
  286. string currencyName = exchangeRateModels[i].Name;
  287. string code = "";
  288. var currencyData = codes.Where(it => it.IsDel == 0 && it.Remark == currencyName).FirstOrDefault();
  289. if (currencyData != null) {
  290. code = currencyData.Name;
  291. CNYInit += string.Format(@"|{0}({1}):{2}", exchangeRateModels[i].Name, code, exchangeRateModels[i].MSellPri);
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. List<Grp_TeamRate> grp_TeamRates = new List<Grp_TeamRate>()
  299. {
  300. new Grp_TeamRate(){ DiId = diId,CTable = 76,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //76 酒店预订
  301. new Grp_TeamRate(){ DiId = diId,CTable = 77,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //77 行程
  302. new Grp_TeamRate(){ DiId = diId,CTable = 79,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //79 车/导游地接
  303. new Grp_TeamRate(){ DiId = diId,CTable = 80,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //80 签证
  304. new Grp_TeamRate(){ DiId = diId,CTable = 82,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //82 团组客户保险
  305. new Grp_TeamRate(){ DiId = diId,CTable = 85,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //85 机票预订
  306. new Grp_TeamRate(){ DiId = diId,CTable = 98,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //98 其他款项
  307. new Grp_TeamRate(){ DiId = diId,CTable = 285,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //285 收款退还
  308. new Grp_TeamRate(){ DiId = diId,CTable = 751,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //751 酒店早餐
  309. };
  310. var res = _teamRateRep._sqlSugar.Insertable(grp_TeamRates).ExecuteCommand();
  311. if (res < 0)
  312. {
  313. result.Msg = string.Format(@"添加失败!");
  314. return result;
  315. }
  316. result.Code = 0;
  317. result.Msg = string.Format(@"操作成功!");
  318. return result;
  319. }
  320. /// <summary>
  321. /// 团组汇率
  322. /// 建团时 默认按照岗位分配权限
  323. /// </summary>
  324. /// <param name="userId"></param>
  325. /// <param name="diId"></param>
  326. /// <param name="companyId"></param>
  327. /// <returns></returns>
  328. public static async Task<Result> PostGroupAuthAddInit(int userId, int diId, int companyId = 2)
  329. {
  330. Result result = new() { Code = -2 };
  331. if (userId < 0)
  332. {
  333. result.Msg = string.Format(@"请传入正确的userId");
  334. return result;
  335. }
  336. if (companyId < 0)
  337. {
  338. result.Msg = string.Format(@"请传入正确的companyId");
  339. return result;
  340. }
  341. if (diId < 0)
  342. {
  343. result.Msg = string.Format(@"请传入正确的DiId");
  344. return result;
  345. }
  346. //var depData = await _teamRateRep._sqlSugar.Queryable<Sys_Department>().Where(it => it.IsDel == 0 && it.CompanyId == companyId && it.DepName.Equals("国交部")).FirstAsync();
  347. //if (depData != null)
  348. //{
  349. // var userData = await _teamRateRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && it.CompanyId == companyId && it.DepId == depData.Id).ToListAsync();
  350. //}
  351. result.Code = 0;
  352. result.Msg = string.Format(@"操作成功!");
  353. return result;
  354. }
  355. #endregion
  356. #endregion
  357. #region 团组汇率
  358. /// <summary>
  359. /// 团组汇率
  360. /// 获取板块 币种 及 汇率
  361. /// 76 酒店预订 77 行程 79 车/导游地接
  362. /// 80 签证 82 团组客户保险 85 机票预订
  363. /// 98 其他款项 285 收款退还
  364. /// </summary>
  365. /// <param name="teamRateModels"></param>
  366. /// <param name="cTable"></param>
  367. /// <param name="currencyCode"></param>
  368. /// <returns>
  369. /// string
  370. /// eg: CNY 1.0000
  371. /// </returns>
  372. public static async Task<string> PostGroupRateByCTableAndCurrency(List<TeamRateModelView> teamRateModels,int cTable,List<string> currencyCodes)
  373. {
  374. string str = "";
  375. List<string> currencyRates = new List<string>();
  376. TeamRateModelView hotelRateData = teamRateModels.Where(it => it.CTableId == cTable).FirstOrDefault();
  377. if (hotelRateData != null)
  378. {
  379. var hotelRates = hotelRateData.TeamRates;
  380. foreach (var item in currencyCodes)
  381. {
  382. if (!string.IsNullOrEmpty(item))
  383. {
  384. var hotelRateInfo = hotelRates.Where(it => it.CurrencyCode.Equals(item)).FirstOrDefault();
  385. if (hotelRateInfo != null)
  386. {
  387. string str1 = string.Format("{0} {1}\r\n", hotelRateInfo.CurrencyCode, hotelRateInfo.Rate);
  388. currencyRates.Add(str1);
  389. }
  390. }
  391. }
  392. if (currencyRates != null || currencyRates.Count > 0)
  393. {
  394. currencyRates = currencyRates.Distinct().ToList();
  395. foreach (var item in currencyRates)
  396. {
  397. str += item;
  398. }
  399. }
  400. }
  401. return str;
  402. }
  403. #endregion
  404. #region 汉字转换拼音
  405. private static Dictionary<int, List<string>> GetTotalPingYinDictionary(string text)
  406. {
  407. var chs = text.ToCharArray();
  408. //记录每个汉字的全拼
  409. Dictionary<int, List<string>> totalPingYinList = new Dictionary<int, List<string>>();
  410. for (int i = 0; i < chs.Length; i++)
  411. {
  412. var pinyinList = new List<string>();
  413. //是否是有效的汉字
  414. if (ChineseChar.IsValidChar(chs[i]))
  415. {
  416. ChineseChar cc = new ChineseChar(chs[i]);
  417. pinyinList = cc.Pinyins.Where(p => !string.IsNullOrWhiteSpace(p)).ToList();
  418. }
  419. else
  420. {
  421. pinyinList.Add(chs[i].ToString());
  422. }
  423. //去除声调,转小写
  424. pinyinList = pinyinList.ConvertAll(p => Regex.Replace(p, @"\d", "").ToLower());
  425. //去重
  426. pinyinList = pinyinList.Where(p => !string.IsNullOrWhiteSpace(p)).Distinct().ToList();
  427. if (pinyinList.Any())
  428. {
  429. totalPingYinList[i] = pinyinList;
  430. }
  431. }
  432. return totalPingYinList;
  433. }
  434. /// <summary>
  435. /// 获取汉语拼音全拼
  436. /// </summary>
  437. /// <param name="text">The string.</param>
  438. /// <returns></returns>
  439. public static List<string> GetTotalPingYin(this string text)
  440. {
  441. var result = new List<string>();
  442. foreach (var pys in GetTotalPingYinDictionary(text))
  443. {
  444. var items = pys.Value;
  445. if (result.Count <= 0)
  446. {
  447. result = items;
  448. }
  449. else
  450. {
  451. //全拼循环匹配
  452. var newTotalPingYinList = new List<string>();
  453. foreach (var totalPingYin in result)
  454. {
  455. newTotalPingYinList.AddRange(items.Select(item => totalPingYin + item));
  456. }
  457. newTotalPingYinList = newTotalPingYinList.Distinct().ToList();
  458. result = newTotalPingYinList;
  459. }
  460. }
  461. return result;
  462. }
  463. /// <summary>
  464. /// 获取汉语拼音首字母
  465. /// </summary>
  466. /// <param name="text"></param>
  467. /// <returns></returns>
  468. public static List<string> GetFirstPingYin(this string text)
  469. {
  470. var result = new List<string>();
  471. foreach (var pys in GetTotalPingYinDictionary(text))
  472. {
  473. var items = pys.Value;
  474. if (result.Count <= 0)
  475. {
  476. result = items.ConvertAll(p => p.Substring(0, 1)).Distinct().ToList();
  477. }
  478. else
  479. {
  480. //首字母循环匹配
  481. var newFirstPingYinList = new List<string>();
  482. foreach (var firstPingYin in result)
  483. {
  484. newFirstPingYinList.AddRange(items.Select(item => firstPingYin + item.Substring(0, 1)));
  485. }
  486. newFirstPingYinList = newFirstPingYinList.Distinct().ToList();
  487. result = newFirstPingYinList;
  488. }
  489. }
  490. return result;
  491. }
  492. #endregion
  493. #region 新客户资料表 操作记录
  494. /// <summary>
  495. /// 新客户资料表
  496. /// 操作记录添加
  497. /// </summary>
  498. /// <param name="operationEnum"></param>
  499. /// <param name="userId"></param>
  500. /// <param name="dataId"></param>
  501. /// <param name="remark"></param>
  502. /// <returns></returns>
  503. public static async Task<bool> NewClientOperationRecordAdd(OperationEnum operationEnum,int userId,int dataId,string remark )
  504. {
  505. Crm_TableOperationRecord _TableOperationRecord = new Crm_TableOperationRecord()
  506. {
  507. TableName = "Crm_NewClientData",
  508. OperationItem = operationEnum,
  509. DataId = dataId,
  510. CreateUserId = userId,
  511. CreateTime = DateTime.Now,
  512. Remark = remark
  513. };
  514. bool add = await _tableOperationRecordRep._Add(_TableOperationRecord);
  515. if (add) return false;
  516. return false;
  517. }
  518. #endregion
  519. }
  520. }