public void Delete(int id) { _calendarRepository.Delete(new Calendar() { Id = id }); }
public void Delete(int id) { var projectId = _progressRepository.Get().Where(u => u.Id == id).Select(u => u.ProjectId).FirstOrDefault(); if (!_projectHelper.HasPermission("进度填报负责人", projectId)) { throw new AppCoreException("进度填报删除没有权限"); } _progressRepository.Delete(new WeeklyProgress { Id = id }); }
public void Delete(int id) { var projectId = _ganttRepository.Get().Where(u => u.Tasks.Any(v => v.Id == id)).Select(u => u.ProjectId).FirstOrDefault(); if (!_projectHelper.HasPermission("项目进度负责人", projectId)) { throw new AppCoreException("项目进度没有权限"); } _projectTaskRepository.Delete(new ProjectTask { Id = id }); }
public void Delete(int id) { var projectId = _ganttRepository.Get().Where(u => u.Links.Any(v => v.Id == id)).Select(u => u.ProjectId).FirstOrDefault(); var list = _projectRepository.Get().Where(u => u.Id == projectId).SelectMany(u => u.Members).Where(u => u.ProjectRole == "项目进度负责人").Select(u => u.UserId).ToList(); if (_projectHelper.HasPermission("项目进度负责人", id)) { throw new AppCoreException("项目进度没有权限"); } _linkRepository.Delete(new ProjectLink { Id = id }); }
public void Delete(int id) { //if (!_projectHelper.HasPermission("项目负责人", id)) //{ // throw new AppCoreException("项目没有权限"); //} if (_authInfoProvider.GetCurrent().User.Id != _projectRepository.Get().Where(u => u.Id == id).Select(u => u.CreatorId).FirstOrDefault()) { throw new AppCoreException("项目没有权限"); } _projectRepository.Delete(new Project { Id = id }); }
public void Delete(int id) { var problem = _problemRepository.Get().Where(u => u.Id == id).FirstOrDefault(); if (problem != null) { var userId = _authInfoProvider.GetCurrent().User.Id; if (!_projectHelper.HasPermission("质量信息负责人", problem.ProjectId))//权限设置 { throw new AppCoreException("质量问题删除没有权限"); } _problemRepository.Delete(new QualityProblem { Id = id }); } }
public void Delete(int id) { var problem = _recordRepository.Get().Where(u => u.Id == id).FirstOrDefault(); if (problem != null) { var userId = _authInfoProvider.GetCurrent().User.Id; if (!_projectHelper.HasPermission("大事记负责人", problem.ProjectId))//权限设置 { throw new AppCoreException("大事记删除没有权限"); } _recordRepository.Delete(new MemorabiliaRecord { Id = id }); } }
public void CompleteProcess(int processInstanceId) { var project = _projectRepository.Get() .Include(u => u.Location) .Include(u => u.Members) .Include(u => u.Units).ThenInclude(u => u.Members) .Include(u => u.Attachments) .Where(u => u.ProcessInstanceId == processInstanceId).FirstOrDefault(); if (project == null) { throw new EntityException("ProjectInstanceId", processInstanceId, "Project", "不存在"); } if (project.DataState == DataState.Creating) { //project.State = DataState.Stable; //_projectBaseInfoRepository.Update(project, new System.Linq.Expressions.Expression<Func<ProjectBaseInfo, object>>[] { // u => u.State //}, true); //using (var transaction = _dbContextProvider.BeginTransaction()) //{ var temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project)); temp.DataState = DataState.Stable; temp.ProcessInstanceId = null; _projectRepository.Update(temp, new System.Linq.Expressions.Expression <Func <Project, object> >[] { u => u.DataState, u => u.ProcessInstanceId }, true); temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project)); temp.Attachments.ForEach(u => u.Id = 0); temp.Members.ForEach(u => u.Id = 0); temp.Units.ForEach(u => { u.Id = 0; u.Members.ForEach(v => v.Id = 0); }); if (temp.Location != null) { temp.Location.Id = 0; temp.Location.ProjectId = 0; } temp.DataState = DataState.Created; temp.Id = 0; temp.Mid = project.Id; _projectRepository.Add(temp); // transaction.Commit(); //} } else if (project.Mid != null && project.DataState == DataState.Updating) { using (var transaction = _dbContextProvider.BeginTransaction()) { var temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project)); temp.DataState = DataState.Updated; _projectRepository.Update(temp, new System.Linq.Expressions.Expression <Func <Project, object> >[] { u => u.DataState }, true); temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project)); temp.Id = project.Mid.Value; temp.Mid = null; temp.Attachments.ForEach(u => u.Id = 0); temp.Members.ForEach(u => u.Id = 0); if (temp.Location != null) { temp.Location.Id = 0; } temp.Units.ForEach(u => { u.Id = 0; u.Members.ForEach(v => v.Id = 0); }); var existing = _projectRepository.Get() .Include(u => u.Location) .Include(u => u.Members) .Include(u => u.Attachments) .Include(u => u.Units).ThenInclude(u => u.Members) .Where(u => u.Id == temp.Id).FirstOrDefault(); _projectRepository.Update(temp, existing, new System.Linq.Expressions.Expression <Func <Project, object> >[] { u => u.ProcessInstanceId, u => u.DataState, u => u.No, u => u.Units }, false); var addedUnits = temp.Units.Except(existing.Units, u => u.Id).ToList(); var deletedUnits = existing.Units.Except(temp.Units, u => u.Id).ToList(); var updatedUnits = temp.Units.Intersect(existing.Units, u => u.Id).ToList(); foreach (var added in addedUnits) { _projectUnitRepository.Add(added); } foreach (var deleted in deletedUnits) { _projectUnitRepository.Delete(deleted); } foreach (var updated in updatedUnits) { var existed = existing.Units.Where(u => u.Id == updated.Id).FirstOrDefault(); _projectUnitRepository.Update(updated, existed, new Expression <Func <ProjectUnit, object> >[] { }, false); } transaction.Commit(); } } else { throw new AppCoreException("当前数据不再更新状态"); } }
public void Delete(int id) { _recordRepository.Delete(new Record { Id = id }); }
public void Delete(int id) { _standardRepository.Delete(new SafetyStandard { Id = id }); }
public void Delete(int id) { _contractPaymentRepository.Delete(new ContractPayment { Id = id }); }