示例#1
0
        public virtual ActionResult DeleteModule(string moduleName)
        {
            JsonResponse response = new JsonResponse();

            if (string.IsNullOrEmpty(moduleName))
            {
                response.Success  = false;
                response.Message  = "You must select a Action Module to delete.";
                response.CssClass = "red";

                return(Json(response));
            }
            try
            {
                moduleRepo.Delete(moduleName, false);

                response.Success  = true;
                response.Message  = moduleName + " was deleted successfully!";
                response.CssClass = "green";

                return(Json(response));
            }
            catch (Exception ex)
            {
                response.Success  = false;
                response.Message  = ex.InnerException.Message;
                response.CssClass = "red";

                return(Json(response));
            }
        }
示例#2
0
 public OperationResult Delete(IEnumerable <ModuleVM> list)
 {
     try
     {
         if (list != null)
         {
             var moduleIds = list.Select(c => c.Id).ToList();
             int count     = _moduleRepository.Delete(_moduleRepository.Entities.Where(c => moduleIds.Contains(c.Id)));
             if (count > 0)
             {
                 return(new OperationResult(OperationResultType.Success, "删除数据成功!"));
             }
             else
             {
                 return(new OperationResult(OperationResultType.Error, "删除数据失败!"));
             }
         }
         else
         {
             return(new OperationResult(OperationResultType.ParamError, "参数错误,请选择需要删除的数据!"));
         }
     }
     catch
     {
         return(new OperationResult(OperationResultType.Error, "删除数据失败!"));
     }
 }
示例#3
0
        public LogicResponse Delete(int courseId, int id)
        {
            LogicResponse response = new LogicResponse();
            Module        module   = _moduleRepository.Get(courseId, id);

            if (module == null)
            {
                response.Success = false;
                response.Message = "No se encontró el módulo";

                return(response);
            }
            try
            {
                _moduleRepository.Delete(module);
                response.Success = true;
                response.Message = "Se borró el módulo";

                return(response);
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = "No se pudo borrar el módulo";

                return(response);
            }
        }
示例#4
0
        public void Delete(long[] ids)
        {
            var moduleList = _moduleRepository.GetList(x => ids.Contains(x.Id));

            foreach (var item in moduleList)
            {
                _moduleRepository.Delete(item);
            }
            _moduleRepository.SaveChanges();
        }
示例#5
0
 public void Delete(int id, string user = "")
 {
     _moduleRepository.Delete(x => x.id == id);
     _applicationTraceService.create(new ApplicationTrace
     {
         utilisateur = user,
         action      = Parametres.Action.Suppression.ToString(),
         description = String.Format("Supression du module_id = {0}", id),
     });
 }
示例#6
0
        public IActionResult DeleteModule(long id)
        {
            Module module = _module_repo.Find(id);

            if (module == null)
            {
                return(NotFound());
            }
            _module_repo.Delete(module);
            return(Ok());
        }
示例#7
0
        public ActionResult Delete(int id)
        {
            var model = moduleRepository.GetByID(id);

            if (model != null)
            {
                moduleRepository.Delete(model);
                TempData["message"] = string.Format("{0} đã được xóa thành công.", model.Name);
            }
            return(RedirectToIndex());
        }
示例#8
0
 public void DeleteForm(string keyValue)
 {
     if (service.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0)
     {
         throw new Exception("删除失败!操作的对象包含了下级数据。");
     }
     else
     {
         service.Delete(t => t.F_Id == keyValue);
     }
 }
示例#9
0
        public void Delete(Guid id)
        {
            var del = _repository.FindSingle(u => u.Id == id);

            if (del == null)
            {
                return;
            }

            _repository.Delete(u => u.CascadeId.Contains(del.CascadeId));
        }
示例#10
0
 public void DeleteForm(string keyValue)
 {
     if (service.Count(m => m.F_ParentId, m => m.F_ParentId == keyValue) > 0)
     {
         throw new Exception("删除失败!操作的对象包含了下级数据。");
     }
     else
     {
         service.Delete(m => m.F_Id == keyValue);
     }
 }
        public void RemoveForm1(string keyValue)
        {
            int count = _moduleRepository.GetAll().Where(t => t.F_ParentId == keyValue).Count();

            if (count > 0)
            {
                throw new Exception("当前所选数据有子节点数据!");
            }
            _moduleColumnRepository.Delete(t => t.F_ModuleId.Equals(keyValue));
            _moduleButtonRepository.Delete(t => t.F_ModuleId.Equals(keyValue));
            _moduleRepository.Delete(keyValue);
        }
示例#12
0
        public string RemoveForm(string keyValue)
        {
            int count = _moduleRepository.GetAll().Where(t => t.F_ParentId == keyValue).Count();

            if (count > 0)
            {
                return("当前所选数据有子节点数据!");
            }
            _moduleColumnRepository.Delete(t => t.F_ModuleId.Equals(keyValue));
            _moduleButtonRepository.Delete(t => t.F_ModuleId.Equals(keyValue));
            _moduleRepository.Delete(keyValue);
            return("删除成功!");
        }
示例#13
0
        public async Task <Message> DeleteModule(string id)
        {
            var module = await _moduleRepository.GetSingleAsync(x => x.ModuleId == id);

            if (module == null)
            {
                return(Message.NotFound());
            }
            _moduleRepository.Delete(module);
            if (!await _unitOfWork.SaveAsync())
            {
                return(Message.ServerError());
            }
            return(Message.Ok());
        }
