You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1955 lines
75 KiB

  1. using Dapper;
  2. using Learun.Application.Base.AuthorizeModule;
  3. using Learun.Application.Base.SystemModule;
  4. using Learun.Application.Organization;
  5. using Learun.Application.TwoDevelopment.LogisticsManagement;
  6. using Learun.DataBase.Repository;
  7. using Learun.Util;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Text;
  14. namespace Learun.Application.TwoDevelopment.EducationalAdministration
  15. {
  16. /// <summary>
  17. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  18. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  19. /// 创 建:超级管理员
  20. /// 日 期:2019-08-08 17:21
  21. /// 描 述:新生信息管理
  22. /// </summary>
  23. public class StuInfoFreshService : RepositoryFactory
  24. {
  25. #region 构造函数和属性
  26. private string fieldSql;
  27. public StuInfoFreshService()
  28. {
  29. fieldSql = @" * ";
  30. }
  31. #endregion
  32. #region 获取数据
  33. /// <summary>
  34. /// 获取列表数据
  35. /// <summary>
  36. /// <returns></returns>
  37. public void SynchronousList()
  38. {
  39. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  40. try
  41. {
  42. List<StuInfoFreshEntity> ListStuInfo = new List<StuInfoFreshEntity>();
  43. List<StuInfoFreshEntity> Model = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>().ToList();
  44. if (Model != null)
  45. {
  46. for (int i = 0; i < Model.Count(); i++)
  47. {
  48. //var IspayList = this.BaseRepository("IsPay").ExecuteBySql($" select * from View_JFdd WHERE XH ='{Model[i].StuNo}' ").ToString().ToList();
  49. //if (IspayList.Count > 0)
  50. //{
  51. // Model[i].PayFeeStatus = "1";
  52. // ListStuInfo.Add(Model[i]);
  53. //}
  54. var IspayList = this.BaseRepository("IsPay").FindTable($" select * from View_JFdd WHERE XH ='{Model[i].StuNo}' ");
  55. if (IspayList.Rows.Count > 0)
  56. {
  57. Model[i].PayFeeStatus = "1";
  58. ListStuInfo.Add(Model[i]);
  59. }
  60. else
  61. {
  62. Model[i].PayFeeStatus = "0";
  63. ListStuInfo.Add(Model[i]);
  64. }
  65. }
  66. this.BaseRepository("CollegeMIS").Update(ListStuInfo);
  67. }
  68. db.Commit();
  69. }
  70. catch (Exception ex)
  71. {
  72. db.Rollback();
  73. if (ex is ExceptionEx)
  74. {
  75. throw;
  76. }
  77. else
  78. {
  79. throw ExceptionEx.ThrowServiceException(ex);
  80. }
  81. }
  82. }
  83. /// <summary>
  84. /// 获取列表数据
  85. /// <summary>
  86. /// <returns></returns>
  87. public IEnumerable<StuInfoFreshEntity> GetList(string queryJson)
  88. {
  89. try
  90. {
  91. //参考写法
  92. var queryParam = queryJson.ToJObject();
  93. //虚拟参数
  94. var dp = new DynamicParameters(new { });
  95. var strSql = new StringBuilder();
  96. strSql.Append("SELECT t.*,d.DeptName,m.MajorName,c.ClassName,b.Name as Bed,r.Name as Room,f.Name as floor,u.Name as Unit,build.Name as Build ");
  97. strSql.Append(" FROM StuInfoFresh t ");
  98. strSql.Append(" left join CdDept d on t.DeptNo=d.DeptNo ");
  99. strSql.Append(" left join CdMajor m on t.MajorNo=m.MajorNo ");
  100. strSql.Append(" left join ClassInfo c on t.ClassNo=c.ClassNo ");
  101. strSql.Append(" left join Acc_DormitoryBuild b on t.DormitoryNo=b.ID ");
  102. strSql.Append(" left join Acc_DormitoryBuild r on b.ParentID=r.ID ");
  103. strSql.Append(" left join Acc_DormitoryBuild f on r.ParentID=f.ID ");
  104. strSql.Append(" left join Acc_DormitoryBuild u on f.ParentID=u.ID ");
  105. strSql.Append(" left join Acc_DormitoryBuild build on u.ParentID=build.ID ");
  106. strSql.Append(" where 1=1 ");
  107. if (!queryParam["DeptNo"].IsEmpty())
  108. {
  109. strSql.Append(" and t.DeptNo = @DeptNo ");
  110. dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
  111. }
  112. if (!queryParam["MajorNo"].IsEmpty())
  113. {
  114. strSql.Append(" and t.MajorNo = @MajorNo ");
  115. dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
  116. }
  117. if (!queryParam["ClassNo"].IsEmpty())
  118. {
  119. strSql.Append(" and t.ClassNo = @ClassNo ");
  120. dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String);
  121. }
  122. if (!queryParam["Grade"].IsEmpty())
  123. {
  124. strSql.Append(" and t.Grade = @Grade ");
  125. dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String);
  126. }
  127. var data = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>(strSql.ToString(), dp);
  128. return data;
  129. }
  130. catch (Exception ex)
  131. {
  132. if (ex is ExceptionEx)
  133. {
  134. throw;
  135. }
  136. else
  137. {
  138. throw ExceptionEx.ThrowServiceException(ex);
  139. }
  140. }
  141. }
  142. /// <summary>
  143. /// 获取列表数据
  144. /// <summary>
  145. /// <returns></returns>
  146. public IEnumerable<StuInfoFreshEntity> GetList2(string queryJson)
  147. {
  148. try
  149. {
  150. //参考写法
  151. var queryParam = queryJson.ToJObject();
  152. //虚拟参数
  153. var dp = new DynamicParameters(new { });
  154. var strSql = new StringBuilder();
  155. strSql.Append("SELECT t.*,d.DeptName,m.MajorName,c.ClassName ");
  156. strSql.Append(" FROM StuInfoFresh t ");
  157. strSql.Append(" left join CdDept d on t.DeptNo=d.DeptNo ");
  158. strSql.Append(" left join CdMajor m on t.MajorNo=m.MajorNo ");
  159. strSql.Append(" left join ClassInfo c on t.ClassNo=c.ClassNo ");
  160. strSql.Append(" where 1=1 ");
  161. if (!queryParam["DeptNo"].IsEmpty())
  162. {
  163. strSql.Append(" and t.DeptNo = @DeptNo ");
  164. dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
  165. }
  166. if (!queryParam["MajorNo"].IsEmpty())
  167. {
  168. strSql.Append(" and t.MajorNo = @MajorNo ");
  169. dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
  170. }
  171. if (!queryParam["ClassNo"].IsEmpty())
  172. {
  173. strSql.Append(" and t.ClassNo = @ClassNo ");
  174. dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String);
  175. }
  176. if (!queryParam["Grade"].IsEmpty())
  177. {
  178. strSql.Append(" and t.Grade = @Grade ");
  179. dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String);
  180. }
  181. var data = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>(strSql.ToString(), dp);
  182. foreach (var item in data)
  183. {
  184. var familyList = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshFamilyEntity>(x => x.StuInfoFreshId == item.ID);
  185. if (familyList.Any())
  186. {
  187. item.IsStudentEdit = true;
  188. }
  189. else
  190. {
  191. item.IsStudentEdit = false;
  192. }
  193. if (item.Province != "650000")
  194. {
  195. item.City = "";
  196. }
  197. }
  198. return data;
  199. }
  200. catch (Exception ex)
  201. {
  202. if (ex is ExceptionEx)
  203. {
  204. throw;
  205. }
  206. else
  207. {
  208. throw ExceptionEx.ThrowServiceException(ex);
  209. }
  210. }
  211. }
  212. /// <summary>
  213. /// 获取列表分页数据
  214. /// <param name="pagination">分页参数</param>
  215. /// <summary>
  216. /// <returns></returns>
  217. public IEnumerable<StuInfoFreshEntity> GetPageList(Pagination pagination, string queryJson)
  218. {
  219. try
  220. {
  221. var strSql = new StringBuilder();
  222. strSql.Append("SELECT t.*,c.ClassName,c.ClassDiredctorNo,c.ClassTutorNo,b.Name as Bed,r.Name as Room,f.Name as floor,u.Name as Unit,build.Name as Build FROM StuInfoFresh t left join ClassInfo c on t.ClassNo=c.ClassNo ");
  223. strSql.Append(" left join Acc_DormitoryBuild b on t.DormitoryNo=b.ID ");
  224. strSql.Append(" left join Acc_DormitoryBuild r on b.ParentID=r.ID ");
  225. strSql.Append(" left join Acc_DormitoryBuild f on r.ParentID=f.ID ");
  226. strSql.Append(" left join Acc_DormitoryBuild u on f.ParentID=u.ID ");
  227. strSql.Append(" left join Acc_DormitoryBuild build on u.ParentID=build.ID ");
  228. strSql.Append(" where 1=1 ");
  229. var queryParam = queryJson.ToJObject();
  230. var dp = new DynamicParameters(new { });
  231. if (!queryParam["keyword"].IsEmpty())
  232. {
  233. strSql.Append(" and (t.ksh like @keyword or t.zkzh like @keyword or t.StuName like @keyword or t.IdentityCardNo like @keyword )");
  234. dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String);
  235. }
  236. if (!queryParam["StuNo"].IsEmpty())
  237. {
  238. strSql.Append(" and t.StuNo = @StuNo ");
  239. dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String);
  240. }
  241. if (!queryParam["StuName"].IsEmpty())
  242. {
  243. strSql.Append(" and t.StuName like @StuName ");
  244. dp.Add("StuName", '%' + queryParam["StuName"].ToString() + '%', DbType.String);
  245. }
  246. if (!queryParam["Grade"].IsEmpty())
  247. {
  248. strSql.Append(" and t.Grade like @Grade ");
  249. dp.Add("Grade", '%' + queryParam["Grade"].ToString() + '%', DbType.String);
  250. }
  251. //分配班级
  252. if (!queryParam["MajorNo"].IsEmpty())
  253. {
  254. strSql.Append(" and t.MajorNo = @MajorNo ");
  255. dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
  256. }
  257. if (!queryParam["EducationalSystem"].IsEmpty())
  258. {
  259. strSql.Append(" and t.EducationalSystem = @EducationalSystem ");
  260. dp.Add("EducationalSystem", queryParam["EducationalSystem"].ToString(), DbType.String);
  261. }
  262. if (!queryParam["IDCard"].IsEmpty())
  263. {
  264. strSql.Append(" and t.IdentityCardNo like @IDCard ");
  265. dp.Add("IDCard", '%' + queryParam["IDCard"].ToString() + '%', DbType.String);
  266. }
  267. if (!queryParam["IsAllocation"].IsEmpty())
  268. {
  269. var IsAllocation = Convert.ToBoolean(queryParam["IsAllocation"].ToString());
  270. if (IsAllocation)//未分配
  271. {
  272. strSql.Append(" AND (t.ClassNo IS NULL OR t.ClassNo='') ");
  273. }
  274. else
  275. {
  276. strSql.Append(" AND (t.ClassNo IS NOT NULL AND t.ClassNo<>'') ");
  277. }
  278. }
  279. //分配床位
  280. if (!queryParam["ClassNo"].IsEmpty())
  281. {
  282. strSql.Append(" and t.ClassNo = @ClassNo ");
  283. dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String);
  284. }
  285. //完善信息
  286. if (!queryParam["PerfectStatus"].IsEmpty())
  287. {
  288. if (queryParam["PerfectStatus"].ToString() == "1")
  289. {
  290. strSql.Append(" AND t.ID in (select StuInfoFreshId from StuInfoFreshFamily) ");
  291. }
  292. else
  293. {
  294. strSql.Append(" AND t.ID not in (select StuInfoFreshId from StuInfoFreshFamily) ");
  295. }
  296. }
  297. //报到状态
  298. if (!queryParam["RegisterStatus"].IsEmpty())
  299. {
  300. if (queryParam["RegisterStatus"].ToString() == "1")
  301. {
  302. strSql.Append(" AND t.RegisterStatus = @RegisterStatus ");
  303. }
  304. else
  305. {
  306. strSql.Append(" AND (t.RegisterStatus <> 1 or t.RegisterStatus is null)");
  307. }
  308. dp.Add("RegisterStatus", queryParam["RegisterStatus"].ToString(), DbType.String);
  309. }
  310. //缴费状态
  311. if (!queryParam["PayStatus"].IsEmpty())
  312. {
  313. if (queryParam["PayStatus"].ToString() == "1")
  314. {
  315. strSql.Append(" AND t.PayFeeStatus = @PayFeeStatus ");
  316. }
  317. else
  318. {
  319. strSql.Append(" AND (t.PayFeeStatus <> 1 or t.PayFeeStatus is null)");
  320. }
  321. dp.Add("PayFeeStatus", queryParam["PayStatus"].ToString(), DbType.String);
  322. }
  323. //领取状态
  324. if (!queryParam["GetKeyStatus"].IsEmpty())
  325. {
  326. if (queryParam["GetKeyStatus"].ToString() == "1")
  327. {
  328. strSql.Append(" AND t.GetKeyStatus = @GetKeyStatus ");
  329. }
  330. else
  331. {
  332. strSql.Append(" AND (t.GetKeyStatus <> 1 or t.GetKeyStatus is null)");
  333. }
  334. dp.Add("GetKeyStatus", queryParam["GetKeyStatus"].ToString(), DbType.String);
  335. }
  336. if (!queryParam["Gender"].IsEmpty())
  337. {
  338. if (queryParam["Gender"].ToString() == "1")
  339. {
  340. strSql.Append(" AND t.GenderNo = @Gender ");
  341. }
  342. else
  343. {
  344. strSql.Append(" AND t.GenderNo <> 1 ");
  345. }
  346. dp.Add("Gender", queryParam["Gender"].ToString(), DbType.String);
  347. }
  348. if (!queryParam["IsAllocationDormitory"].IsEmpty())
  349. {
  350. var IsAllocation = Convert.ToBoolean(queryParam["IsAllocationDormitory"].ToString());
  351. if (IsAllocation)
  352. {
  353. strSql.Append(" AND (t.DormitoryNo IS NULL OR t.DormitoryNo='')");
  354. }
  355. else
  356. {
  357. strSql.Append(" AND (t.DormitoryNo IS NOT NULL AND t.DormitoryNo<>'')");
  358. }
  359. }
  360. //班主任/辅导员
  361. if (!queryParam["EmpNo"].IsEmpty())
  362. {
  363. strSql.Append(" and (c.ClassDiredctorNo = @EmpNo or c.ClassTutorNo = @EmpNo) ");
  364. dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String);
  365. }
  366. return this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>(strSql.ToString(), dp, pagination);
  367. }
  368. catch (Exception ex)
  369. {
  370. if (ex is ExceptionEx)
  371. {
  372. throw;
  373. }
  374. else
  375. {
  376. throw ExceptionEx.ThrowServiceException(ex);
  377. }
  378. }
  379. }
  380. /// <summary>
  381. /// 获取StuInfoFreshFamily表数据
  382. /// <summary>
  383. /// <returns></returns>
  384. public IEnumerable<StuInfoFreshFamilyEntity> GetStuInfoFreshFamilyList(string keyValue)
  385. {
  386. try
  387. {
  388. return this.BaseRepository("CollegeMIS").FindList<StuInfoFreshFamilyEntity>(t => t.StuInfoFreshId == keyValue);
  389. }
  390. catch (Exception ex)
  391. {
  392. if (ex is ExceptionEx)
  393. {
  394. throw;
  395. }
  396. else
  397. {
  398. throw ExceptionEx.ThrowServiceException(ex);
  399. }
  400. }
  401. }
  402. /// <summary>
  403. /// 获取StuInfoFreshEmergePeople表数据
  404. /// <summary>
  405. /// <returns></returns>
  406. public IEnumerable<StuInfoFreshEmergePeopleEntity> GetStuInfoFreshEmergePeopleList(string keyValue)
  407. {
  408. try
  409. {
  410. return this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEmergePeopleEntity>(t => t.StuInfoFreshId == keyValue);
  411. }
  412. catch (Exception ex)
  413. {
  414. if (ex is ExceptionEx)
  415. {
  416. throw;
  417. }
  418. else
  419. {
  420. throw ExceptionEx.ThrowServiceException(ex);
  421. }
  422. }
  423. }
  424. /// <summary>
  425. /// 获取StuInfoFresh表实体数据
  426. /// <param name="keyValue">主键</param>
  427. /// <summary>
  428. /// <returns></returns>
  429. public StuInfoFreshEntity GetStuInfoFreshEntity(string keyValue)
  430. {
  431. try
  432. {
  433. return this.BaseRepository("CollegeMIS").FindEntity<StuInfoFreshEntity>(keyValue);
  434. }
  435. catch (Exception ex)
  436. {
  437. if (ex is ExceptionEx)
  438. {
  439. throw;
  440. }
  441. else
  442. {
  443. throw ExceptionEx.ThrowServiceException(ex);
  444. }
  445. }
  446. }
  447. /// <summary>
  448. /// 获取StuInfoFresh表实体数据
  449. /// <param name="keyValue">主键</param>
  450. /// <summary>
  451. /// <returns></returns>
  452. public StuInfoFreshEntity GetStuInfoFreshEntityByStuNo(string stuNo)
  453. {
  454. try
  455. {
  456. return this.BaseRepository("CollegeMIS").FindEntity<StuInfoFreshEntity>(x => x.StuNo == stuNo);
  457. }
  458. catch (Exception ex)
  459. {
  460. if (ex is ExceptionEx)
  461. {
  462. throw;
  463. }
  464. else
  465. {
  466. throw ExceptionEx.ThrowServiceException(ex);
  467. }
  468. }
  469. }
  470. /// <summary>
  471. /// 获取StuInfoFreshEmergePeople表实体数据
  472. /// <param name="keyValue">主键</param>
  473. /// <summary>
  474. /// <returns></returns>
  475. public StuInfoFreshEmergePeopleEntity GetStuInfoFreshEmergePeopleEntity(string keyValue)
  476. {
  477. try
  478. {
  479. return this.BaseRepository("CollegeMIS").FindEntity<StuInfoFreshEmergePeopleEntity>(t => t.StuInfoFreshId == keyValue);
  480. }
  481. catch (Exception ex)
  482. {
  483. if (ex is ExceptionEx)
  484. {
  485. throw;
  486. }
  487. else
  488. {
  489. throw ExceptionEx.ThrowServiceException(ex);
  490. }
  491. }
  492. }
  493. /// <summary>
  494. /// 获取StuInfoFreshFamily表实体数据
  495. /// <param name="keyValue">主键</param>
  496. /// <summary>
  497. /// <returns></returns>
  498. public StuInfoFreshFamilyEntity GetStuInfoFreshFamilyEntity(string keyValue)
  499. {
  500. try
  501. {
  502. return this.BaseRepository("CollegeMIS").FindEntity<StuInfoFreshFamilyEntity>(t => t.StuInfoFreshId == keyValue);
  503. }
  504. catch (Exception ex)
  505. {
  506. if (ex is ExceptionEx)
  507. {
  508. throw;
  509. }
  510. else
  511. {
  512. throw ExceptionEx.ThrowServiceException(ex);
  513. }
  514. }
  515. }
  516. /// <summary>
  517. /// 获取列表分页数据
  518. /// <param name="pagination">分页参数</param>
  519. /// <summary>
  520. /// <returns></returns>
  521. public IEnumerable<StuInfoFreshEntity> GetStuInfoFreshListByClassNo(string classNo)
  522. {
  523. try
  524. {
  525. var strSql = new StringBuilder();
  526. strSql.Append("SELECT t.* FROM StuInfoFresh t where 1=1 and t.ClassNo='" + classNo + "' ");
  527. return this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>(strSql.ToString());
  528. }
  529. catch (Exception ex)
  530. {
  531. if (ex is ExceptionEx)
  532. {
  533. throw;
  534. }
  535. else
  536. {
  537. throw ExceptionEx.ThrowServiceException(ex);
  538. }
  539. }
  540. }
  541. /// <summary>
  542. /// 获取分配宿舍列表
  543. /// </summary>
  544. /// <param name="pagination"></param>
  545. /// <param name="queryJson"></param>
  546. /// <returns></returns>
  547. public IEnumerable<Acc_DormitoryBuildEntity> GetDormitorys(Pagination pagination, string queryJson)
  548. {
  549. try
  550. {
  551. var strSql = new StringBuilder();
  552. strSql.Append("SELECT t.* FROM Acc_DormitoryBuild t ");
  553. strSql.Append(" WHERE 1=1 ");
  554. var queryParam = queryJson.ToJObject();
  555. // 虚拟参数
  556. var dp = new DynamicParameters(new { });
  557. if (!queryParam["BuildType"].IsEmpty())
  558. {
  559. dp.Add("BuildType", queryParam["BuildType"].ToString(), DbType.String);
  560. strSql.Append(" AND t.BuildType =@BuildType ");
  561. }
  562. if (!queryParam["ParentID"].IsEmpty())
  563. {
  564. dp.Add("ParentID", queryParam["ParentID"].ToString(), DbType.String);
  565. strSql.Append(" AND t.ParentID =@ParentID ");
  566. }
  567. if (!queryParam["Sex"].IsEmpty())
  568. {
  569. dp.Add("Sex", queryParam["Sex"].ToString(), DbType.String);
  570. strSql.Append(" AND t.Sex = @Sex ");
  571. }
  572. //if (!queryParam["IsAllocationDormitory"].IsEmpty())
  573. //{
  574. // if (queryParam["IsAllocationDormitory"].ToString() == "false")
  575. // {
  576. // strSql.Append(" AND t.PlanClassNo is not null ");
  577. // }
  578. // else
  579. // {
  580. // strSql.Append(" AND t.PlanClassNo is null ");
  581. // }
  582. //}
  583. if (!queryParam["PlanClassNo"].IsEmpty())
  584. {
  585. //dp.Add("PlanClassNo", queryParam["PlanClassNo"].ToString(), DbType.String);
  586. //strSql.Append(" AND t.PlanClassNo =@PlanClassNo ");
  587. dp.Add("PlanClassNo", "%" + queryParam["PlanClassNo"].ToString() + "%", DbType.String);
  588. strSql.Append(" AND t.PlanClassNo like @PlanClassNo ");
  589. }
  590. var data = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp, pagination).OrderBy(a => a.Name).ToList();
  591. foreach (var item in data)
  592. {
  593. //总床位
  594. item.ChildCount = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == item.ID).Count();
  595. //可分配床位=总床位-预分床位
  596. int remainBedNum = item.ChildCount - (item.PlanBedNum.HasValue ? item.PlanBedNum.Value : 0);
  597. item.PlanBedNum = remainBedNum;
  598. item.RemainBedNum = remainBedNum;
  599. }
  600. if (!queryParam["IsAllocationDormitory"].IsEmpty())
  601. {
  602. if (queryParam["IsAllocationDormitory"].ToString() == "false")//不可分配
  603. {
  604. data = data.Where(x => x.RemainBedNum == 0).ToList();
  605. }
  606. else//可分配
  607. {
  608. data = data.Where(x => x.RemainBedNum > 0).ToList();
  609. }
  610. }
  611. return data;
  612. }
  613. catch (Exception ex)
  614. {
  615. if (ex is ExceptionEx)
  616. {
  617. throw;
  618. }
  619. else
  620. {
  621. throw ExceptionEx.ThrowServiceException(ex);
  622. }
  623. }
  624. }
  625. /// <summary>
  626. /// 获取分配宿舍列表
  627. /// </summary>
  628. /// <param name="pagination"></param>
  629. /// <param name="queryJson"></param>
  630. /// <returns></returns>
  631. public IEnumerable<Acc_DormitoryBuildEntity> GetDormitorys2(Pagination pagination, string queryJson)
  632. {
  633. try
  634. {
  635. var strSql = new StringBuilder();
  636. strSql.Append("SELECT t.* FROM Acc_DormitoryBuild t ");
  637. strSql.Append(" WHERE 1=1 ");
  638. var queryParam = queryJson.ToJObject();
  639. // 虚拟参数
  640. var dp = new DynamicParameters(new { });
  641. if (!queryParam["BuildType"].IsEmpty())
  642. {
  643. dp.Add("BuildType", queryParam["BuildType"].ToString(), DbType.String);
  644. strSql.Append(" AND t.BuildType =@BuildType ");
  645. }
  646. if (!queryParam["PlanClassNo"].IsEmpty())
  647. {
  648. dp.Add("PlanClassNo", "%" + queryParam["PlanClassNo"].ToString() + "%", DbType.String);
  649. strSql.Append(" AND t.PlanClassNo like @PlanClassNo ");
  650. }
  651. var data = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp, pagination).OrderBy(a => a.Name).ToList();
  652. foreach (var item in data)
  653. {
  654. var bedList = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == item.ID);
  655. //总床位
  656. item.ChildCount = bedList.Count();
  657. //已分配床位
  658. item.UseBedNum = bedList.Where(x => x.PlanClassNo == queryParam["PlanClassNo"].ToString()).Count();
  659. item.CancelUseBedNum = item.UseBedNum;
  660. }
  661. return data;
  662. }
  663. catch (Exception ex)
  664. {
  665. if (ex is ExceptionEx)
  666. {
  667. throw;
  668. }
  669. else
  670. {
  671. throw ExceptionEx.ThrowServiceException(ex);
  672. }
  673. }
  674. }
  675. /// <summary>
  676. /// 获取分配宿舍树
  677. /// </summary>
  678. /// <returns></returns>
  679. internal List<Tuple<int, int, string, string>> GetTree()
  680. {
  681. try
  682. {
  683. var data = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>(a => !string.IsNullOrEmpty(a.ClassNo)).ToList();
  684. var classInfos = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>().ToList();
  685. var classes = data.GroupBy(a => a.ClassNo).Select(a => a.Key).ToList();
  686. List<Tuple<int, int, string, string>> list = new List<Tuple<int, int, string, string>>();
  687. foreach (var classNo in classes)
  688. {
  689. var boy = data.Count(a => a.ClassNo == classNo && a.GenderNo == "1");
  690. var girl = data.Count(a => a.ClassNo == classNo && a.GenderNo != "1");
  691. var className = classInfos.FirstOrDefault(a => a.ClassNo == classNo)?.ClassName;
  692. Tuple<int, int, string, string> tuple = new Tuple<int, int, string, string>(boy, girl, classNo, className);
  693. list.Add(tuple);
  694. }
  695. return list;
  696. }
  697. catch (Exception ex)
  698. {
  699. if (ex is ExceptionEx)
  700. {
  701. throw;
  702. }
  703. else
  704. {
  705. throw ExceptionEx.ThrowServiceException(ex);
  706. }
  707. }
  708. }
  709. /// <summary>
  710. /// 获取分配床位树
  711. /// </summary>
  712. /// <param name="classNo"></param>
  713. /// <param name="gender"></param>
  714. /// <returns></returns>
  715. internal List<Acc_DormitoryBuildEntity> GetBedTree(string classNo, string gender)
  716. {
  717. try
  718. {
  719. List<Acc_DormitoryBuildEntity> list = new List<Acc_DormitoryBuildEntity>();
  720. var data = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.PlanClassNo.Contains(classNo) && a.Sex == gender && a.BuildType == "4").ToList();
  721. var bb = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>().ToList();
  722. foreach (var item in data)
  723. {
  724. list.Add(item);
  725. var beds = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == item.ID && a.PlanClassNo == classNo).ToList();
  726. foreach (var bed in beds)
  727. {
  728. var stuName = bb.FirstOrDefault(a => a.DormitoryNo == bed.ID)?.StuName;
  729. if (!string.IsNullOrEmpty(stuName))
  730. {
  731. bed.Name = $"{bed.Name}({stuName})";
  732. }
  733. list.Add(bed);
  734. }
  735. }
  736. return list;
  737. }
  738. catch (Exception ex)
  739. {
  740. if (ex is ExceptionEx)
  741. {
  742. throw;
  743. }
  744. else
  745. {
  746. throw ExceptionEx.ThrowServiceException(ex);
  747. }
  748. }
  749. }
  750. public IEnumerable<StuInfoFreshEntity> GetNewStudentList(string queryJson)
  751. {
  752. try
  753. {
  754. //虚拟参数
  755. var dp = new DynamicParameters(new { });
  756. var strSql = new StringBuilder();
  757. strSql.Append("SELECT t.*,d.DeptName,m.MajorName,c.ClassName ");
  758. strSql.Append(" FROM StuInfoFresh t ");
  759. strSql.Append(" left join CdDept d on t.DeptNo=d.DeptNo ");
  760. strSql.Append(" left join CdMajor m on t.MajorNo=m.MajorNo ");
  761. strSql.Append(" left join ClassInfo c on t.ClassNo=c.ClassNo ");
  762. strSql.Append(" where 1=1 ");
  763. strSql.Append(" AND t.Grade ='21' ");
  764. if (!string.IsNullOrEmpty(queryJson))
  765. {
  766. dp.Add("DeptNo", queryJson, DbType.String);
  767. strSql.Append(" AND t.DeptNo =@DeptNo ");
  768. }
  769. var data = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>(strSql.ToString(), dp);
  770. foreach (var item in data)
  771. {
  772. var familyList = this.BaseRepository("CollegeMIS").FindList<StuInfoFreshFamilyEntity>(x => x.StuInfoFreshId == item.ID);
  773. if (familyList.Any())
  774. {
  775. item.IsStudentEdit = true;
  776. }
  777. else
  778. {
  779. item.IsStudentEdit = false;
  780. }
  781. }
  782. return data;
  783. }
  784. catch (Exception ex)
  785. {
  786. if (ex is ExceptionEx)
  787. {
  788. throw;
  789. }
  790. else
  791. {
  792. throw ExceptionEx.ThrowServiceException(ex);
  793. }
  794. }
  795. }
  796. #endregion
  797. #region 提交数据
  798. /// <summary>
  799. /// 删除实体数据
  800. /// <param name="keyValue">主键</param>
  801. /// <summary>
  802. /// <returns></returns>
  803. public void DeleteEntity(string keyValue)
  804. {
  805. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  806. try
  807. {
  808. var stuInfoFreshEntity = GetStuInfoFreshEntity(keyValue);
  809. db.Delete<StuInfoFreshEntity>(t => t.ID == keyValue);
  810. db.Delete<StuInfoFreshEmergePeopleEntity>(t => t.StuInfoFreshId == stuInfoFreshEntity.ID);
  811. db.Delete<StuInfoFreshFamilyEntity>(t => t.StuInfoFreshId == stuInfoFreshEntity.ID);
  812. db.Commit();
  813. }
  814. catch (Exception ex)
  815. {
  816. db.Rollback();
  817. if (ex is ExceptionEx)
  818. {
  819. throw;
  820. }
  821. else
  822. {
  823. throw ExceptionEx.ThrowServiceException(ex);
  824. }
  825. }
  826. }
  827. /// <summary>
  828. /// 保存实体数据(新增、修改)
  829. /// <param name="keyValue">主键</param>
  830. /// <summary>
  831. /// <returns></returns>
  832. public void SaveEntity(string keyValue, StuInfoFreshEntity entity, List<StuInfoFreshEmergePeopleEntity> stuInfoFreshEmergePeopleList, List<StuInfoFreshFamilyEntity> stuInfoFreshFamilyList)
  833. {
  834. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  835. try
  836. {
  837. if (!string.IsNullOrEmpty(keyValue))
  838. {
  839. var stuInfoFreshEntityTmp = GetStuInfoFreshEntity(keyValue);
  840. entity.Modify(keyValue);
  841. db.Update(entity);
  842. db.Delete<StuInfoFreshEmergePeopleEntity>(t => t.StuInfoFreshId == stuInfoFreshEntityTmp.ID);
  843. if (null != stuInfoFreshEmergePeopleList && null != stuInfoFreshFamilyList)
  844. {
  845. foreach (StuInfoFreshEmergePeopleEntity item in stuInfoFreshEmergePeopleList)
  846. {
  847. item.Create();
  848. item.StuInfoFreshId = stuInfoFreshEntityTmp.ID;
  849. db.Insert(item);
  850. }
  851. db.Delete<StuInfoFreshFamilyEntity>(t => t.StuInfoFreshId == stuInfoFreshEntityTmp.ID);
  852. foreach (StuInfoFreshFamilyEntity item in stuInfoFreshFamilyList)
  853. {
  854. item.Create();
  855. item.StuInfoFreshId = stuInfoFreshEntityTmp.ID;
  856. db.Insert(item);
  857. }
  858. }
  859. }
  860. else
  861. {
  862. entity.Create();
  863. db.Insert(entity);
  864. if (null != stuInfoFreshEmergePeopleList && null != stuInfoFreshFamilyList)
  865. {
  866. foreach (StuInfoFreshEmergePeopleEntity item in stuInfoFreshEmergePeopleList)
  867. {
  868. item.Create();
  869. item.StuInfoFreshId = entity.ID;
  870. db.Insert(item);
  871. }
  872. foreach (StuInfoFreshFamilyEntity item in stuInfoFreshFamilyList)
  873. {
  874. item.Create();
  875. item.StuInfoFreshId = entity.ID;
  876. db.Insert(item);
  877. }
  878. }
  879. }
  880. db.Commit();
  881. }
  882. catch (Exception ex)
  883. {
  884. db.Rollback();
  885. if (ex is ExceptionEx)
  886. {
  887. throw;
  888. }
  889. else
  890. {
  891. throw ExceptionEx.ThrowServiceException(ex);
  892. }
  893. }
  894. }
  895. /// <summary>
  896. /// 保存实体数据(新增、修改)
  897. /// <param name="keyValue">主键</param>
  898. /// <summary>
  899. /// <returns></returns>
  900. public void SaveEntity(string keyValue, StuInfoFreshEntity entity)
  901. {
  902. try
  903. {
  904. if (!string.IsNullOrEmpty(keyValue))
  905. {
  906. entity.Modify(keyValue);
  907. this.BaseRepository("CollegeMIS").Update(entity);
  908. }
  909. else
  910. {
  911. entity.Create();
  912. this.BaseRepository("CollegeMIS").Insert(entity);
  913. }
  914. }
  915. catch (Exception ex)
  916. {
  917. if (ex is ExceptionEx)
  918. {
  919. throw;
  920. }
  921. else
  922. {
  923. throw ExceptionEx.ThrowServiceException(ex);
  924. }
  925. }
  926. }
  927. #endregion
  928. #region 扩展数据
  929. /// <summary>
  930. /// 确认报到、取消报到
  931. /// <param name="keyValue">主键</param>
  932. /// <summary>
  933. /// <returns></returns>
  934. public void IsRegister(string keyValue, string status)
  935. {
  936. try
  937. {
  938. if (status == "1")//报到
  939. {
  940. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set RegisterStatus='1',ArriveDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  941. }
  942. else
  943. {
  944. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set RegisterStatus='0',ArriveDate=null where ID='" + keyValue + "' ");
  945. }
  946. }
  947. catch (Exception ex)
  948. {
  949. if (ex is ExceptionEx)
  950. {
  951. throw;
  952. }
  953. else
  954. {
  955. throw ExceptionEx.ThrowServiceException(ex);
  956. }
  957. }
  958. }
  959. /// <summary>
  960. /// 收取学生档案
  961. /// <param name="keyValue">主键</param>
  962. /// <summary>
  963. /// <returns></returns>
  964. public void IsCollectFile(string keyValue, string status)
  965. {
  966. try
  967. {
  968. if (status == "1")//收取
  969. {
  970. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set CollectFileStatus='1',CollectFileDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  971. }
  972. else
  973. {
  974. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set CollectFileStatus='0',CollectFileDate=null where ID='" + keyValue + "' ");
  975. }
  976. }
  977. catch (Exception ex)
  978. {
  979. if (ex is ExceptionEx)
  980. {
  981. throw;
  982. }
  983. else
  984. {
  985. throw ExceptionEx.ThrowServiceException(ex);
  986. }
  987. }
  988. }
  989. /// <summary>
  990. /// 领取钥匙
  991. /// <param name="keyValue">主键</param>
  992. /// <summary>
  993. /// <returns></returns>
  994. public void IsGetKey(string keyValue, string status)
  995. {
  996. try
  997. {
  998. if (status == "1")//领取
  999. {
  1000. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetKeyStatus='1',GetKeyDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  1001. }
  1002. else
  1003. {
  1004. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetKeyStatus='0',GetKeyDate=null where ID='" + keyValue + "' ");
  1005. }
  1006. }
  1007. catch (Exception ex)
  1008. {
  1009. if (ex is ExceptionEx)
  1010. {
  1011. throw;
  1012. }
  1013. else
  1014. {
  1015. throw ExceptionEx.ThrowServiceException(ex);
  1016. }
  1017. }
  1018. }
  1019. /// <summary>
  1020. /// 领取校园卡
  1021. /// <param name="keyValue">主键</param>
  1022. /// <summary>
  1023. /// <returns></returns>
  1024. public void IsGetCard(string keyValue, string status)
  1025. {
  1026. try
  1027. {
  1028. if (status == "1")//领取
  1029. {
  1030. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetCardStatus='1',GetCardDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  1031. }
  1032. else
  1033. {
  1034. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetCardStatus='0',GetCardDate=null where ID='" + keyValue + "' ");
  1035. }
  1036. }
  1037. catch (Exception ex)
  1038. {
  1039. if (ex is ExceptionEx)
  1040. {
  1041. throw;
  1042. }
  1043. else
  1044. {
  1045. throw ExceptionEx.ThrowServiceException(ex);
  1046. }
  1047. }
  1048. }
  1049. /// <summary>
  1050. /// 领取军训服装
  1051. /// <param name="keyValue">主键</param>
  1052. /// <summary>
  1053. /// <returns></returns>
  1054. public void IsGetMiliClothes(string keyValue, string status)
  1055. {
  1056. try
  1057. {
  1058. if (status == "1")//领取
  1059. {
  1060. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetMiliClothesStatus='1',GetMiliClothesDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  1061. }
  1062. else
  1063. {
  1064. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetMiliClothesStatus='0',GetMiliClothesDate=null where ID='" + keyValue + "' ");
  1065. }
  1066. }
  1067. catch (Exception ex)
  1068. {
  1069. if (ex is ExceptionEx)
  1070. {
  1071. throw;
  1072. }
  1073. else
  1074. {
  1075. throw ExceptionEx.ThrowServiceException(ex);
  1076. }
  1077. }
  1078. }
  1079. /// <summary>
  1080. /// 领取床上用品
  1081. /// <param name="keyValue">主键</param>
  1082. /// <summary>
  1083. /// <returns></returns>
  1084. public void IsGetBedding(string keyValue, string status)
  1085. {
  1086. try
  1087. {
  1088. if (status == "1")//领取
  1089. {
  1090. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetBeddingStatus='1',GetBeddingDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  1091. }
  1092. else
  1093. {
  1094. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set GetBeddingStatus='0',GetBeddingDate=null where ID='" + keyValue + "' ");
  1095. }
  1096. }
  1097. catch (Exception ex)
  1098. {
  1099. if (ex is ExceptionEx)
  1100. {
  1101. throw;
  1102. }
  1103. else
  1104. {
  1105. throw ExceptionEx.ThrowServiceException(ex);
  1106. }
  1107. }
  1108. }
  1109. /// <summary>
  1110. /// 缴费
  1111. /// <param name="keyValue">主键</param>
  1112. /// <summary>
  1113. /// <returns></returns>
  1114. public void IsPayFee(string keyValue, string status)
  1115. {
  1116. try
  1117. {
  1118. if (status == "1")//缴费
  1119. {
  1120. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set PayFeeStatus='1',PayFeeDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  1121. }
  1122. else
  1123. {
  1124. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set PayFeeStatus='0',PayFeeDate=null where ID='" + keyValue + "' ");
  1125. }
  1126. }
  1127. catch (Exception ex)
  1128. {
  1129. if (ex is ExceptionEx)
  1130. {
  1131. throw;
  1132. }
  1133. else
  1134. {
  1135. throw ExceptionEx.ThrowServiceException(ex);
  1136. }
  1137. }
  1138. }
  1139. /// <summary>
  1140. /// 其他费用缴费
  1141. /// <param name="keyValue">主键</param>
  1142. /// <summary>
  1143. /// <returns></returns>
  1144. public void IsOtherPayFee(string keyValue, string status)
  1145. {
  1146. try
  1147. {
  1148. if (status == "1")//缴费
  1149. {
  1150. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set OtherPayFeeStatus='1',OtherPayFeeDate='" + DateTime.Now + "' where ID='" + keyValue + "' ");
  1151. }
  1152. else
  1153. {
  1154. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set OtherPayFeeStatus='0',OtherPayFeeDate=null where ID='" + keyValue + "' ");
  1155. }
  1156. }
  1157. catch (Exception ex)
  1158. {
  1159. if (ex is ExceptionEx)
  1160. {
  1161. throw;
  1162. }
  1163. else
  1164. {
  1165. throw ExceptionEx.ThrowServiceException(ex);
  1166. }
  1167. }
  1168. }
  1169. /// <summary>
  1170. /// 审核助学贷款
  1171. /// <param name="keyValue">主键</param>
  1172. /// <summary>
  1173. /// <returns></returns>
  1174. public void DoCheckLoan(string keyValue, string status)
  1175. {
  1176. try
  1177. {
  1178. //if (status == "1")//通过
  1179. //{
  1180. // this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set StudentLoanStatus='1' where ID='" + keyValue + "' ");
  1181. //}
  1182. //else
  1183. //{
  1184. // this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set StudentLoanStatus='0' where ID='" + keyValue + "' ");
  1185. //}
  1186. if (status == "1")//已办理
  1187. {
  1188. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set StudentLoanBLStatus='1' where ID='" + keyValue + "' ");
  1189. }
  1190. else
  1191. {
  1192. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set StudentLoanBLStatus='2' where ID='" + keyValue + "' ");
  1193. }
  1194. }
  1195. catch (Exception ex)
  1196. {
  1197. if (ex is ExceptionEx)
  1198. {
  1199. throw;
  1200. }
  1201. else
  1202. {
  1203. throw ExceptionEx.ThrowServiceException(ex);
  1204. }
  1205. }
  1206. }
  1207. /// <summary>
  1208. /// 分配班级
  1209. /// <param name="keyValue">主键</param>
  1210. /// <summary>
  1211. /// <returns></returns>
  1212. public void DoAllocationClass(List<StuInfoFreshEntity> stuInfoFreshEntities)
  1213. {
  1214. UserRelationIBLL userRelationIBLL = new UserRelationBLL();
  1215. UserIBLL userIBLL = new UserBLL();
  1216. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1217. try
  1218. {
  1219. foreach (var entity in stuInfoFreshEntities)
  1220. {
  1221. //新生信息
  1222. entity.Modify(entity.ID);
  1223. db.Update(entity);
  1224. //自动生成学生账号默认为学生角色,方便登录移动端
  1225. //判断User是否存在
  1226. var userModel = userIBLL.GetEntityByAccount(entity.StuNo);
  1227. if (userModel == null)
  1228. {
  1229. //User
  1230. var annexesFileEntity = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_Id == entity.Photo);
  1231. var url = "";
  1232. if (annexesFileEntity != null)
  1233. {
  1234. url = annexesFileEntity.F_FilePath;
  1235. url = "/" + url.Substring(url.IndexOf("Resource"));
  1236. }
  1237. var userEntity = new UserEntity()
  1238. {
  1239. F_Account = entity.StuNo,
  1240. F_RealName = entity.StuName,
  1241. F_EnCode = entity.StuNo,
  1242. F_Password = Md5Helper.Encrypt(Config.GetValue("defaultpwd"), 32).ToLower(),
  1243. F_HeadIcon = string.IsNullOrEmpty(url) ? Config.GetValue("defaultheadimg") : url,
  1244. F_Gender = entity.GenderNo == "1" ? 1 : 0,
  1245. F_DeleteMark = 0,
  1246. F_EnabledMark = 1,
  1247. F_Mobile = entity.telephone,
  1248. F_Description = "学生",
  1249. F_CompanyId = this.BaseRepository("CollegeMIS").FindEntity<CdMajorEntity>(x => x.MajorNo == entity.MajorNo)?.F_SchoolId,
  1250. F_DepartmentId = entity.DeptNo
  1251. };
  1252. userIBLL.SaveEntity(null, userEntity);
  1253. //UserRelation
  1254. var roleId = Config.GetValue("GenerateStudentsRoleId");
  1255. //判断User是否添加成功
  1256. var user = userIBLL.GetEntityByAccount(entity.StuNo);
  1257. if (user != null)
  1258. {
  1259. var userRelationEntity = new UserRelationEntity();
  1260. userRelationEntity.Create();
  1261. userRelationEntity.F_UserId = user.F_UserId;
  1262. userRelationEntity.F_Category = 1;
  1263. userRelationEntity.F_ObjectId = roleId;
  1264. this.BaseRepository().Insert(userRelationEntity);
  1265. }
  1266. }
  1267. }
  1268. db.Commit();
  1269. }
  1270. catch (Exception ex)
  1271. {
  1272. db.Rollback();
  1273. if (ex is ExceptionEx)
  1274. {
  1275. throw;
  1276. }
  1277. else
  1278. {
  1279. throw ExceptionEx.ThrowServiceException(ex);
  1280. }
  1281. }
  1282. }
  1283. /// <summary>
  1284. /// 分配宿舍
  1285. /// <param name="keyValue">主键</param>
  1286. /// <summary>
  1287. /// <returns></returns>
  1288. public void DoAllocationDormitory(List<Acc_DormitoryBuildEntity> acc_DormitoryBuildEntities)
  1289. {
  1290. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1291. try
  1292. {
  1293. foreach (var entity in acc_DormitoryBuildEntities)
  1294. {
  1295. //修改房间:预分床位数量增加;预分班级判断是否需要增加;
  1296. var model = db.FindEntity<Acc_DormitoryBuildEntity>(entity.ID);
  1297. model.PlanBedNum = (model.PlanBedNum.HasValue ? model.PlanBedNum.Value : 0) + entity.PlanBedNum;
  1298. if (!string.IsNullOrEmpty(model.PlanClassNo) && model.PlanClassNo.Contains(entity.PlanClassNo))
  1299. {
  1300. }
  1301. else
  1302. {
  1303. model.PlanClassNo = model.PlanClassNo + entity.PlanClassNo + ',';
  1304. }
  1305. db.Update(model);
  1306. //修改房间下的床位:预分班级增加;
  1307. var redList = db.FindList<Acc_DormitoryBuildEntity>(x => x.ParentID == entity.ID && string.IsNullOrEmpty(x.PlanClassNo)).OrderBy(x => x.Name).ToList();
  1308. foreach (var redItem in redList)
  1309. {
  1310. var index = redList.IndexOf(redItem);
  1311. if (index == entity.PlanBedNum)
  1312. {
  1313. break;
  1314. }
  1315. redItem.PlanClassNo = entity.PlanClassNo;
  1316. db.Update(redItem);
  1317. }
  1318. }
  1319. db.Commit();
  1320. }
  1321. catch (Exception ex)
  1322. {
  1323. db.Rollback();
  1324. if (ex is ExceptionEx)
  1325. {
  1326. throw;
  1327. }
  1328. else
  1329. {
  1330. throw ExceptionEx.ThrowServiceException(ex);
  1331. }
  1332. }
  1333. }
  1334. /// <summary>
  1335. /// 导入宿舍
  1336. /// <param name="keyValue">主键</param>
  1337. /// <summary>
  1338. /// <returns></returns>
  1339. public void ImportDormitory(List<Acc_DormitoryBuildEntity> acc_DormitoryBuildEntities)
  1340. {
  1341. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1342. try
  1343. {
  1344. foreach (var entity in acc_DormitoryBuildEntities)
  1345. {
  1346. //修改房间:预分床位数量增加;预分班级判断是否需要增加;
  1347. var model = db.FindEntity<Acc_DormitoryBuildEntity>(entity.ID);
  1348. model.PlanBedNum = (model.PlanBedNum.HasValue ? model.PlanBedNum.Value : 0) + entity.PlanBedNum;
  1349. if (!string.IsNullOrEmpty(model.PlanClassNo) && model.PlanClassNo.Contains(entity.PlanClassNo))
  1350. {
  1351. }
  1352. else
  1353. {
  1354. model.PlanClassNo = model.PlanClassNo + entity.PlanClassNo + ',';
  1355. }
  1356. db.Update(model);
  1357. //修改房间下的床位:预分班级增加;
  1358. var redList = db.FindList<Acc_DormitoryBuildEntity>(x => x.ID == entity.bedId).ToList();
  1359. foreach (var redItem in redList)
  1360. {
  1361. var index = redList.IndexOf(redItem);
  1362. if (index == entity.PlanBedNum)
  1363. {
  1364. break;
  1365. }
  1366. redItem.PlanClassNo = entity.PlanClassNo;
  1367. db.Update(redItem);
  1368. }
  1369. }
  1370. db.Commit();
  1371. }
  1372. catch (Exception ex)
  1373. {
  1374. db.Rollback();
  1375. if (ex is ExceptionEx)
  1376. {
  1377. throw;
  1378. }
  1379. else
  1380. {
  1381. throw ExceptionEx.ThrowServiceException(ex);
  1382. }
  1383. }
  1384. }
  1385. /// <summary>
  1386. /// 取消分配宿舍
  1387. /// <param name="keyValue">主键</param>
  1388. /// <summary>
  1389. /// <returns></returns>
  1390. public void CancelAllocationDormitory(List<Acc_DormitoryBuildEntity> acc_DormitoryBuildEntities)
  1391. {
  1392. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1393. try
  1394. {
  1395. foreach (var entity in acc_DormitoryBuildEntities)
  1396. {
  1397. //修改房间:预分床位数量减少;预分班级判断是否需要清除;
  1398. var model = db.FindEntity<Acc_DormitoryBuildEntity>(entity.ID);
  1399. model.PlanBedNum = model.PlanBedNum - entity.CancelUseBedNum;
  1400. if (!string.IsNullOrEmpty(model.PlanClassNo))
  1401. {
  1402. var planclassnotemp = entity.PlanClassNo + ',';
  1403. if (model.PlanClassNo == planclassnotemp) //一个班
  1404. {
  1405. if (model.PlanBedNum <= 0)
  1406. {
  1407. model.PlanClassNo = "";
  1408. }
  1409. }
  1410. else //多个班
  1411. {
  1412. var bedNumSelf = db.FindList<Acc_DormitoryBuildEntity>(x => x.ParentID == entity.ID && x.PlanClassNo == entity.PlanClassNo).Count();
  1413. if (bedNumSelf == entity.CancelUseBedNum)
  1414. {
  1415. model.PlanClassNo = model.PlanClassNo.Replace(planclassnotemp, "");
  1416. }
  1417. }
  1418. }
  1419. db.Update(model);
  1420. //修改房间下的床位:预分班级清除;
  1421. var redList = db.FindList<Acc_DormitoryBuildEntity>(x => x.ParentID == entity.ID && x.PlanClassNo == entity.PlanClassNo).OrderBy(x => x.PlanStudentID).ThenBy(x => x.Name).ToList();
  1422. foreach (var redItem in redList)
  1423. {
  1424. var index = redList.IndexOf(redItem);
  1425. if (index == entity.CancelUseBedNum)
  1426. {
  1427. break;
  1428. }
  1429. redItem.PlanClassNo = "";
  1430. //判断床位是否被占用;
  1431. if (!string.IsNullOrEmpty(redItem.PlanStudentID))
  1432. {
  1433. redItem.PlanStudentID = "";
  1434. var stuInfoFreshEntity = db.FindEntity<StuInfoFreshEntity>(x => x.DormitoryNo == redItem.ID);
  1435. if (stuInfoFreshEntity != null)
  1436. {
  1437. stuInfoFreshEntity.DormitoryNo = "";
  1438. stuInfoFreshEntity.DormitoryName = "";
  1439. }
  1440. db.Update(stuInfoFreshEntity);
  1441. }
  1442. db.Update(redItem);
  1443. }
  1444. }
  1445. db.Commit();
  1446. }
  1447. catch (Exception ex)
  1448. {
  1449. db.Rollback();
  1450. if (ex is ExceptionEx)
  1451. {
  1452. throw;
  1453. }
  1454. else
  1455. {
  1456. throw ExceptionEx.ThrowServiceException(ex);
  1457. }
  1458. }
  1459. }
  1460. /// <summary>
  1461. /// 分配床位
  1462. /// </summary>
  1463. /// <param name="dormitoryNo"></param>
  1464. /// <param name="stuId"></param>
  1465. /// <param name="dormitoryName"></param>
  1466. public void DoAllocationBed(string dormitoryNo, string keyValue)
  1467. {
  1468. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1469. try
  1470. {
  1471. //清除StuInfoFresh
  1472. db.ExecuteBySql("update StuInfoFresh set DormitoryNo=null,DormitoryName=null where DormitoryNo='" + dormitoryNo + "' ");
  1473. //清除Acc_DormitoryBuild
  1474. db.ExecuteBySql("update Acc_DormitoryBuild set PlanStudentID=null where PlanStudentID='" + keyValue + "' ");
  1475. //更新Acc_DormitoryBuild
  1476. var newAcc_DormitoryBuildEntity = db.FindEntity<Acc_DormitoryBuildEntity>(x => x.ID == dormitoryNo);
  1477. if (newAcc_DormitoryBuildEntity != null)
  1478. {
  1479. newAcc_DormitoryBuildEntity.PlanStudentID = keyValue;
  1480. db.Update(newAcc_DormitoryBuildEntity);
  1481. //更新StuInfoFresh
  1482. var newStuInfoFreshEntity = db.FindEntity<StuInfoFreshEntity>(x => x.ID == keyValue);
  1483. if (newStuInfoFreshEntity != null)
  1484. {
  1485. newStuInfoFreshEntity.DormitoryNo = dormitoryNo;
  1486. newStuInfoFreshEntity.DormitoryName = db.FindEntity<Acc_DormitoryBuildEntity>(x => x.ID == newAcc_DormitoryBuildEntity.ParentID)?.Name + newAcc_DormitoryBuildEntity.Name;
  1487. db.Update(newStuInfoFreshEntity);
  1488. }
  1489. }
  1490. db.Commit();
  1491. }
  1492. catch (Exception ex)
  1493. {
  1494. db.Rollback();
  1495. if (ex is ExceptionEx)
  1496. {
  1497. throw;
  1498. }
  1499. else
  1500. {
  1501. throw ExceptionEx.ThrowServiceException(ex);
  1502. }
  1503. }
  1504. }
  1505. /// <summary>
  1506. /// 自动分配床位
  1507. /// </summary>
  1508. /// <param name="classNo">班级编号</param>
  1509. /// <param name="stuId"></param>
  1510. /// <param name="dormitoryName"></param>
  1511. public void DoAllocationBedOfAuto(string classNo)
  1512. {
  1513. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1514. try
  1515. {
  1516. //区分性别:男1,女0;
  1517. //班级里未分配床位的学生;班级里的空床位;
  1518. //修改StuInfoFresh;修改Acc_DormitoryBuild;
  1519. #region 随机分配
  1520. for (int i = 0; i <= 1; i++)
  1521. {
  1522. var studentList = new List<StuInfoFreshEntity>();
  1523. var bedList = new List<Acc_DormitoryBuildEntity>();
  1524. string sexTemp = "1";
  1525. if (i == 0)
  1526. {
  1527. studentList = db.FindList<StuInfoFreshEntity>(x => x.ClassNo == classNo && x.GenderNo != sexTemp && string.IsNullOrEmpty(x.DormitoryNo)).ToList();
  1528. bedList = db.FindList<Acc_DormitoryBuildEntity>(x => x.PlanClassNo == classNo && x.Sex != sexTemp && string.IsNullOrEmpty(x.PlanStudentID)).ToList();
  1529. }
  1530. else
  1531. {
  1532. studentList = db.FindList<StuInfoFreshEntity>(x => x.ClassNo == classNo && x.GenderNo == sexTemp && string.IsNullOrEmpty(x.DormitoryNo)).ToList();
  1533. bedList = db.FindList<Acc_DormitoryBuildEntity>(x => x.PlanClassNo == classNo && x.Sex == sexTemp && string.IsNullOrEmpty(x.PlanStudentID)).ToList();
  1534. }
  1535. var studentTempList = new List<StuInfoFreshEntity>();
  1536. var bedTempList = new List<Acc_DormitoryBuildEntity>();
  1537. foreach (var bedItem in bedList)
  1538. {
  1539. if (studentList.Count() == studentTempList.Count())
  1540. {
  1541. break;
  1542. }
  1543. var index = bedList.IndexOf(bedItem);
  1544. var studentItem = studentList[index];
  1545. bedItem.PlanStudentID = studentItem.ID;
  1546. bedTempList.Add(bedItem);
  1547. studentItem.DormitoryNo = bedItem.ID;
  1548. studentItem.DormitoryName = db.FindEntity<Acc_DormitoryBuildEntity>(x => x.ID == bedItem.ParentID)?.Name + bedItem.Name;
  1549. studentTempList.Add(studentItem);
  1550. }
  1551. db.Update(bedTempList);
  1552. db.Update(studentTempList);
  1553. }
  1554. #endregion
  1555. db.Commit();
  1556. }
  1557. catch (Exception ex)
  1558. {
  1559. db.Rollback();
  1560. if (ex is ExceptionEx)
  1561. {
  1562. throw;
  1563. }
  1564. else
  1565. {
  1566. throw ExceptionEx.ThrowServiceException(ex);
  1567. }
  1568. }
  1569. }
  1570. public void ConfirmDormitory()
  1571. {
  1572. try
  1573. {
  1574. var nostuBed = this.BaseRepository("CollegeMIS")
  1575. .FindList<Acc_DormitoryBuildEntity>(a => a.StudentID == null || a.StudentID == "").Where(a => a.PlanStudentID != null);
  1576. foreach (var bed in nostuBed)
  1577. {
  1578. var stuFreshInfo = this.BaseRepository("CollegeMIS")
  1579. .FindEntity<StuInfoFreshEntity>(a => a.ID == bed.PlanStudentID);
  1580. if (stuFreshInfo != null)
  1581. {
  1582. var stuInfo = this.BaseRepository("CollegeMIS")
  1583. .FindEntity<StuInfoBasicEntity>(a => a.StuNo == stuFreshInfo.StuNo);
  1584. if (stuInfo != null)
  1585. {
  1586. bed.Dept = stuInfo.DeptNo;
  1587. bed.Major = stuInfo.MajorNo;
  1588. bed.Class = stuInfo.ClassNo;
  1589. bed.StudentID = stuInfo.StuId;
  1590. this.BaseRepository("CollegeMIS").Update(bed);
  1591. }
  1592. }
  1593. }
  1594. }
  1595. catch (Exception ex)
  1596. {
  1597. if (ex is ExceptionEx)
  1598. {
  1599. throw;
  1600. }
  1601. else
  1602. {
  1603. throw ExceptionEx.ThrowServiceException(ex);
  1604. }
  1605. }
  1606. }
  1607. public void ConfirmDormitoryTwo()
  1608. {
  1609. try
  1610. {
  1611. var nostuBed = this.BaseRepository("CollegeMIS")
  1612. .FindList<Acc_DormitoryBuildEntity>(a => a.StudentID == null || a.StudentID == "").Where(a => a.PlanStudentID != null);
  1613. foreach (var bed in nostuBed)
  1614. {
  1615. var stuFreshInfo = this.BaseRepository("CollegeMIS")
  1616. .FindEntity<StuEnrollEntity>(a => a.StuId == bed.PlanStudentID);
  1617. if (stuFreshInfo != null)
  1618. {
  1619. var stuInfo = this.BaseRepository("CollegeMIS")
  1620. .FindEntity<StuInfoBasicEntity>(a => a.StuNo == stuFreshInfo.StuNo);
  1621. if (stuInfo != null)
  1622. {
  1623. bed.Dept = stuInfo.DeptNo;
  1624. bed.Major = stuInfo.MajorNo;
  1625. bed.Class = stuInfo.ClassNo;
  1626. bed.StudentID = stuInfo.StuId;
  1627. this.BaseRepository("CollegeMIS").Update(bed);
  1628. }
  1629. }
  1630. }
  1631. }
  1632. catch (Exception ex)
  1633. {
  1634. if (ex is ExceptionEx)
  1635. {
  1636. throw;
  1637. }
  1638. else
  1639. {
  1640. throw ExceptionEx.ThrowServiceException(ex);
  1641. }
  1642. }
  1643. }
  1644. public void GetUniform(string keyValue, bool Status)
  1645. {
  1646. try
  1647. {
  1648. var sql = "";
  1649. if (Status)
  1650. {
  1651. sql = $"UPDATE dbo.StuInfoFresh SET IsGetUniform =1 WHERE ID='{keyValue}'";
  1652. }
  1653. else
  1654. {
  1655. sql = $"UPDATE dbo.StuInfoFresh SET IsGetUniform =0 WHERE ID='{keyValue}'";
  1656. }
  1657. this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
  1658. }
  1659. catch (Exception ex)
  1660. {
  1661. if (ex is ExceptionEx)
  1662. {
  1663. throw;
  1664. }
  1665. else
  1666. {
  1667. throw ExceptionEx.ThrowServiceException(ex);
  1668. }
  1669. }
  1670. }
  1671. public void PayUniform(string keyValue, bool Status)
  1672. {
  1673. try
  1674. {
  1675. var sql = "";
  1676. if (Status)
  1677. {
  1678. sql = $"UPDATE dbo.StuInfoFresh SET IsPayUniform =1 WHERE ID='{keyValue}'";
  1679. }
  1680. else
  1681. {
  1682. sql = $"UPDATE dbo.StuInfoFresh SET IsPayUniform =0 WHERE ID='{keyValue}'";
  1683. }
  1684. this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
  1685. }
  1686. catch (Exception ex)
  1687. {
  1688. if (ex is ExceptionEx)
  1689. {
  1690. throw;
  1691. }
  1692. else
  1693. {
  1694. throw ExceptionEx.ThrowServiceException(ex);
  1695. }
  1696. }
  1697. }
  1698. /// <summary>
  1699. /// 导入学籍信息
  1700. /// </summary>
  1701. public void ImportStuInfoBasic()
  1702. {
  1703. try
  1704. {
  1705. //学籍表增加数据
  1706. var strSql = new StringBuilder();
  1707. strSql.Append(@"insert into StuInfoBasic
  1708. (StuId, StuNo, StuCode, NoticeNo, GraduateYear, ksh, DeptNo, MajorNo, MajorDetailNo, MajorDetailName,
  1709. Grade, ClassNo, StuName, SpellFull, SpellBrief, GenderNo, Birthday, PartyFaceNo, FamilyOriginNo, NationalityNo,
  1710. ProvinceNo, RegionNo, ResidenceNo, TestStuSortNo, HealthStatusNo, WillNo, TestStuSubjectNo, GraduateNo,
  1711. PlanFormNo, IsThreeGood, IsExcellent, IsNormalCadre, IsProvinceFirstThree, OverseasChineseNo, MatriculateSort,
  1712. ComeProvinceNo, HighSchoolNo, HighSchoolName, EntranceDate, Religion, GoodAt, IdentityCardNo, JoinPartyDate,
  1713. JoinLeagueDate, InSchoolAddress, InSchoolTelephone, AbmormityMoveMark, AwardMark, PunishMark, LinkmanMark,
  1714. StuNoChangeMark, FinishSchoolMark, CurrentRegisterMark, FinishSchoolDate, DiplomaNo, DiplomaRemark, Remark,
  1715. RegisterDate, Photo, TeachPlanNo, CheckMark, mobile, EMail, QQ, FatherUnit, FatherName, FatherPhone, MatherName,
  1716. MatherUnit, MatherPhone, username, password, MailAddress, PostalCode, InSchoolStatus, TransMark, ClassTutorNo,
  1717. ResumeCheck, PracStatus, RegisterStatus, PunishmentDate, F_CityId, F_CountyId, F_ProvinceId, F_SchoolId,
  1718. EduSystem, StudyModality, SyncFlag)
  1719. select NEWID(),StuNo,null,NoticeNo,null,ksh,DeptNo,MajorNo,MajorDetailNok as MajorDetailNo,MajorDetailName,Grade,ClassNo,StuName,null,null,case when GenderNo ='1' then 1 else 0 end,Birthday,PartyFaceNo,FamilyOriginNo,NationalityNo,ProvinceNo,RegionNo,ResidenceNo,TestStuSortNo,HealthStatusNo,WillNo,TestStuSubjectNo,GraduateNo,PlanFormNo,IsThreeGood,IsExcellent,IsNormalCadre,IsProvinceFirstThree,OverseasChineseNo,MatriculateSort,null,HighSchoolNo,HighSchoolName,null,null,GoodAt,IdentityCardNo,null,null,null,null,null,null,null,null,null,null,null,null,null,null,Remark,ArriveDate as RegisterDate,Photo,null,null,telephone as mobile,null,null,null,null,null,null,null,null,StuNo as username,null,MailAddress,PostalCode,null,TransMark,null,null,null,RegisterStatus,null,null,null,null,F_SchoolId,null,null,0 from
  1720. (select f.*,m.F_SchoolId from StuInfoFresh f left join CdMajor m on f.MajorNo=m.MajorNo where f.StuNo is not null ) as bb
  1721. where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo) ");
  1722. this.BaseRepository("CollegeMIS").ExecuteBySql(strSql.ToString());
  1723. //新生表修改“是否生成学籍”的状态
  1724. var strSql2 = new StringBuilder();
  1725. strSql2.Append("update StuInfoFresh set IsInBasic=1 where StuNo is not null and (IsInBasic is null or IsInBasic=0) and StuNo in (select t.StuNo from StuInfoBasic t where t.StuNo=StuNo)");
  1726. this.BaseRepository("CollegeMIS").ExecuteBySql(strSql2.ToString());
  1727. }
  1728. catch (Exception ex)
  1729. {
  1730. if (ex is ExceptionEx)
  1731. {
  1732. throw;
  1733. }
  1734. else
  1735. {
  1736. throw ExceptionEx.ThrowServiceException(ex);
  1737. }
  1738. }
  1739. }
  1740. /// <summary>
  1741. /// 删除宿舍信息
  1742. /// </summary>
  1743. public void DeleteBed(string keyValue)
  1744. {
  1745. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  1746. try
  1747. {
  1748. var stuInfoFreshEntity = db.FindEntity<StuInfoFreshEntity>(x => x.ID == keyValue);
  1749. if (stuInfoFreshEntity != null && !string.IsNullOrEmpty(stuInfoFreshEntity.DormitoryNo))
  1750. {
  1751. var dormitoryBuildEntity = db.FindEntity<Acc_DormitoryBuildEntity>(x => x.ID == stuInfoFreshEntity.DormitoryNo);
  1752. if (dormitoryBuildEntity != null)
  1753. {
  1754. //判断是否清除宿舍中预分班级
  1755. var roomEntity = db.FindEntity<Acc_DormitoryBuildEntity>(x => x.ID == dormitoryBuildEntity.ParentID);
  1756. if (roomEntity != null)
  1757. {
  1758. roomEntity.PlanBedNum = roomEntity.PlanBedNum - 1;
  1759. var aa = db.FindList<Acc_DormitoryBuildEntity>(x => x.ParentID == roomEntity.ID && x.PlanClassNo == dormitoryBuildEntity.PlanClassNo && x.ID != dormitoryBuildEntity.ID);
  1760. if (!aa.Any()) //宿舍不存在同班学生
  1761. {
  1762. var tempClass = dormitoryBuildEntity.PlanClassNo + ",";
  1763. roomEntity.PlanClassNo = roomEntity.PlanClassNo.Replace(tempClass, "");
  1764. }
  1765. db.Update(roomEntity);
  1766. }
  1767. //清除Acc_DormitoryBuild
  1768. db.ExecuteBySql("update Acc_DormitoryBuild set PlanStudentID=null,PlanClassNo=null where ID='" + dormitoryBuildEntity.ID + "' ");
  1769. }
  1770. //清除StuInfoFresh
  1771. db.ExecuteBySql("update StuInfoFresh set DormitoryNo=null,DormitoryName=null where ID='" + stuInfoFreshEntity.ID + "' ");
  1772. }
  1773. db.Commit();
  1774. }
  1775. catch (Exception ex)
  1776. {
  1777. db.Rollback();
  1778. if (ex is ExceptionEx)
  1779. {
  1780. throw;
  1781. }
  1782. else
  1783. {
  1784. throw ExceptionEx.ThrowServiceException(ex);
  1785. }
  1786. }
  1787. }
  1788. public class InAndOutList
  1789. {
  1790. public string X { get; set; }
  1791. public string Y { get; set; }
  1792. public string Sum { get; set; }
  1793. }
  1794. #endregion
  1795. #region 上传图片
  1796. internal (bool, string) IsPhoto(string stuId, bool status, string fileGuid)
  1797. {
  1798. try
  1799. {
  1800. string result = "";
  1801. bool resultBool = false;
  1802. var model = this.BaseRepository("CollegeMIS").FindEntity<StuInfoFreshEntity>(a => a.ID == stuId);
  1803. if (model != null)
  1804. {
  1805. model.Photo = fileGuid;
  1806. resultBool = true;
  1807. result = "操作成功!";
  1808. this.BaseRepository("CollegeMIS").Update(model);
  1809. }
  1810. else
  1811. {
  1812. result = "错误";
  1813. }
  1814. return (resultBool, result);
  1815. }
  1816. catch (Exception ex)
  1817. {
  1818. if (ex is ExceptionEx)
  1819. {
  1820. throw;
  1821. }
  1822. else
  1823. {
  1824. throw ExceptionEx.ThrowServiceException(ex);
  1825. }
  1826. }
  1827. }
  1828. #endregion
  1829. }
  1830. }