public ProfileDeducInsSubMitContracts GetFormByKeyValue(string keyValue) { var deducInsQuery = LinqSQLExtensions.IQueryable <ProfileDeducInsEntity>().Where(d => d.DeducIns_Id == keyValue); if (deducInsQuery.Count() > 0) { var deduInsEntiy = deducInsQuery.FirstOrDefault(); var scNormEntity = LinqSQLExtensions.IQueryable <ProfileScireCriteria_NormEntity>().Where(d => d.SNormId == deduInsEntiy.SCNorm_Id).FirstOrDefault(); var scClassifyEntity = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_ClassifyEntity>().Where(d => d.SClassifyId == scNormEntity.SClassifyId).FirstOrDefault(); var scTypeEntit = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_TypeEntity>().Where(d => d.STypeId == scClassifyEntity.STypeId).FirstOrDefault(); return(new ProfileDeducInsSubMitContracts() { SClassifyName = deduInsEntiy.SCClassifyName, SClassifyScore = scClassifyEntity.Score, SEntryName = deduInsEntiy.SCEntryName, SNormCondition = scNormEntity.Condition, SNormProjectName = deduInsEntiy.SCNormProjectName, SNormStandardName = deduInsEntiy.SCNormStandardName, STypeName = deduInsEntiy.SCTypeName, DeducIns_Id = deduInsEntiy.DeducIns_Id, F_Id = deduInsEntiy.DeducIns_Id, TaskEntryId = deduInsEntiy.TaskEntry_Id, DeductionDescribe = deduInsEntiy.DeductionDescribe, DeductionSeveral = deduInsEntiy.DeductionSeveral, DeductionScore = deduInsEntiy.DeductionScore, NormId = deduInsEntiy.SCNorm_Id }); } return(null); }
/// <summary> /// 获取列表 /// </summary> /// <param name="pagination"></param> /// <param name="keyword"></param> /// <returns></returns> public List <ScoreCriteriaTypeContracts> GetTypeList(Pagination pagination, string keyword) { var typeQuery = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_TypeEntity>(); if (!string.IsNullOrEmpty(keyword)) { typeQuery = typeQuery.Where(d => d.Name.Contains(keyword)); } typeQuery.Skip(pagination.rows * (pagination.page - 1)).Take(pagination.rows); var dataQ = from typeQ in typeQuery join entryQ in LinqSQLExtensions.IQueryable <ProfileScoreCriteria_EntryEntity>() on typeQ.SEntryId equals entryQ.SEntryId select new ScoreCriteriaTypeContracts { STypeId = typeQ.STypeId, STypeName = typeQ.Name, SEntryId = typeQ.SEntryId, SEntryName = entryQ.Name }; return(dataQ.OrderBy(d => d.SEntryId).ToList()); }
public ProfileScireCriteria_NormEntity GetNormForm(string normGroupId) { var query = LinqSQLExtensions.IQueryable <ProfileScireCriteria_NormEntity>().Where(d => d.GroupId == normGroupId); if (query.Count() > 0) { return(query.FirstOrDefault()); } return(null); }
/// <summary> /// 查找小类 /// </summary> /// <param name="classifyGroupId"></param> /// <returns></returns> public ProfileScoreCriteria_ClassifyEntity GetClassifyFrom(string classifyGroupId) { var query = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_ClassifyEntity>().Where(d => d.GroupId == classifyGroupId); if (query.Count() > 0) { return(query.FirstOrDefault()); } return(null); }
public ProfileDeducInsSubMitContracts GetForm(string normId, string taskEntryId) { var deducInsQuery = LinqSQLExtensions.IQueryable <ProfileDeducInsEntity>().Where(d => d.SCNorm_Id == normId && d.TaskEntry_Id == taskEntryId); if (deducInsQuery.Count() > 0) { var deduInsEntiy = deducInsQuery.FirstOrDefault(); return(new ProfileDeducInsSubMitContracts() { F_Id = deduInsEntiy.DeducIns_Id, TaskEntryId = deduInsEntiy.TaskEntry_Id, DeductionDescribe = deduInsEntiy.DeductionDescribe, DeductionSeveral = deduInsEntiy.DeductionSeveral, DeductionScore = deduInsEntiy.DeductionScore, NormId = deduInsEntiy.SCNorm_Id }); } return(null); }
public Contracts.ApiWayContracts[] GetWayTask(string UserId, Data.Enums.CheckPointClassificationEnum type) { #region 变量 DateTime currentTime = DateTime.Now; int hasSentState = ProfileTaskStateEnum.HasSent.GetIntValue(); //当前道路的code int dataTypeCode = ProfileTaskEntryTypeEnum.Way.GetIntValue(); //当前获取道路类型转换为道路的 int wayTypeCode = Unti.CheckPointAssociatedExtensions.GetWayGradeAssociated(type); #endregion //寻找当前外勤人员是否存在要完成的任务 var taskIsHave = from taskQ in LinqSQLExtensions.IQueryable <ProfileTaskEntity>() where taskQ.PersonInChargeId == UserId && taskQ.DeliveryTime <= currentTime && taskQ.CompletionTime >= currentTime && taskQ.State == hasSentState select new { f_id = taskQ.F_Id }; if (taskIsHave.Count() <= 0) { throw new Exception("此用户当前未发现任何任务!"); } //查道路任务 var taskQuery = from taskQ in LinqSQLExtensions.IQueryable <ProfileTaskEntity>() join taskEntryQ in LinqSQLExtensions.IQueryable <ProfileTaskEntryEntity>() on taskQ.F_Id equals taskEntryQ.TaskId where taskQ.PersonInChargeId == UserId && taskQ.State == hasSentState && taskQ.DeliveryTime <= currentTime && taskQ.CompletionTime >= currentTime && taskEntryQ.TaskEntryType == dataTypeCode select new { TaskId = taskQ.F_Id, TaskEntryId = taskEntryQ.F_Id, DeliveryTime = taskQ.DeliveryTime, CompletionTime = taskQ.CompletionTime, EntryDataId = taskEntryQ.EntryDataId }; var dataQuery = from taskq in taskQuery join wayData in LinqSQLExtensions.IQueryable <ProfileSanitationWayEntity>() on taskq.EntryDataId equals wayData.F_Id where wayData.WayGrade == wayTypeCode select new { TaskId = taskq.TaskId, TaskEntryId = taskq.TaskEntryId, Origin = wayData.Origin, Destination = wayData.Destination, DeliveryTime = taskq.DeliveryTime, CompletionTime = taskq.CompletionTime, StreetId = wayData.StreetId }; var StreetQuery = from dataQ in dataQuery join streetQ in LinqSQLExtensions.IQueryable <ProfileStreetEntity>() on dataQ.StreetId equals streetQ.F_Id select new { TaskId = dataQ.TaskId, TaskEntryId = dataQ.TaskEntryId, Origin = dataQ.Origin, Destination = dataQ.Destination, DeliveryTime = dataQ.DeliveryTime, CompletionTime = dataQ.CompletionTime, StreetId = dataQ.StreetId, StreetName = streetQ.StreetName }; return(StreetQuery.Select(d => new Contracts.ApiWayContracts() { Title = "道路清扫", Id = d.TaskId, CompletionTime = (DateTime)d.DeliveryTime, DeliveryTime = d.CompletionTime, Name = d.Origin + "--" + d.Destination, StreetId = d.StreetId, StreetName = d.StreetName, IsComplete = 0 }).ToArray()); }
public Contracts.ApiWayContracts[] GetTandastask(string UserId, Data.Enums.CheckPointClassificationEnum type) { #region 变量 DateTime currentTime = DateTime.Now; int hasSentState = ProfileTaskStateEnum.HasSent.GetIntValue(); //当前道路的code int dataTypeCode = ProfileTaskEntryTypeEnum.Tandas.GetIntValue(); //当前获取道路类型转换为道路的 int thandasTypeCode = Unti.CheckPointAssociatedExtensions.GetTandasGradeAssociate(type); #endregion //寻找当前外勤人员是否存在要完成的任务 var taskIsHave = from taskQ in LinqSQLExtensions.IQueryable <ProfileTaskEntity>() where taskQ.PersonInChargeId == UserId && taskQ.DeliveryTime <= currentTime && taskQ.CompletionTime >= currentTime && taskQ.State == hasSentState select new { f_id = taskQ.F_Id }; if (taskIsHave.Count() <= 0) { throw new Exception("此用户当前未发现任何任务!"); } //查找公厕任务 var taskQuery = from taskQ in LinqSQLExtensions.IQueryable <ProfileTaskEntity>() join taskEntryQ in LinqSQLExtensions.IQueryable <ProfileTaskEntryEntity>() on taskQ.F_Id equals taskEntryQ.TaskId where taskQ.PersonInChargeId == UserId && taskQ.DeliveryTime <= currentTime && taskQ.CompletionTime >= currentTime && taskEntryQ.TaskEntryType == dataTypeCode select new { TaskId = taskQ.F_Id, TaskEntryId = taskEntryQ.F_Id, DeliveryTime = taskQ.DeliveryTime, CompletionTime = taskQ.CompletionTime, EntryDataId = taskEntryQ.EntryDataId }; var dataQueery = from taskq in taskQuery join tandasData in LinqSQLExtensions.IQueryable <ProfileSanitationTandasEntity>() on taskq.EntryDataId equals tandasData.F_Id where tandasData.Grade == thandasTypeCode select new { TaskId = taskq.TaskId, TaskEntryId = taskq.TaskEntryId, Address = tandasData.Address, DeliveryTime = taskq.DeliveryTime, CompletionTime = taskq.CompletionTime, StreetId = tandasData.StreetId }; var StreetQuery = from dataQ in dataQueery join streetQ in LinqSQLExtensions.IQueryable <ProfileStreetEntity>() on dataQ.StreetId equals streetQ.F_Id select new { taskId = dataQ.TaskId, TaskEntryId = dataQ.TaskEntryId, Address = dataQ.Address, DeliveryTime = dataQ.DeliveryTime, CompletionTime = dataQ.CompletionTime, StreetId = dataQ.StreetId, StreetName = streetQ.StreetName }; return(StreetQuery.Select(d => new Contracts.ApiWayContracts() { Title = "环卫公厕", Id = d.taskId }).ToArray()); }
public void SubmitForm(ProfileDeducInsSubMitContracts entity, string keyValue, string DeducIns_Id) { using (var db = new RepositoryBase().BeginTrans()) { //获取评分标准。 var scNormEntity = LinqSQLExtensions.IQueryable <ProfileScireCriteria_NormEntity>().Where(d => d.SNormId == entity.NormId).FirstOrDefault(); var scClassifyEntity = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_ClassifyEntity>().Where(d => d.SClassifyId == scNormEntity.SClassifyId).FirstOrDefault(); var scTypeEntit = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_TypeEntity>().Where(d => d.STypeId == scClassifyEntity.STypeId).FirstOrDefault(); var scEntryEntity = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_EntryEntity>().Where(d => d.SEntryId == scTypeEntit.SEntryId).FirstOrDefault(); //判断当前当中是存在数据,如果存在则是修改 //两条具体使用哪一个? var deducInsQuery = db.IQueryable <ProfileDeducInsEntity>().Where(d => d.DeducIns_Id == DeducIns_Id); if (!string.IsNullOrEmpty(DeducIns_Id)) { var deducInsEntiy = deducInsQuery.FirstOrDefault(); deducInsEntiy.TaskEntry_Id = entity.TaskEntryId; deducInsEntiy.SCNorm_Id = entity.NormId; deducInsEntiy.SCNormProjectName = scNormEntity.SNormProjectName; deducInsEntiy.SCNormStandardName = scNormEntity.SNormStandardName; deducInsEntiy.SCClassifyName = scClassifyEntity.SClassifyName; deducInsEntiy.SCTypeName = scTypeEntit.Name; deducInsEntiy.SCEntryName = scEntryEntity.Name; deducInsEntiy.DeductionScore = entity.DeductionScore; deducInsEntiy.DeductionSeveral = entity.DeductionSeveral; deducInsEntiy.DeductionDescribe = entity.DeductionDescribe; deducInsEntiy.LastModifyTime = DateTime.Now; deducInsEntiy.LastModifyUserId = OperatorProvider.Provider.GetCurrent().UserId; deducInsEntiy.LastModifyUserName = OperatorProvider.Provider.GetCurrent().UserName; db.Update <ProfileDeducInsEntity>(deducInsEntiy); } else { ProfileDeducInsEntity deducInsEntity = new ProfileDeducInsEntity() { DeducIns_Id = keyValue, TaskEntry_Id = entity.TaskEntryId, SCNorm_Id = entity.NormId, SCNormProjectName = scNormEntity.SNormProjectName, SCNormStandardName = scNormEntity.SNormStandardName, SCClassifyName = scClassifyEntity.SClassifyName, SCTypeName = scTypeEntit.Name, SCEntryName = scEntryEntity.Name, DeductionScore = entity.DeductionScore, DeductionSeveral = entity.DeductionSeveral, DeductionDescribe = entity.DeductionDescribe, CreateTime = DateTime.Now, CreatorUserId = OperatorProvider.Provider.GetCurrent().UserId, CreatorUserName = OperatorProvider.Provider.GetCurrent().UserName }; db.Insert <ProfileDeducInsEntity>(deducInsEntity); } db.Commit(); } }
/// <summary> /// 获取小类管理的所有中类 /// </summary> /// <returns></returns> public List <string> GetClassifyAssociatedType(string classifyGroupId) { var query = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_ClassifyEntity>().Where(d => d.GroupId == classifyGroupId); return(query.Select(d => d.STypeId).ToList()); }