CarTouristGuideGroundRepository.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. using AutoMapper;
  2. using OASystem.Domain;
  3. using OASystem.Domain.Dtos.Groups;
  4. using OASystem.Domain.Entities.Financial;
  5. using OASystem.Domain.Entities.Groups;
  6. using OASystem.Domain.Entities.Resource;
  7. using OASystem.Domain.ViewModels.Groups;
  8. using OASystem.Infrastructure.Tools;
  9. using System.Collections.Generic;
  10. namespace OASystem.Infrastructure.Repositories.Groups
  11. {
  12. public class CarTouristGuideGroundRepository:BaseRepository<Grp_CarTouristGuideGroundReservations, Grp_CarTouristGuideGroundReservationsContent>
  13. {
  14. private readonly IMapper _mapper;
  15. public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper)
  16. : base(sqlSugar)
  17. {
  18. _mapper = mapper;
  19. }
  20. public async Task<Result> OpCarTouristGuideGround(OpCarTouristGuideGroundDto dto)
  21. {
  22. Result result = new Result() { Code = -2, Msg = "未知错误" };
  23. BeginTran();
  24. try
  25. {
  26. int id = 0;
  27. Grp_CarTouristGuideGroundReservations grp_CarTouristGuide = _mapper.Map<Grp_CarTouristGuideGroundReservations>(dto);
  28. if (dto.Status == 1)//添加
  29. {
  30. Grp_CarTouristGuideGroundReservations grp_CarTouristGuideGround = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(a => a.IsDel == 0 && a.Area == dto.Area && a.BusName == dto.BusName && a.ServiceGuide == dto.ServiceGuide && a.DiId==dto.DiId && a.BusTel==dto.BusTel && a.ServiceTel==dto.ServiceTel);
  31. if (grp_CarTouristGuideGround != null)
  32. {
  33. return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
  34. }
  35. else
  36. {
  37. id = await AddAsyncReturnId(grp_CarTouristGuide);
  38. if (id == 0)
  39. {
  40. RollbackTran();
  41. result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
  42. }
  43. else
  44. {
  45. result = new Result() { Code = 0, Msg = "添加成功!" };
  46. }
  47. }
  48. }
  49. else if (dto.Status == 2)//修改
  50. {
  51. bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_CarTouristGuideGroundReservations
  52. {
  53. Area = grp_CarTouristGuide.Area,
  54. ServiceCompany = grp_CarTouristGuide.ServiceCompany,
  55. ServiceGuide = grp_CarTouristGuide.ServiceGuide,
  56. ServiceTel = grp_CarTouristGuide.ServiceTel,
  57. BusName = grp_CarTouristGuide.BusName,
  58. BusDescription = grp_CarTouristGuide.BusDescription,
  59. BusTel = grp_CarTouristGuide.BusTel,
  60. ServiceStartTime = grp_CarTouristGuide.ServiceStartTime,
  61. ServiceEndTime = grp_CarTouristGuide.ServiceEndTime,
  62. ServiceDescription = grp_CarTouristGuide.ServiceDescription,
  63. QuotedPriceExplanation = grp_CarTouristGuide.QuotedPriceExplanation,
  64. OrbitalPrivateTransfer = grp_CarTouristGuide.OrbitalPrivateTransfer,
  65. Remark = grp_CarTouristGuide.Remark,
  66. });
  67. if (res)
  68. {
  69. id = dto.Id;
  70. result = new Result() { Code = 0, Msg = "修改成功!" };
  71. }
  72. else
  73. {
  74. RollbackTran();
  75. result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
  76. }
  77. }
  78. if (id!=0)
  79. {
  80. Res_LocalGuideData _LocalGuideDataCar = _sqlSugar.Queryable<Res_LocalGuideData>().First(a => a.UnitName == dto.BusName && a.ContactTel == dto.BusTel && a.IsDel == 0);
  81. if (_LocalGuideDataCar == null)
  82. {
  83. Res_LocalGuideData res_LocalGuideCar = new Res_LocalGuideData();
  84. res_LocalGuideCar.UnitName = dto.BusName;
  85. res_LocalGuideCar.ContactTel = dto.BusTel;
  86. res_LocalGuideCar.CreateUserId = dto.CreateUserId;
  87. int cId = await _sqlSugar.Insertable(res_LocalGuideCar).ExecuteReturnIdentityAsync();
  88. }
  89. Res_LocalGuideData _LocalGuideDataService = _sqlSugar.Queryable<Res_LocalGuideData>().First(a => a.UnitName == dto.ServiceCompany && a.ContactTel == dto.ServiceTel && a.IsDel == 0);
  90. if (_LocalGuideDataService == null)
  91. {
  92. Res_LocalGuideData res_LocalGuideService = new Res_LocalGuideData();
  93. res_LocalGuideService.UnitName = dto.ServiceCompany;
  94. res_LocalGuideService.ContactTel = dto.ServiceTel;
  95. res_LocalGuideService.Contact = dto.ServiceTel;
  96. res_LocalGuideService.CreateUserId = dto.CreateUserId;
  97. int cId = await _sqlSugar.Insertable(res_LocalGuideService).ExecuteReturnIdentityAsync();
  98. }
  99. }
  100. CommitTran();
  101. }
  102. catch (Exception ex)
  103. {
  104. result = new Result() { Code = -2, Msg = "未知错误" };
  105. }
  106. return result;
  107. }
  108. public async Task<Result> CarTouristGuideGroundContent(CarTouristGuideGroundContentDto dto)
  109. {
  110. Result result = new Result() { Code = -2, Msg = "未知错误" };
  111. try
  112. {
  113. List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 79).ToList();
  114. string DiId = "0";
  115. foreach (var item in grp_GroupsTaskAssignment)
  116. {
  117. DiId += item.DIId + ",";
  118. }
  119. if (DiId != "0")
  120. {
  121. DiId = DiId.Substring(0, DiId.Length - 1);
  122. }
  123. string sql = string.Format(@"select * from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
  124. //团组下拉框
  125. List<Grp_DelegationInfo> _Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
  126. List<ShareGroupInfoIIView> grp_Delegations = _mapper.Map<List<ShareGroupInfoIIView>>(_Delegations);
  127. //支付方式
  128. List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
  129. List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
  130. //币种
  131. List<Sys_SetData> CurrencyList = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 66 && a.IsDel == 0).ToList();
  132. List<SetDataInfoView> _CurrencyList = _mapper.Map<List<SetDataInfoView>>(CurrencyList);
  133. //列表初始化
  134. List<Sys_SetData> TableInitialization = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 17 && a.IsDel == 0).ToList();
  135. List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
  136. _TableInitialization= _TableInitialization.OrderBy(a=>a.Name).ToList();
  137. var data = new
  138. {
  139. Payment = _Payment,
  140. CurrencyList = _CurrencyList,
  141. Delegations = grp_Delegations,
  142. TableInitialization = _TableInitialization
  143. };
  144. return result = new Result() { Code = 0, Msg = "查询成功",Data=data };
  145. }
  146. catch (Exception)
  147. {
  148. return result = new Result() { Code = -2, Msg = "未知错误" };
  149. throw;
  150. }
  151. }
  152. public async Task<Result> OpCarTouristGuideGroundContentById(CarTouristGuideGroundIdDto dto)
  153. {
  154. Result result = new Result() { Code = -2, Msg = "未知错误" };
  155. try
  156. {
  157. List<Grp_CarTouristGuideGroundReservationsContent> grp_CarTouristsContent = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a=>a.IsDel==0 && a.CTGGRId==dto.Id).ToList();
  158. List<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
  159. foreach (var item in carTouristGuides)
  160. {
  161. item.SidName= _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == item.SId).Name;
  162. }
  163. Grp_CreditCardPayment CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
  164. CarTouristCreditCardPaymentView _CreditCardPayment = _mapper.Map<CarTouristCreditCardPaymentView>(CreditCardPayment);
  165. if (_CreditCardPayment!=null)
  166. {
  167. _CreditCardPayment.PayName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PayDId).Name;
  168. _CreditCardPayment.PaymentCurrencyName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PaymentCurrency).Name;
  169. if (_CreditCardPayment.OrbitalPrivateTransfer==0) _CreditCardPayment.OrbitalPrivateTransferStr = "公转";
  170. else _CreditCardPayment.OrbitalPrivateTransferStr = "私转";
  171. }
  172. var data = new
  173. {
  174. CarTouristsContent = carTouristGuides,
  175. CreditCardPayment = _CreditCardPayment,
  176. };
  177. return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
  178. }
  179. catch (Exception)
  180. {
  181. return result = new Result() { Code = -2, Msg = "未知错误" };
  182. throw;
  183. }
  184. }
  185. /// <summary>
  186. /// 根据diid查询op费用列表
  187. /// </summary>
  188. /// <param name="dto"></param>
  189. /// <returns></returns>
  190. public async Task<Result> QueryCarTouristGuideGroundByDiId(CarTouristGuideGroundDto dto)
  191. {
  192. Result result = new Result() { Code = -2, Msg = "未知错误" };
  193. if (dto.PortType == 0 || string.IsNullOrWhiteSpace(dto.PortType.ToString()))
  194. {
  195. return result = new Result() { Code = -1, Msg = "请传入PortType参数,请求端口分类 1 Web 2 Android 3 IOS" };
  196. }
  197. try
  198. {
  199. #region SQL条件拼接
  200. string sqlWhere = string.Empty;
  201. sqlWhere += string.Format(@"And t.DIId={0} and t.isdel={1}", dto.DiId, 0);
  202. string UserId = "";
  203. List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 79).ToList();
  204. foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
  205. UserId += gta.UId + ",";
  206. if (!string.IsNullOrWhiteSpace(UserId))
  207. {
  208. UserId = UserId.Substring(0, UserId.Length - 1);
  209. }
  210. else
  211. {
  212. UserId = "0";
  213. }
  214. sqlWhere += string.Format(@" And t.CreateUserId in ({0})", UserId);
  215. if (!string.IsNullOrEmpty(sqlWhere.Trim()))
  216. {
  217. Regex r = new Regex("And");
  218. sqlWhere = r.Replace(sqlWhere, "Where", 1);
  219. }
  220. #endregion
  221. int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
  222. int endIndex = startIndex + dto.PageSize - 1;
  223. if (dto.PortType == 1)
  224. {
  225. string sql = string.Format(@"select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage,c.PayMoney,c.PayDid from
  226. Grp_CarTouristGuideGroundReservations t
  227. left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id and c.isdel=0
  228. left Join Sys_SetData s on s.Id=c.PaymentCurrency {0}
  229. order by c.IsAuditGM,c.PayPercentage desc", sqlWhere);
  230. List<Grp_CarTouristGuideGroundView> infoViews = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
  231. foreach (var item in infoViews)
  232. {
  233. item.ServiceQuotedPrice = item.PayMoney;
  234. item.PayThenMoney = Math.Round(item.PayPercentage/100 * item.ServiceQuotedPrice, 2);
  235. item.RemainingBalance = Math.Round(item.ServiceQuotedPrice- item.PayPercentage / 100 * item.ServiceQuotedPrice);
  236. Sys_SetData s = _sqlSugar.Queryable<Sys_SetData>().First(a=>a.IsDel==0 && a.Id==item.PayDid);
  237. if (s!=null)
  238. {
  239. item.PayStrd = s.Name;
  240. }
  241. }
  242. return result = new Result() { Code = 0, Msg = "查询成功!", Data = infoViews };
  243. }
  244. else if (dto.PortType == 2 || dto.PortType == 3)
  245. {
  246. string sql = string.Format(@"Select * From (
  247. Select row_number() over (order by c.IsAuditGM,c.PayPercentage desc) as RowNumber,t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage,c.PayDid
  248. from
  249. Grp_CarTouristGuideGroundReservations t
  250. Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id and c.isdel=0
  251. left Join Sys_SetData s on s.Id=c.PaymentCurrency {0}
  252. ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
  253. List<Grp_CarTouristGuideGroundView> grp_CarTourists = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
  254. foreach (var item in grp_CarTourists)
  255. {
  256. item.ServiceQuotedPrice = item.PayMoney;
  257. item.PayThenMoney = Math.Round(item.PayPercentage / 100 * item.ServiceQuotedPrice, 2);
  258. item.RemainingBalance = Math.Round(item.ServiceQuotedPrice - item.PayPercentage / 100 * item.ServiceQuotedPrice);
  259. Sys_SetData s = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == item.PayDid);
  260. if (s != null)
  261. {
  262. item.PayStrd = s.Name;
  263. }
  264. }
  265. string CountSql = string.Format(@"Select COUNT(1) as Count From (
  266. select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage from
  267. Grp_CarTouristGuideGroundReservations t
  268. Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id and c.isdel=0
  269. left Join Sys_SetData s on s.Id=t.CId {0}
  270. ) temp ", sqlWhere);
  271. DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
  272. if (dataCount != null)
  273. {
  274. int count = dataCount.Count;
  275. float totalPage = (float)count / dto.PageSize;//总页数
  276. if (totalPage == 0) totalPage = 1;
  277. else totalPage = (int)Math.Ceiling((double)totalPage);
  278. ListViewBase<Grp_CarTouristGuideGroundView> rst = new ListViewBase<Grp_CarTouristGuideGroundView>();
  279. rst.DataList = grp_CarTourists;
  280. rst.DataCount = count;
  281. rst.CurrPageIndex = dto.PageIndex;
  282. rst.CurrPageSize = dto.PageSize;
  283. return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
  284. }
  285. }
  286. }
  287. catch (Exception)
  288. {
  289. return result = new Result() { Code = -2, Msg = "未知错误" };
  290. throw;
  291. }
  292. return result;
  293. }
  294. /// <summary>
  295. /// OP费用录入填写详情
  296. /// </summary>
  297. /// <param name="dto"></param>
  298. /// <returns></returns>
  299. public async Task<Result> OpCarTouristGuideGroundContent(OpCarTouristGuideGroundContentDto dto)
  300. {
  301. Result result = new Result() { Code = -2, Msg = "未知错误" };
  302. try
  303. {
  304. BeginTran();
  305. List<Grp_CarTouristGuideGroundReservationsContent> carTouristList = new List<Grp_CarTouristGuideGroundReservationsContent>();
  306. foreach (var item in dto.OPContentList)
  307. {
  308. Grp_CarTouristGuideGroundReservationsContent s = new Grp_CarTouristGuideGroundReservationsContent();
  309. s.Id= item.Id;
  310. s.DiId = dto.DiId;
  311. s.CTGGRId = dto.CTGGRId;
  312. s.SId = item.SId;
  313. s.Price=item.Price;
  314. s.PriceContent = item.priceContent;
  315. s.Currency = dto.Currency;
  316. //s.Remark=item.Remark;
  317. s.CreateUserId = dto.CreateUserId;
  318. carTouristList.Add(s);
  319. }
  320. foreach (var item in carTouristList)
  321. {
  322. Grp_CarTouristGuideGroundReservationsContent QueryData = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().First(a => a.SId == item.SId && a.Id == item.Id && a.DiId == item.DiId && a.IsDel==0);
  323. if (QueryData==null)
  324. {
  325. if (item.Price!=0)
  326. {
  327. int id = await _sqlSugar.Insertable(item).ExecuteReturnIdentityAsync();
  328. if (id == 0)
  329. {
  330. RollbackTran();
  331. return result = new Result() { Code = -2, Msg = "添加失败" };
  332. }
  333. }
  334. }
  335. else
  336. {
  337. int CTable = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservationsContent>().Where(a => a.Id == item.Id).SetColumns(a => new Grp_CarTouristGuideGroundReservationsContent
  338. {
  339. Price = item.Price,
  340. PriceContent = item.PriceContent,
  341. Currency = dto.Currency,
  342. Remark = item.Remark,
  343. }).ExecuteCommandAsync();
  344. if (CTable==0)
  345. {
  346. RollbackTran();
  347. return result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
  348. }
  349. }
  350. }
  351. //修改C表数据
  352. List<Grp_CarTouristGuideGroundReservationsContent> carTouristListEnd = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a=>a.DiId==dto.DiId && a.CTGGRId==dto.CTGGRId && a.IsDel==0).ToList();
  353. Grp_CreditCardPayment c=new Grp_CreditCardPayment();
  354. c.PaymentCurrency = dto.Currency;
  355. foreach (var item in carTouristListEnd)
  356. {
  357. c.PayMoney += item.Price;
  358. }
  359. c.PayPercentage = dto.PayPercentage;
  360. c.ConsumptionDate= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  361. c.CTable = 79;
  362. c.CId = dto.CTGGRId;
  363. c.IsAuditGM = 0;
  364. c.PayDId=dto.PayDId;
  365. c.DIId = dto.DiId;
  366. c.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
  367. c.Payee=dto.Payee;
  368. c.CreateUserId=dto.CreateUserId;
  369. if (c.PayDId == 72)
  370. {
  371. c.IsPay = 1;
  372. }
  373. c.RMBPrice = c.PayMoney;
  374. c.DayRate = 1;
  375. Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 79);
  376. List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
  377. if (_TeamRate != null)
  378. {
  379. Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
  380. if (_SetData != null)
  381. {
  382. currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
  383. CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
  384. if (CurrencyRate != null)
  385. {
  386. c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
  387. c.DayRate = CurrencyRate.Rate;
  388. }
  389. }
  390. }
  391. Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a=>a.CId==dto.CTGGRId && a.IsDel==0 && a.CTable==79 && a.DIId==dto.DiId);
  392. if (grp_CreditCard!=null)//修改
  393. {
  394. int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.CTGGRId && a.CTable == 79 && a.DIId==dto.DiId).SetColumns(a => new Grp_CreditCardPayment
  395. {
  396. PaymentCurrency = c.PaymentCurrency,
  397. PayMoney = c.PayMoney,
  398. PayPercentage = c.PayPercentage,
  399. CTable = c.CTable,
  400. PayDId = c.PayDId,
  401. OrbitalPrivateTransfer = c.OrbitalPrivateTransfer,
  402. Payee = c.Payee,
  403. IsPay = c.IsPay,
  404. RMBPrice = c.RMBPrice,
  405. DayRate = c.DayRate,
  406. }).ExecuteCommandAsync();
  407. if (CTable == 0)
  408. {
  409. RollbackTran();
  410. return result = new Result() { Code = -2, Msg = "修改失败" };
  411. }
  412. }
  413. else//添加
  414. {
  415. int id = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
  416. if (id == 0)
  417. {
  418. RollbackTran();
  419. return result = new Result() { Code = -2, Msg = "添加失败" };
  420. }
  421. }
  422. int CarTouristGuideCTable = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>().Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId).SetColumns(a => new Grp_CarTouristGuideGroundReservations
  423. {
  424. CId=dto.Currency,
  425. ServiceQuotedPrice=c.PayMoney,
  426. OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
  427. }).ExecuteCommandAsync();
  428. if (CarTouristGuideCTable == 0)
  429. {
  430. RollbackTran();
  431. return result = new Result() { Code = -2, Msg = "修改失败" };
  432. }
  433. result = new Result() { Code =0, Msg = "保存成功" };
  434. CommitTran();
  435. }
  436. catch (Exception)
  437. {
  438. return result = new Result() { Code = -2, Msg = "未知错误" };
  439. throw;
  440. }
  441. return result;
  442. }
  443. }
  444. }