using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Common.EvaluationManage; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.EvaluationManage.EvaluationEnter; using EMIS.ViewModel; using System.Linq.Expressions; using EMIS.Entities; using Bowin.Common.Linq; using Bowin.Common.Utility; using Bowin.Common.Mapping; using EMIS.CommonLogic.SystemServices; using Bowin.Common.JSON; using EMIS.Utility; using EMIS.DataLogic.SystemDAL; using EMIS.ViewModel.EvaluationManage; namespace EMIS.CommonLogic.EvaluationManage { public class EvaluationAdviseServices : BaseServices, IEvaluationAdviseServices { public EvaluationAdviseDAL EvaluationAdviseDAL { get; set; } public EvaluationRecordDAL EvaluationRecordDAL { get; set; } public EvaluationEnterDAL EvaluationEnterDAL { get; set; } public IGridResultSet GetEvaluationAdviseViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? departmentID, Guid? evaluationTableID, Guid? typeID, Guid? staffID, int pageIndex, int pageSize)//, Guid? collegeID, Guid? departmentID { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; //var query = EvaluationEnterDAL.GetEvaluationEnterQuery(); var query = EvaluationAdviseDAL.GetEvaluationAdviseQuery(); if (curUser.CollegeID != null)//考虑到管理员院系ID为null { query = GetQueryByDataRangeByCollege(query);//以院系 区分 } if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { query = query.Where(w => w.SchoolyearID == schoolyearID); } if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty) { query = query.Where(w => w.EvaluationTableID == evaluationTableID); } if (typeID.HasValue && typeID != Guid.Empty) { query = query.Where(w => w.EvaluationTypeID == typeID); } if (collegeID.HasValue && collegeID != Guid.Empty) { query = query.Where(w => w.CollegeID == collegeID); } if (departmentID.HasValue && departmentID != Guid.Empty) { query = query.Where(w => w.DepartmentID == departmentID); } if (staffID.HasValue && staffID != Guid.Empty) { query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID)); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.OrderByDescending(w => w.SchoolyearCode); return query.ToGridResultSet(pageIndex, pageSize); //return query.ToGridResultSet(pageIndex, pageSize); } public IList GetEvaluationAdviseViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? departmentID, Guid? evaluationTableID, Guid? typeID, Guid? staffID)//, Guid? collegeID, Guid? departmentID { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; //var query = EvaluationEnterDAL.GetEvaluationEnterQuery(); var query = EvaluationAdviseDAL.GetEvaluationAdviseQuery(); if (curUser.CollegeID != null)//考虑到管理员院系ID为null { query = GetQueryByDataRangeByCollege(query);//以院系 区分 } if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { query = query.Where(w => w.SchoolyearID == schoolyearID); } if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty) { query = query.Where(w => w.EvaluationTableID == evaluationTableID); } if (typeID.HasValue && typeID != Guid.Empty) { query = query.Where(w => w.EvaluationTypeID == typeID); } if (collegeID.HasValue && collegeID != Guid.Empty) { query = query.Where(w => w.CollegeID == collegeID); } if (departmentID.HasValue && departmentID != Guid.Empty) { query = query.Where(w => w.DepartmentID == departmentID); } if (staffID.HasValue && staffID != Guid.Empty) { query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID)); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.OrderByDescending(w => w.CourseCode); return query.ToList(); } public IGridResultSet GetMyEvaluationViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? coursematerialID, Guid? evaluationTableID, Guid? typeID, Guid? staffID, int pageIndex, int pageSize)//, Guid? collegeID, Guid? departmentID { int paramterTypeID = (int)CF_ParameterType.EvaluationSensitiveWord; var paraquery = from a in EvaluationAdviseDAL.parameterRepository.GetList(x => x.ParameterTypeID == paramterTypeID) select new { Value = a.Value, }; //List valueList = new List(); List sArray = new List(); //var values = paraquery.FirstOrDefault().Value; if (paraquery != null) { var values = paraquery.FirstOrDefault().Value; sArray = values.Split('|').ToList(); //for (int i = 0; i < values.Split('|').Length; i++) //{ // string id = values.Split('|')[i]; // if (!string.IsNullOrEmpty(id)) // { // valueList.Add(id); // } //} } else { sArray = null; } var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; //var query = EvaluationEnterDAL.GetEvaluationEnterQuery(); Expression> emcexp = x => true; Expression> emexp = x => true; Expression> eeexp = x => true; Expression> etexp = x => true; //var query = EvaluationEnterDAL.GetEvaluationEnterQuery(); if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { emexp = emexp.And(x => x.SchoolyearID == schoolyearID); } if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty) { eeexp = eeexp.And(x => x.EvaluationTableID == evaluationTableID); } if (typeID.HasValue && typeID != Guid.Empty) { etexp = etexp.And(x => x.EvaluationTypeID == typeID); } if (coursematerialID.HasValue && coursematerialID != Guid.Empty) { emcexp = emcexp.And(x => x.CoursematerialID == coursematerialID); } var query = EvaluationAdviseDAL.GetMyEvaluationQuery(emcexp, emexp, eeexp, etexp); if (staffID.HasValue && staffID != Guid.Empty) { query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID)); } //不知道是否需要数据范围 //if (curUser.CollegeID != null)//考虑到管理员院系ID为null //{ // query = GetQueryByDataRangeByCollege(query);//以院系 区分 //} if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.OrderByDescending(w => w.SchoolyearCode); //query.ToList().ForEach(x => x.Remark = (sArray != null ? (sArray.Any(y => x.Remark.Contains(y.ToString())) ? "" : x.Remark) : x.Remark)); var result = query.ToGridResultSet(pageIndex, pageSize); result.rows.ForEach(x => x.Remark = (sArray != null ? (sArray.Any(y => x.Remark.Contains(y.ToString())) ? "" : x.Remark) : x.Remark)); return result; //return query.ToGridResultSet(pageIndex, pageSize); } public IList GetMyEvaluationViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? coursematerialID, Guid? evaluationTableID, Guid? typeID, Guid? staffID)//, Guid? collegeID, Guid? departmentID { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; Expression> emcexp = x => true; Expression> emexp = x => true; Expression> eeexp = x => true; Expression> etexp = x => true; //var query = EvaluationEnterDAL.GetEvaluationEnterQuery(); if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { emexp = emexp.And(x => x.SchoolyearID == schoolyearID); } if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty) { eeexp = eeexp.And(x => x.EvaluationTableID == evaluationTableID); } if (typeID.HasValue && typeID != Guid.Empty) { etexp = etexp.And(x => x.EvaluationTypeID == typeID); } if (coursematerialID.HasValue && coursematerialID != Guid.Empty) { emcexp = emcexp.And(x => x.CoursematerialID == coursematerialID); } var query = EvaluationAdviseDAL.GetMyEvaluationQuery(emcexp, emexp, eeexp, etexp); if (staffID.HasValue && staffID != Guid.Empty) { query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID)); } //不知道是不是需要数据范围 //if (curUser.CollegeID != null)//考虑到管理员院系ID为null //{ // query = GetQueryByDataRangeByCollege(query);//以院系 区分 //} if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.OrderByDescending(x => x.SchoolyearCode); return query.ToList(); } public void Delete(List ids) { } } }