12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using System.Transactions;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.Utility;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.StudentManage.StudentProfile;
- using EMIS.DataLogic.StudentManage.StudentProfile;
- namespace EMIS.CommonLogic.StudentManage.StudentProfile
- {
- public class StudentPostPracticeServices : BaseServices, IStudentPostPracticeServices
- {
- public Lazy<StudentPostPracticeDAL> StudentPostPracticeDAL { get; set; }
- /// <summary>
- /// 查询对应的学生顶岗实习信息StudentPostPracticeView
- /// </summary>
- /// <param name="userID"></param>
- /// <param name="rowCount"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<StudentPostPracticeView> GetStudentPostPracticeViewGrid(Guid userID, int rowCount, int? pageIndex, int? pageSize)
- {
- Expression<Func<CF_StudentPostPractice, bool>> expStudentPostPractice = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expStudentPostPractice = expStudentPostPractice.And(x => x.UserID == userID);
- var result = this.StudentPostPracticeDAL.Value.GetStudentPostPracticeViewQueryable(expStudentPostPractice).Take(rowCount).ToList();
- var newRowCount = rowCount - result.Count;
- for (var i = 0; i < newRowCount; i++)
- {
- result.Add(new StudentPostPracticeView
- {
- StudentPostPracticeID = Guid.NewGuid(),
- UserID = userID
- });
- }
- return new GridResultSet<StudentPostPracticeView> { rows = result, total = result.Count };
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="userID"></param>
- /// <param name="studentPostPracticeViewList"></param>
- public void StudentPostPracticeEdit(Guid userID, IList<StudentPostPracticeView> studentPostPracticeViewList)
- {
- UnitOfWork.Remove<CF_StudentPostPractice>(x => x.UserID == userID);
- var studentPostPracticeList = new List<CF_StudentPostPractice>();
- for (int i = 1; i <= studentPostPracticeViewList.Count; i++)
- {
- var studentPostPractice = studentPostPracticeViewList[i - 1];
- var newStudentPostPractice = new CF_StudentPostPractice
- {
- StudentPostPracticeID = Guid.NewGuid(),
- UserID = userID,
- PracticePlace = studentPostPractice.PracticePlace,
- StartYear = studentPostPractice.StartYear,
- StartMonth = studentPostPractice.StartMonth,
- EndYear = studentPostPractice.EndYear,
- EndMonth = studentPostPractice.EndMonth,
- PracticeMentor = studentPostPractice.PracticeMentor,
- PracticeContent = studentPostPractice.PracticeContent,
- SelfAppraise = studentPostPractice.SelfAppraise
- };
- this.SetNewStatus(newStudentPostPractice);
- studentPostPracticeList.Add(newStudentPostPractice);
- }
- UnitOfWork.AddRange(studentPostPracticeList);
- UnitOfWork.Commit();
- }
- }
- }
|