123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Common.Students;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.Students;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- namespace EMIS.CommonLogic.Students
- {
- public class StudentExperienceServices : BaseServices, IStudentExperienceServices
- {
- public StudentExperienceDAL StudentExperienceDAL { get; set; }
- public IGridResultSet<StudentExperienceView> GetTopStudentExperienceGridView(Guid userID, int rowCount, int? pageIndex, int? pageSize)
- {
- Expression<Func<CF_StudentExperience, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE
- && x.UserID == userID);
- var result = this.StudentExperienceDAL.GetStudentExperienceViewQueryable(exp).Take(rowCount).ToList();
- var newRowCount = rowCount - result.Count;
- for (var i = 0; i < newRowCount; i++)
- {
- result.Add(new StudentExperienceView
- {
- StudentExperienceID = Guid.NewGuid(),
- UserID = userID
- });
- }
- return new GridResultSet<StudentExperienceView> { rows = result, total = result.Count };
- }
- public void Save(Guid userID, IList<StudentExperienceView> studentExperienceViewList)
- {
- UnitOfWork.Remove<CF_StudentExperience>(x => x.UserID == userID);
- var studentExperienceList = (from experience in studentExperienceViewList
- select new CF_StudentExperience
- {
- StudentExperienceID = Guid.NewGuid(),
- UserID = userID,
- StartYear = experience.StartYear,
- StartMonth = experience.StartMonth,
- EndYear = experience.EndYear,
- EndMonth = experience.EndMonth,
- Experience = experience.Experience
- }).ToList();
- studentExperienceList.ForEach(x => this.SetNewStatus(x));
- UnitOfWork.AddRange(studentExperienceList);
- UnitOfWork.Commit();
- }
- }
- }
|