SOCTemplateServices.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.CommonLogic.SystemServices;
  6. using EMIS.DataLogic.DQPSystem;
  7. using EMIS.ViewModel.DQPSystem;
  8. using Bowin.Common.Linq.Entity;
  9. using EMIS.ViewModel;
  10. using System.Linq.Expressions;
  11. using EMIS.Entities;
  12. using Bowin.Common.Linq;
  13. using EMIS.DataLogic.CultureplanManage.PlanManagement;
  14. namespace EMIS.CommonLogic.DQPSystem
  15. {
  16. public class SOCTemplateServices : BaseServices, ISOCTemplateServices, IFileUploadServices
  17. {
  18. public SOCTemplateDAL SOCTemplateDAL { get; set; }
  19. public SpecialtyCourseDAL specialtyCourseDAL { get; set; }
  20. public List<ViewModel.FileUploadView> GetFileList(Guid? formID)
  21. {
  22. return SOCTemplateDAL.GetFileUploadViewQueryable(x => x.SOCTemplateItemID == formID).ToList();
  23. }
  24. public void SaveFile(IList<ViewModel.FileUploadView> fileList)
  25. {
  26. throw new NotImplementedException();
  27. }
  28. /// <summary>
  29. ///
  30. /// </summary>
  31. /// <param name="configuretView"></param>
  32. /// <param name="standardID"></param>
  33. /// <param name="facultymajorID"></param>
  34. /// <param name="departmentID"></param>
  35. /// <param name="educationID"></param>
  36. /// <param name="learningformID"></param>
  37. /// <param name="learnSystem"></param>
  38. /// <param name="coursematerialID"></param>
  39. /// <param name="schoolyearNumID"></param>
  40. /// <param name="schoolcodeID"></param>
  41. /// <param name="recordStatus"></param>
  42. /// <param name="pageIndex"></param>
  43. /// <param name="pageSize"></param>
  44. /// <returns></returns>
  45. public IGridResultSet<SOCTemplateView> GetSOCTemplateViewGrid(ConfiguretView configuretView, int? standardID, Guid? facultymajorID, Guid? departmentID, int? educationID,
  46. int? learningformID, string learnSystem, Guid? coursematerialID, int? schoolyearNumID, int? schoolcodeID, int? recordStatus, int pageIndex, int pageSize)
  47. {
  48. Expression<Func<DQP_SOCTemplate, bool>> exp = x => true;
  49. Expression<Func<CF_Facultymajor, bool>> facexp = x => true;
  50. if (standardID.HasValue)
  51. {
  52. facexp = facexp.And(x => x.StandardID == standardID);
  53. }
  54. if (facultymajorID.HasValue)
  55. {
  56. exp = exp.And(x => x.FacultymajorID == facultymajorID);
  57. }
  58. if (educationID.HasValue)
  59. {
  60. facexp = facexp.And(x => x.EducationID == educationID);
  61. }
  62. if (learningformID.HasValue)
  63. {
  64. facexp = facexp.And(x => x.LearningformID == learningformID);
  65. }
  66. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  67. {
  68. //学制
  69. var LearnSystems = Convert.ToDecimal(learnSystem);
  70. facexp = facexp.And(x => x.LearnSystem == LearnSystems);
  71. }
  72. if (coursematerialID.HasValue)
  73. {
  74. exp = exp.And(x => x.CoursematerialID == coursematerialID);
  75. }
  76. if (schoolyearNumID.HasValue)
  77. {
  78. exp = exp.And(x => x.SchoolyearNumID == schoolyearNumID);
  79. }
  80. if (schoolcodeID.HasValue)
  81. {
  82. exp = exp.And(x => x.SchoolcodeID == schoolcodeID);
  83. }
  84. if (recordStatus.HasValue)
  85. {
  86. exp = exp.And(x => x.RecordStatus == recordStatus);
  87. }
  88. if (departmentID.HasValue)
  89. {
  90. exp = exp.And(x => x.DepartmentID == departmentID);
  91. }
  92. var query = SOCTemplateDAL.GetSOCTemplateViewQueryable(exp, facexp);
  93. //查询条件
  94. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  95. {
  96. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  97. }
  98. var result = this.GetQueryByDataRangeByDepartment(query)
  99. .OrderBy(x => x.StandardID)
  100. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
  101. .ThenBy(x => x.SchoolyearNumID).ThenBy(x => x.SchoolcodeID)
  102. .ToGridResultSet<SOCTemplateView>(pageIndex, pageSize);
  103. return result;
  104. }
  105. /// <summary>
  106. ///
  107. /// </summary>
  108. /// <param name="configuretView"></param>
  109. /// <param name="standardID"></param>
  110. /// <param name="facultymajorID"></param>
  111. /// <param name="departmentID"></param>
  112. /// <param name="educationID"></param>
  113. /// <param name="learningformID"></param>
  114. /// <param name="learnSystem"></param>
  115. /// <param name="coursematerialID"></param>
  116. /// <param name="schoolyearNumID"></param>
  117. /// <param name="schoolcodeID"></param>
  118. /// <param name="recordStatus"></param>
  119. /// <param name="idList"></param>
  120. /// <returns></returns>
  121. public List<SOCTemplateView> GetSOCTemplateViewList(ConfiguretView configuretView, int? standardID, Guid? facultymajorID, Guid? departmentID, int? educationID,
  122. int? learningformID, string learnSystem, Guid? coursematerialID, int? schoolyearNumID, int? schoolcodeID, int? recordStatus, List<Guid?> idList)
  123. {
  124. Expression<Func<DQP_SOCTemplate, bool>> exp = x => true;
  125. Expression<Func<CF_Facultymajor, bool>> facexp = x => true;
  126. if (standardID.HasValue)
  127. {
  128. facexp = facexp.And(x => x.StandardID == standardID);
  129. }
  130. if (facultymajorID.HasValue)
  131. {
  132. exp = exp.And(x => x.FacultymajorID == facultymajorID);
  133. }
  134. if (educationID.HasValue)
  135. {
  136. facexp = facexp.And(x => x.EducationID == educationID);
  137. }
  138. if (learningformID.HasValue)
  139. {
  140. facexp = facexp.And(x => x.LearningformID == learningformID);
  141. }
  142. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  143. {
  144. //学制
  145. var LearnSystems = Convert.ToDecimal(learnSystem);
  146. facexp = facexp.And(x => x.LearnSystem == LearnSystems);
  147. }
  148. if (coursematerialID.HasValue)
  149. {
  150. exp = exp.And(x => x.CoursematerialID == coursematerialID);
  151. }
  152. if (schoolyearNumID.HasValue)
  153. {
  154. exp = exp.And(x => x.SchoolyearNumID == schoolyearNumID);
  155. }
  156. if (schoolcodeID.HasValue)
  157. {
  158. exp = exp.And(x => x.SchoolcodeID == schoolcodeID);
  159. }
  160. if (recordStatus.HasValue)
  161. {
  162. exp = exp.And(x => x.RecordStatus == recordStatus);
  163. }
  164. if (idList.Count > 0)
  165. {
  166. exp = exp.And(x => idList.Contains(x.SOCTemplateID));
  167. }
  168. var query = SOCTemplateDAL.GetSOCTemplateViewQueryable(exp, facexp);
  169. //查询条件
  170. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  171. {
  172. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  173. }
  174. var result = this.GetQueryByDataRangeByDepartment(query)
  175. .OrderBy(x => x.StandardID)
  176. .ThenBy(x => x.SchoolyearNumID).ThenBy(x => x.SchoolcodeID)
  177. .ToList();
  178. return result;
  179. }
  180. public SOCTemplateView GetSOCTemplateViewByID(Guid? SOCTemplateID)
  181. {
  182. Expression<Func<DQP_SOCTemplate, bool>> exp = x => true;
  183. exp = exp.And(x => x.SOCTemplateID == SOCTemplateID);
  184. var query = SOCTemplateDAL.GetSOCTemplateViewQueryable(exp, x => true).FirstOrDefault();
  185. return query;
  186. }
  187. public void GenerateTemplate(Guid? collegeID, int? standardID, Guid? facultymajorID, Guid? coursematerialID)
  188. {
  189. try
  190. {
  191. Expression<Func<EM_SpecialtyCourse, bool>> exp = x => true;
  192. exp = exp.And(x => x.RecordStatus == (int)SYS_STATUS.USABLE);
  193. Expression<Func<CF_Facultymajor, bool>> facexp = x => true;
  194. if (collegeID.HasValue)
  195. {
  196. exp = exp.And(x => x.CF_Department.CollegeID == collegeID);
  197. }
  198. if (standardID.HasValue)
  199. {
  200. exp = exp.And(x => x.CF_Specialty.StandardID == standardID);
  201. }
  202. if (facultymajorID.HasValue)
  203. {
  204. facexp = facexp.And(x => x.FacultymajorID == facultymajorID);
  205. }
  206. if (coursematerialID.HasValue)
  207. {
  208. exp = exp.And(x => x.CoursematerialID == coursematerialID);
  209. }
  210. var query = SOCTemplateDAL.GetSpecialtyCourseViewQueryable(exp, facexp).ToList();
  211. Expression<Func<DQP_SOCTemplate, bool>> dbexp = x => true;
  212. Expression<Func<CF_Facultymajor, bool>> dbfacexp = x => true;
  213. var dbTemplate = SOCTemplateDAL.GetSOCTemplateViewQueryable(dbexp, dbfacexp).ToList();
  214. List<DQP_SOCTemplate> templList = new List<DQP_SOCTemplate>();
  215. foreach (var sc in query)
  216. {
  217. if (dbTemplate.Any(x => x.CoursematerialID == sc.CoursematerialID && x.FacultymajorID == sc.FacultymajorID && x.DepartmentID == sc.DepartmentID
  218. && x.SchoolyearNumID == sc.SchoolyearNumID && x.SchoolcodeID == sc.SchoolcodeID))
  219. {
  220. continue;
  221. }
  222. DQP_SOCTemplate templ = new DQP_SOCTemplate();
  223. templ.SOCTemplateID = Guid.NewGuid();
  224. templ.FacultymajorID = sc.FacultymajorID;
  225. templ.CoursematerialID = sc.CoursematerialID;
  226. templ.Credit = sc.Credit;
  227. templ.SchoolyearNumID = sc.SchoolyearNumID;
  228. templ.SchoolcodeID = sc.SchoolcodeID;
  229. templ.DepartmentID = sc.DepartmentID;
  230. templ.HandleModeID = (int)CF_HandleMode.RequiredCourse;
  231. this.SetNewStatus(templ);
  232. templ.RecordStatus = (int)SYS_STATUS.UNUSABLE;
  233. List<DQP_SOCTemplateDetail> detailList = new List<DQP_SOCTemplateDetail>();
  234. DQP_SOCTemplateDetail detail = new DQP_SOCTemplateDetail();
  235. detail.SOCTemplateItemID = Guid.NewGuid();
  236. detail.SOCTemplateID = templ.SOCTemplateID;
  237. detail.Name = "SOC0";
  238. detail.IsGroup = false;
  239. this.SetNewStatus(detail);
  240. detailList.Add(detail);
  241. templ.DQP_SOCTemplateDetail = new HashSet<DQP_SOCTemplateDetail>(detailList);
  242. templList.Add(templ);
  243. }
  244. UnitOfWork.BulkInsert(templList);
  245. UnitOfWork.BulkInsert(templList.SelectMany(x => x.DQP_SOCTemplateDetail).ToList());
  246. }
  247. catch (Exception)
  248. {
  249. throw;
  250. }
  251. }
  252. public IGridResultSet<SOCTemplateDetailView> GetSOCTemplateDetailViewGrid(Guid? SOCTemplateID, int pageIndex, int pageSize)
  253. {
  254. Expression<Func<DQP_SOCTemplateDetail, bool>> exp = x => true;
  255. //if (SOCTemplateID.HasValue)
  256. //{
  257. exp = exp.And(x => x.SOCTemplateID == SOCTemplateID);
  258. //}
  259. var query = SOCTemplateDAL.GetSOCTemplateDetailViewByIDQueryable(exp);
  260. return query.OrderBy(x => x.Name.Length).ThenBy(x => x.Name).ToGridResultSet<SOCTemplateDetailView>(pageIndex, pageSize);
  261. }
  262. public void SOCTemplateDelete(List<Guid?> idList)
  263. {
  264. try
  265. {
  266. if (idList.Count > 0)
  267. {
  268. UnitOfWork.Delete<DQP_SOCTemplateDetailAttachment>(x => idList.Contains(x.DQP_SOCTemplateDetail.SOCTemplateID));
  269. UnitOfWork.Delete<DQP_SOCTemplateDetail>(x => idList.Contains(x.SOCTemplateID));
  270. UnitOfWork.Delete<DQP_SOCTemplate>(x => idList.Contains(x.SOCTemplateID));
  271. }
  272. }
  273. catch (Exception ex)
  274. {
  275. throw new Exception(ex.Message);
  276. }
  277. }
  278. public void SOCTemplateEdit(SOCTemplateView SOCTemplateView, List<SOCTemplateDetailView> SOCTemplateDetailViewList, List<FileUploadView> fileList)
  279. {
  280. try
  281. {
  282. DQP_SOCTemplate SOCTemplate = new DQP_SOCTemplate();
  283. List<DQP_SOCTemplateDetailAttachment> attachmentList = new List<DQP_SOCTemplateDetailAttachment>();
  284. List<DQP_SOCTemplateDetail> SOCTemplateDetailList = new List<DQP_SOCTemplateDetail>();
  285. var totalWeight = SOCTemplateDetailViewList.Sum(x => x.Weight);
  286. var totalCredit = SOCTemplateDetailViewList.Sum(x => x.Credit);
  287. SOCTemplateView.HandleModeID = SOCTemplateView.HandleModeID == -1 ? null : SOCTemplateView.HandleModeID;
  288. SOCTemplateView.SchoolyearNumID = SOCTemplateView.SchoolyearNumID == -1 ? null : SOCTemplateView.SchoolyearNumID;
  289. SOCTemplateView.SchoolcodeID = SOCTemplateView.SchoolcodeID == -1 ? null : SOCTemplateView.SchoolcodeID;
  290. if (totalWeight != 100)
  291. {
  292. throw new Exception("SOC的权重之和必须是100");
  293. }
  294. if (SOCTemplateView.Credit != totalCredit)
  295. {
  296. throw new Exception("SOC的学分之和必须等于课程学分");
  297. }
  298. //新增
  299. if (SOCTemplateView.SOCTemplateID == null || SOCTemplateView.SOCTemplateID == Guid.Empty)
  300. {
  301. SOCTemplate = SOCTemplateDAL.SOCTemplateRepository.GetSingle(x => x.FacultymajorID == SOCTemplateView.FacultymajorID && x.CoursematerialID == SOCTemplateView.CoursematerialID
  302. && x.SchoolyearNumID == SOCTemplateView.SchoolyearNumID && x.SchoolcodeID == SOCTemplateView.SchoolcodeID && x.DepartmentID == SOCTemplateView.DepartmentID);
  303. if (SOCTemplate != null)
  304. {
  305. throw new Exception("已存在相同的课程SOC设置信息");
  306. }
  307. SOCTemplate = new DQP_SOCTemplate();
  308. SOCTemplate.SOCTemplateID = Guid.NewGuid();
  309. SOCTemplate.FacultymajorID = SOCTemplateView.FacultymajorID;
  310. SOCTemplate.CoursematerialID = SOCTemplateView.CoursematerialID;
  311. SOCTemplate.Credit = SOCTemplateView.Credit;
  312. SOCTemplate.HandleModeID = SOCTemplateView.HandleModeID;
  313. SOCTemplate.SchoolyearNumID = SOCTemplateView.SchoolyearNumID;
  314. SOCTemplate.SchoolcodeID = SOCTemplateView.SchoolcodeID;
  315. SOCTemplate.DepartmentID = SOCTemplateView.DepartmentID;
  316. this.SetNewStatus(SOCTemplate);
  317. SOCTemplate.RecordStatus = SOCTemplateView.IsEnable ? 1 : 0;
  318. foreach (var view in SOCTemplateDetailViewList)
  319. {
  320. var itemID = view.SOCTemplateItemID;
  321. DQP_SOCTemplateDetail detail = new DQP_SOCTemplateDetail();
  322. detail.SOCTemplateItemID = Guid.NewGuid();
  323. detail.SOCTemplateID = SOCTemplate.SOCTemplateID;
  324. detail.Name = view.Name;
  325. detail.Credit = view.Credit;
  326. detail.Weight = view.Weight;
  327. detail.Description = view.Description;
  328. detail.IsGroup = view.IsGroup == null ? false : view.IsGroup;
  329. this.SetNewStatus(detail);
  330. foreach (var file in fileList)
  331. {
  332. if (file.FormID == itemID)
  333. {
  334. DQP_SOCTemplateDetailAttachment attachment = new DQP_SOCTemplateDetailAttachment();
  335. attachment.SOCTemplateDetailAttachmentID = Guid.NewGuid();
  336. attachment.SOCTemplateItemID = detail.SOCTemplateItemID;
  337. attachment.Name = file.FileName;
  338. attachment.Url = file.FileUrl;
  339. this.SetNewStatus(attachment);
  340. detail.DQP_SOCTemplateDetailAttachment.Add(attachment);
  341. }
  342. }
  343. SOCTemplate.DQP_SOCTemplateDetail.Add(detail);
  344. }
  345. UnitOfWork.Add(SOCTemplate);
  346. UnitOfWork.Commit();
  347. }
  348. else
  349. {//修改
  350. SOCTemplate = SOCTemplateDAL.SOCTemplateRepository.GetSingle(x => x.SOCTemplateID != SOCTemplateView.SOCTemplateID && x.FacultymajorID == SOCTemplateView.FacultymajorID && x.CoursematerialID == SOCTemplateView.CoursematerialID
  351. && x.SchoolyearNumID == SOCTemplateView.SchoolyearNumID && x.SchoolcodeID == SOCTemplateView.SchoolcodeID && x.DepartmentID == SOCTemplateView.DepartmentID);
  352. if (SOCTemplate != null)
  353. {
  354. throw new Exception("已存在相同的课程SOC设置信息");
  355. }
  356. SOCTemplate = SOCTemplateDAL.SOCTemplateRepository.GetSingle(x => x.SOCTemplateID == SOCTemplateView.SOCTemplateID, x => x.DQP_SOCTemplateDetail);
  357. SOCTemplate.SOCTemplateID = SOCTemplateView.SOCTemplateID;
  358. SOCTemplate.FacultymajorID = SOCTemplateView.FacultymajorID;
  359. SOCTemplate.CoursematerialID = SOCTemplateView.CoursematerialID;
  360. SOCTemplate.RecordStatus = SOCTemplateView.IsEnable ? 1 : 0 ;
  361. SOCTemplate.Credit = SOCTemplateView.Credit;
  362. SOCTemplate.HandleModeID = SOCTemplateView.HandleModeID;
  363. SOCTemplate.SchoolyearNumID = SOCTemplateView.SchoolyearNumID;
  364. SOCTemplate.SchoolcodeID = SOCTemplateView.SchoolcodeID;
  365. SOCTemplate.DepartmentID = SOCTemplateView.DepartmentID;
  366. SOCTemplate.ModifyUserID = EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID;
  367. SOCTemplate.ModifyTime = DateTime.Now;
  368. //SOCTemplate.DQP_SOCTemplateDetail = new HashSet<DQP_SOCTemplateDetail>();
  369. //UnitOfWork.Remove<DQP_SOCTemplateDetail>(x => x.SOCTemplateID == SOCTemplate.SOCTemplateID);
  370. foreach (var view in SOCTemplateDetailViewList)
  371. {
  372. var itemID = view.SOCTemplateItemID;
  373. DQP_SOCTemplateDetail detail = new DQP_SOCTemplateDetail();
  374. if (SOCTemplate.DQP_SOCTemplateDetail.Any(x => x.SOCTemplateItemID == view.SOCTemplateItemID))
  375. {
  376. detail = SOCTemplateDAL.SOCTemplateDetailRepository.GetSingle(x => x.SOCTemplateItemID == view.SOCTemplateItemID);
  377. detail.SOCTemplateItemID = view.SOCTemplateItemID;
  378. detail.SOCTemplateID = SOCTemplate.SOCTemplateID;
  379. detail.Name = view.Name;
  380. detail.Credit = view.Credit;
  381. detail.Weight = view.Weight;
  382. detail.Description = view.Description;
  383. detail.IsGroup = view.IsGroup == null ? false : view.IsGroup;
  384. this.SetModifyStatus(detail);
  385. //UnitOfWork.Update<DQP_SOCTemplateDetail>(detail);
  386. SOCTemplateDetailList.Add(detail);
  387. }
  388. else
  389. {
  390. detail.SOCTemplateItemID = Guid.NewGuid();
  391. detail.SOCTemplateID = SOCTemplate.SOCTemplateID;
  392. detail.DQP_SOCTemplate = SOCTemplate;
  393. detail.Name = view.Name;
  394. detail.Credit = view.Credit;
  395. detail.Weight = view.Weight;
  396. detail.Description = view.Description;
  397. detail.IsGroup = view.IsGroup == null ? false : view.IsGroup;
  398. this.SetNewStatus(detail);
  399. SOCTemplate.DQP_SOCTemplateDetail.Add(detail);
  400. }
  401. //detail.DQP_SOCTemplateDetailAttachment = new HashSet<DQP_SOCTemplateDetailAttachment>();
  402. if (view.IsChangeAttachment == 1)
  403. {
  404. UnitOfWork.Remove<DQP_SOCTemplateDetailAttachment>(x => x.SOCTemplateItemID == detail.SOCTemplateItemID);
  405. foreach (var file in fileList)
  406. {
  407. if (file.FormID == itemID)
  408. {
  409. DQP_SOCTemplateDetailAttachment attachment = new DQP_SOCTemplateDetailAttachment();
  410. attachment.SOCTemplateDetailAttachmentID = Guid.NewGuid();
  411. attachment.SOCTemplateItemID = detail.SOCTemplateItemID;
  412. attachment.Name = file.FileName;
  413. attachment.Url = file.FileUrl;
  414. this.SetNewStatus(attachment);
  415. attachmentList.Add(attachment);
  416. //detail.DQP_SOCTemplateDetailAttachment.Add(attachment);
  417. }
  418. }
  419. }
  420. //SOCTemplateDetailList.Add(detail);
  421. //SOCTemplate.DQP_SOCTemplateDetail.Add(detail);
  422. }
  423. UnitOfWork.BatchUpdate<DQP_SOCTemplateDetail>(SOCTemplateDetailList);
  424. UnitOfWork.Commit();
  425. //UnitOfWork.BulkInsert(SOCTemplateDetailList);
  426. UnitOfWork.BulkInsert(attachmentList);
  427. }
  428. }
  429. catch (Exception)
  430. {
  431. throw;
  432. }
  433. }
  434. public void AttachmentUpload(List<FileUploadView> fileList)
  435. {
  436. List<DQP_SOCTemplateDetailAttachment> attachmentList = new List<DQP_SOCTemplateDetailAttachment>();
  437. foreach (var file in fileList)
  438. {
  439. //var detail = SOCTemplateDAL.SOCTemplateDetailRepository.GetSingle(x => x.SOCTemplateItemID == file.FormID, (x => x.DQP_SOCTemplateDetailAttachment));
  440. DQP_SOCTemplateDetailAttachment attachment = new DQP_SOCTemplateDetailAttachment();
  441. attachment.SOCTemplateDetailAttachmentID = Guid.NewGuid();
  442. attachment.Name = file.FileName;
  443. attachment.Url = file.FileUrl;
  444. attachment.SOCTemplateItemID = file.FormID;
  445. this.SetNewStatus(file);
  446. attachmentList.Add(attachment);
  447. }
  448. }
  449. }
  450. }