using FineUIPro; using System; using System.Collections; using System.Linq; namespace BLL { public static class BOSHENGService { public static Model.SGGLDB db = Funs.DB; #region 获取单位列表 /// /// 记录数 /// public static int unitcount { get; set; } /// /// 定义变量 /// private static IQueryable getUnits = from x in db.Bo_Sheng_Unit where (x.DeleteTag == "True" || x.DeleteTag == null) select x; /// /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getUnitListData(string projectId, string departName, string departCode, Grid Grid1) { IQueryable getDataList = getUnits.Where(x => x.ProjectId == projectId); if (!string.IsNullOrEmpty(departName)) { getDataList = getDataList.Where(x => x.DepartName.Contains(departName)); } if (!string.IsNullOrEmpty(departCode)) { getDataList = getDataList.Where(x => x.DepartCode.Contains(departCode)); } unitcount = getDataList.Count(); if (unitcount == 0) { return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in getDataList select new { x.ID, x.ProjectId, x.ParentID, x.DepartCode, x.ParentCode, x.DepartName, x.DepartType, x.DepartShortName, x.DepartOrder, x.State, x.DepartSir, x.IsEpiboly, x.Phone, x.Charge, x.Remark, x.OwnerDeptID, x.CreateDate, x.CreateUser, x.OperDate, x.OperUser, }; } #endregion #region 获取人员列表 /// /// 记录数 /// public static int personcount { get; set; } /// /// 定义变量 /// private static IQueryable getPersons = from x in db.Bo_Sheng_Person where (x.DeleteTag == "True" || x.DeleteTag == null) select x; /// /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getPersonListData(string projectId, string departName, string name, string identifyID, Grid Grid1) { IQueryable getDataList = getPersons.Where(x => x.ProjectId == projectId); if (!string.IsNullOrEmpty(departName)) { getDataList = getDataList.Where(x => x.DepartName.Contains(departName)); } if (!string.IsNullOrEmpty(name)) { getDataList = getDataList.Where(x => x.Name.Contains(name)); } if (!string.IsNullOrEmpty(identifyID)) { getDataList = getDataList.Where(x => x.IdentifyID == identifyID); } personcount = getDataList.Count(); if (personcount == 0) { return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList.OrderBy(x => x.DepartName), Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in getDataList select new { x.ID, x.ProjectId, x.CreateDate, x.CreateUser, x.OperDate, x.OperUser, x.DeleteUser, x.DeleteDate, x.DeleteTag, x.Name, x.Sex, SexName = x.Sex == "2" ? "女" : "男", x.BirthDay, x.Address, x.Nation, x.IdentifyID, x.Kind, x.Photo, x.Police, x.ValidPeriodStart, x.ValidPeriodEnd, x.Education, x.Native, x.Telephone, x.MaritalStatus, x.BloodGroup, x.RegisteredType, x.Age, x.JobNumber, x.CardContent, x.ContactTel, x.SecondContacts, x.SecondContactsTel, x.NewAddress, x.HealthCondition, x.HealthFile, x.BuildArea, x.TraPrincipal, x.RegisterDate, x.CategoryType, x.Station, x.Category, x.CategoryLevel, x.EntranceDate, x.IsOut, IsOutName = x.IsOut == "1" ? "是" : "否", x.LeaveDate, x.IsBlackList, IsBlackListName =x.IsBlackList == "1" ? "是" : "否", x.AgreementId, x.HasInsurance, x.DeviceNumber, x.IsActive, x.DepartId, x.DepartName, x.OwnerDepartId, x.UploadTime, }; } #endregion #region 获取培训记录列表 /// /// 记录数 /// public static int traincount { get; set; } /// /// 定义变量 /// private static IQueryable getTrains = from x in db.Bo_Sheng_Train where (x.DeleteTag == "True" || x.DeleteTag == null) select x; /// /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getTrainListData(string projectId, string trainType, string recordName, Grid Grid1) { IQueryable getDataList = getTrains.Where(x => x.ProjectId == projectId); if (!string.IsNullOrEmpty(trainType)) { getDataList = getDataList.Where(x => x.TrainType.Contains(trainType)); } if (!string.IsNullOrEmpty(recordName)) { getDataList = getDataList.Where(x => x.RecordName.Contains(recordName)); } traincount = getDataList.Count(); if (traincount == 0) { return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in getDataList select new { x.ID, x.ProjectId, x.DeleteUser, x.DeleteDate, x.DeleteTag, x.RecordName, x.TrainType, x.PaperMode, PaperModeName = x.PaperMode=="0"? "使用原卷" : "重新出卷", x.TrainMode, x.TrainPrincipal, x.TrainStartDate, x.TrainEndDate, x.TrainContent, x.TrainDescript, x.TrainPeriod, x.PersonCount, x.PassedCount, x.CoverImg, x.DemandID, x.CourseCount, x.CourseDuration, x.Source, SourceName = x.Source == "0" ? "项目" : "课程", x.Description, x.DeviceNo, x.OwnerDepartId, x.UploadTime, x.OwnerDeptName, x.TrainDepart, x.CreateDate, x.CreateUser, x.OperDate, x.OperUser, }; } #endregion #region 获取培训人员列表 /// /// 记录数 /// public static int trainPersoncount { get; set; } /// /// 定义变量 /// private static IQueryable getTrainPersons = from x in db.Bo_Sheng_TrainPerson where (x.DeleteTag == "True" || x.DeleteTag == null) select x; /// /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getTrainPersonListData(string projectId,string departName, string name, string identifyID, Grid Grid1) { IQueryable getDataList = getTrainPersons.Where(x => x.ProjectId == projectId); if (!string.IsNullOrEmpty(departName)) { getDataList = getDataList.Where(x => x.DepartName.Contains(departName)); } if (!string.IsNullOrEmpty(name)) { getDataList = getDataList.Where(x => x.EmpName.Contains(name)); } if (!string.IsNullOrEmpty(identifyID)) { getDataList = getDataList.Where(x => x.IdentifyId.Contains(identifyID)); } trainPersoncount = getDataList.Count(); if (trainPersoncount == 0) { return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in getDataList select new { x.ID, x.ProjectId, x.DeleteUser, x.DeleteDate, x.DeleteTag, x.EmpName, x.IdentifyId, x.Photo, x.Station, x.Category, x.CategoryName, x.RecordId, x.SignName, x.DepartId, x.DepartName, x.SignInDate, x.SignInType, x.TrainPeriod, x.State, StateName= x.State=="0"? "正常" : "补签", x.TotalScore, x.PassScore, x.Score, x.IsPass, IsPassName = x.IsPass == "0" ? "否" : "是", x.GroupNo, x.ExamNo, x.ExamCount, x.DeviceNo, x.OwnerDepartId, x.UploadTime, x.Answers, x.CreateDate, x.CreateUser, x.OperDate, x.OperUser, }; } #endregion #region 获取试卷列表 /// /// 记录数 /// public static int examcount { get; set; } /// /// 定义变量 /// private static IQueryable getExams = from x in db.Bo_Sheng_Exam where (x.DeleteTag == "True" || x.DeleteTag == null) select x; /// /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getExamListData(string projectId, string qsnCode,string qsnContent, Grid Grid1) { IQueryable getDataList = getExams.Where(x => x.ProjectId == projectId); if (!string.IsNullOrEmpty(qsnCode)) { getDataList = getDataList.Where(x => x.QsnCode == qsnCode); } if (!string.IsNullOrEmpty(qsnContent)) { getDataList = getDataList.Where(x => x.QsnContent.Contains(qsnContent)); } examcount = getDataList.Count(); if (examcount == 0) { return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in getDataList select new { x.ID, x.ProjectId, x.RecordId, x.ExamNo, x.GroupNo, x.CourseID, x.COrder, x.QsnCode, x.QsnId, x.QsnContent, x.QsnFileName, x.QsnAnswer, x.QsnCategory, QsnCategoryName= x.QsnCategory=="3"? "图片题" : (x.QsnCategory == "2"? "多媒体题" : "文字题"), x.QsnKind, QsnKindName = x.QsnKind == "3" ? "判断" : (x.QsnCategory == "2" ? "多选" : "单选"), x.QsnImportant, QsnImportantName = x.QsnImportant == "2" ? "困难" : (x.QsnCategory == "1" ? "一般" : "容易"), x.Description, x.Analysis, x.UploadTime, }; } #endregion #region 获取人员培训记录列表 /// /// 记录数 /// public static int personTrainRecordcount { get; set; } /// /// 定义变量 /// private static IQueryable getPersonTrainRecords = from x in db.Bo_Sheng_PersonTrainRecord where (x.DeleteTag == "True" || x.DeleteTag == null) select x; /// /// 获取分页列表 /// /// 页码 /// 每页数量 /// public static IEnumerable getPersonTrainRecordListData(string projectId, string departName, string name, string identifyID, Grid Grid1) { IQueryable getDataList = getPersonTrainRecords.Where(x => x.ProjectId == projectId); if (!string.IsNullOrEmpty(name)) { getDataList = getDataList.Where(x => x.EmpName.Contains(name)); } if (!string.IsNullOrEmpty(departName)) { getDataList = getDataList.Where(x => x.DepartName.Contains(departName)); } if (!string.IsNullOrEmpty(identifyID)) { getDataList = getDataList.Where(x => x.IdentifyId.Contains(identifyID)); } personTrainRecordcount = getDataList.Count(); if (personTrainRecordcount == 0) { return null; } getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in getDataList select new { x.ID, x.ProjectId, x.EmpName, x.IdentifyId, x.CategoryName, x.RecordId, x.DepartId, x.DepartName, x.TrainPeriod, x.TotalScore, x.PassScore, x.Score, x.IsPass, IsPassName = x.IsPass == "0" ? "否" : "是", x.GroupNo, x.ExamNo, x.ExamCount, x.DeviceNo, x.OwnerDepartId, x.Answers, x.RecordName, x.TrainType, x.PaperMode, PaperModeName = x.PaperMode == "0" ? "使用原卷" : "重新出卷", x.TrainMode, x.TrainPrincipal, x.TrainStartDate, x.TrainEndDate, x.TrainContent, x.TrainDescript, }; } #endregion } }