示例#14
0
 public void DeleteForm(string keyValue)
 {
     if (service.IQueryable <Sys_Module>().Count(t => t.F_ParentId.Equals(keyValue)) > 0)
     {
         throw new Exception("删除失败!操作的对象包含了下级数据。");
     }
     else
     {
         OperatorModel op         = OperatorProvider.Provider.GetCurrent();
         var           F_FullName = service.FindEntity <Sys_Module>(t => t.F_Id == keyValue).F_FullName;
         service.Delete <Sys_Module>(t => t.F_Id == keyValue);
         LogHelper.Info("菜单:【" + F_FullName + "】删除!操作人账号:" + op.UserCode + ",操作人名称:" + op.UserName +
                        ",操作时间" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Code.Enum.OpType.System, null, "", "", ViewLevel.Admin);
     }
 }
示例#15
0
        public async Task <ResultObj <int> > delete(DtoDo <int> inEnt)
        {
            ResultObj <int> reObj = new ResultObj <int>();

            try
            {
                reObj = await _respoitory.Delete(inEnt.Key);
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog(typeof(QueryController), ex.ToString());
                reObj.msg     = ex.Message;
                reObj.success = false;
            }
            return(reObj);
        }
示例#16
0
 public void DeleteForm(string keyValue)
 {
     if (service.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0)
     {
         throw new Exception("删除失败!操作的对象包含了下级数据。");
     }
     else
     {
         service.Delete(t => t.F_Id == keyValue);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "删除成功", "删除菜单信息【" + GetForm(keyValue).F_FullName + "】成功!");
         }
         catch { }
     }
 }
示例#17
0
        /// <summary>
        /// Clean up duplicate serial numbers in the event the truck added a module with a serial number that existed at the gin
        /// in this scenario the truck will get the gin module and the module it created, only the gin module should stay
        /// </summary>
        /// <param name="uow"></param>
        /// <param name="repo"></param>
        /// <param name="cToken"></param>
        private static void cleanDupedModules(IUnitOfWork uow, IModuleRepository repo, CancellationToken cToken)
        {
            if (cToken.IsCancellationRequested)
            {
                return;
            }

            var modulesWithTruckSource = repo.FindMatching(m => m.Source == InputSource.TRUCK);
            var modulesWithGinSource   = repo.FindMatching(m => m.Source == InputSource.GIN);

            foreach (var m in modulesWithTruckSource.Where(m => modulesWithGinSource.Any(g => g.Name == m.Name)))
            {
                repo.Delete(m);
            }

            uow.SaveChanges();
        }
示例#18
0
        public bool DeleteModule(int id)
        {
            bool isSuccess = true;
            var  module    = moduleRepository.GetById(id);

            try
            {
                moduleRepository.Delete(module);
                SaveRecord();
                ServiceUtil <Module> .WriteActionLog(id, ENUMOperation.DELETE);
            }
            catch (Exception ex)
            {
                isSuccess = false;
                logger.Error("Error in deleting Module", ex);
            }
            return(isSuccess);
        }
示例#19
0
        /// <summary>
        /// 删除一个菜单信息
        /// </summary>
        /// <param name="keyValue"></param>
        public void DeleteForm(string keyValue)
        {
            ResultClass <List <ModuleEntity> > _ret = service.FindList(new ModuleEntity()
            {
                F_ParentId = keyValue
            });

            if (!_ret.Result)
            {
                ResultClass <int> _rets = service.Delete(t => t.F_Id == keyValue && t.F_AllowDelete == true);
                if (!_rets.Result)
                {
                    throw new Exception(_rets.ErrorMessage);
                }
            }
            else
            {
                throw new Exception("删除失败!操作的对象包含了下级数据。");
            }
        }
示例#20
0
        private async Task ArchiveModule(Module module)
        {
            var insertSuccessful = false;
            var archiveId        = new Id();

            try
            {
                await _archiveRepository.Insert(new ArchiveObject
                {
                    Id              = archiveId.Value,
                    Type            = NextPipeObjectType.Module,
                    TypeReferenceId = module.Id,
                    ArchiveReason   = ReasonForArchive.Uninstalled,
                    Metadata        = module
                });

                insertSuccessful = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                insertSuccessful = false;
            }

            if (insertSuccessful)
            {
                try
                {
                    await _moduleRepository.Delete(module.Id);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Fallback and delete the inserted archive
                    await _archiveRepository.Delete(archiveId.Value);
                }
            }
        }
示例#21
0
        // ---------------------------------------------------------------------------------------------
        public List <ModuleDTO> DeleteModule(int id)
        {
            // usunięcie z grupy dzieci (modułów) usuwanego modułu
            edumodule mod = _moduleRepository.Get(id);

            if (mod.difficulty != "easy")
            {
                List <edumodule> children = SelectChildren(id);
                foreach (var child in children)
                {
                    child.parent = null;
                }

                _moduleRepository.SaveChanges();
            }

            // usunięcie z bazy pytań przypisanych do usuwanego modułu, jesli to moduł 'easy'
            else
            {
                //List<test_question> questions = _questionService.SelectQuestionsForModule(id);
                List <test_question> questions = mod.test_question.ToList();
                foreach (var child in questions)
                {
                    _questionService.DeleteQuestion(child.id);
                }
            }

            // usunięcie modułu
            _moduleRepository.Delete(id);


            // odświeżenie sekwencji modułów
            CreateModuleSequence();

            return(GetSimpleModules());
        }
示例#22
0
 public void Delete(ModuleEntity entity)
 {
     service.Delete(entity);
 }
示例#23
0
        public async Task Delete(int id, int userId)
        {
            await _moduleRepository.Delete(id, userId);

            _logger.LogInformationExtension($"Module is successfully deleted. Module Id: {id}, User Id: {userId}");
        }
示例#24
0
 public void Delete(int id)
 {
     _moduleRepository.Delete(id);
 }