public NotificationResult Salvar(Pericia entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodPericia != 0) { entidade.CodPericia = entidade.CodPericia; if (NotificationResult.IsValid) { _periciaRepositorio.Adicionar(entidade); NotificationResult.Add("Cadastrado!"); } return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("Erro no cadastro!", NotificationErrorType.USER))); }; } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public void TesteGeraPericia() { GeradorPericia gerador = new GeradorPericia(); Pericia pericia = gerador.Gerar(rnd); Assert.IsNotNull(pericia); }
public ActionResult Form(int id) { if (!verifica_acesso("pericias", "Visualizar")) { return(RedirectToAction("Index", "Login")); } ViewBag.pagina = "Pericia / Detalhes"; PericiaDao _PericiaDao = new PericiaDao(); Pericia _pericias = new Pericia(); if (id != 0) { _pericias = _PericiaDao.Listar_Pericia(id); } AtributoDao _AtributoDao = new AtributoDao(); ViewBag.Atributos = _AtributoDao.Listar_Atributos_ativo(); CampanhaDao _CampanhaDao = new CampanhaDao(); ViewBag.Campanhas = _CampanhaDao.Listar_Campanhas_cb_mestre(); ClasseDao _ClasseDao = new ClasseDao(); ViewBag.Classes = _ClasseDao.Listar_Classes_dt_cb(); return(View(_pericias)); }
public NotificationResult Atualizar(Pericia entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodPericia != 0) { entidade.CodPericia = entidade.CodPericia; } if (NotificationResult.IsValid) { _periciaRepositorio.Atualizar(entidade); NotificationResult.Add("Cadastro Alterado com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception) { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } }
public NotificationResult Excluir(Pericia entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodPericia != 0) { if (NotificationResult.IsValid) { _periciaRepositorio.Remover(entidade); NotificationResult.Add("Cadastro excluido com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public ActionResult DeleteConfirmed(int id) { Pericia pericia = db.Pericias.Find(id); db.Pericias.Remove(pericia); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "PericiaId,Nome,Modificador,Mastery,Proeficiencia")] Pericia pericia) { if (ModelState.IsValid) { db.Entry(pericia).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pericia)); }
public ActionResult Adiciona(int Cod_Pericia, string Descricao, int Cod_Atributo, int penalidade_peso, string requisito_classe, bool Treinada, string Caracteristicas, int Campanha, bool Ativo) { Pericia _Pericia = new Pericia(); _Pericia.Cod_Pericia = Cod_Pericia; _Pericia.Descricao = Descricao; _Pericia.Cod_Atributo = Cod_Atributo; _Pericia.penalidade_peso = penalidade_peso; if (string.IsNullOrEmpty(requisito_classe)) { requisito_classe = "0"; } _Pericia.requisito_classe = new List <int>(Array.ConvertAll(limpar_list(requisito_classe).Split('_'), int.Parse)); _Pericia.Treinada = Treinada; _Pericia.Caracteristicas = Caracteristicas; _Pericia.Campanha = Campanha; _Pericia.Ativo = Ativo; string msg = validar(_Pericia); if (string.IsNullOrEmpty(msg)) { PericiaDao _PericiaDao = new PericiaDao(); if (_Pericia.Cod_Pericia == 0) { if (verifica_acesso("Pericias", "Novo")) { msg = _PericiaDao.Insert(_Pericia); } else { msg = "Acesso não permitido"; } } else { if (verifica_acesso("Pericias", "Alterar")) { msg = _PericiaDao.update(_Pericia); } else { msg = "Acesso não permitido"; } } } if (string.IsNullOrEmpty(msg)) { return(Json(Url.Action("Index"))); } else { return(Json(msg)); } }
public ActionResult Create([Bind(Include = "PericiaId,Nome,Modificador,Mastery,Proeficiencia")] Pericia pericia) { if (ModelState.IsValid) { db.Pericias.Add(pericia); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pericia)); }
// GET: Pericias/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pericia pericia = db.Pericias.Find(id); if (pericia == null) { return(HttpNotFound()); } return(View(pericia)); }
public string validar(Pericia pericia) { PericiaDao _PericiaDao = new PericiaDao(); string msg = ""; if (string.IsNullOrEmpty(pericia.Descricao)) { msg = "O Campo descrição é obrigatório."; } if (_PericiaDao.verificar_descricao(pericia.Descricao, pericia.Cod_Pericia)) { msg = "A Pericia " + pericia.Descricao + " já existe."; } return(msg); }
public ActionResult Form(int id) { if (!verifica_acesso("pericias", "Visualizar")) { return(RedirectToAction("Index", "Login")); } ViewBag.pagina = "Pericia / Detalhes"; PericiaDao _PericiaDao = new PericiaDao(); Pericia _pericias = new Pericia(); List <string> Classesload = new List <string>(); AtributoDao _AtributoDao = new AtributoDao(); ViewBag.Atributos = _AtributoDao.Listar_Atributos_ativo(); CampanhaDao _CampanhaDao = new CampanhaDao(); ViewBag.Campanhas = _CampanhaDao.Listar_Campanhas_cb_mestre(); ClasseDao _ClasseDao = new ClasseDao(); List <Classe> listclas = _ClasseDao.Listar_Classes_dt_cb(); ViewBag.Classes = listclas; if (id != 0) { _pericias = _PericiaDao.Listar_Pericia(id); foreach (int item in _pericias.requisito_classe) { foreach (Classe _clas in listclas) { if (_clas.Cod_Classe == item) { Classesload.Add(_clas.Cod_Classe + "_" + _clas.Descricao); break; } } } } else { _pericias.Ativo = true; } ViewBag.classesload = Classesload; return(View(_pericias)); }
public void TesteAplicaModificadorModAdicionaPericia() { ser = new Ser(); CalculadorMod calcMod = new CalculadorMod(); Pericia pericia = new Pericia() { Nome = "Pericia 1" }; ModAdicionaPericia modificador = new ModAdicionaPericia() { Alvo = pericia, Origem = "Teste" }; calcMod.AplicaModificador(modificador, ser); Assert.IsTrue(ser.Pericias.Contains(pericia)); }
public string update(Pericia pericia) { string msg = ""; try { _conn = new Conexao(); _LogDao = new LogDao(); string strupdate = "update vantagens set Descricao = '" + pericia.Descricao.Replace("'", "''") + "', Cod_Atributo = " + pericia.Cod_Atributo + ", penalidade_peso = " + pericia.penalidade_peso + ", requisito_classe = '" + string.Join <int>("_", pericia.requisito_classe).Replace("'", "''") + "', Treinada = '" + pericia.Treinada.ToString() + "', Caracteristicas = '" + pericia.Caracteristicas.Replace("'", "''") + "', Campanha = " + pericia.Campanha + ", Ativo = '" + pericia.Ativo.ToString() + "') "; _conn.execute(strupdate); _LogDao.insert("Pericia", "up", "cod_Pericia = " + pericia.Cod_Pericia.ToString()); } catch (Exception) { msg = "Erro ao atualizar a Vantagem ('" + pericia.Descricao + "')"; } return(msg); }
public string Insert(Pericia pericia) { string msg = ""; try { _conn = new Conexao(); _LogDao = new LogDao(); string strInsert = "insert into pericias (Descricao, Cod_Atributo, penalidade_peso, requisito_classe, Treinada, Caracteristicas, Campanha, Ativo) " + " values('" + pericia.Descricao.Replace("'", "''") + "', " + pericia.Cod_Atributo + ", " + pericia.penalidade_peso + ", '" + string.Join <int>("_", pericia.requisito_classe).Replace("'", "''") + "', '" + pericia.Treinada.ToString() + "', '" + pericia.Caracteristicas.Replace("'", "''") + "', " + pericia.Campanha + ", '" + pericia.Ativo.ToString() + "')"; _conn.execute(strInsert); _LogDao.insert("Pericia", "add", ""); } catch (Exception) { msg = "Erro ao adicionar a Vantagem ('" + pericia.Descricao + "')"; } return(msg); }
public Pericia Listar_Pericia(int cod_pericia) { _conn = new Conexao(); Pericia _Pericia = new Pericia(); DataTable dt_pericia = _conn.dataTable("select * from Pericias where cod_pericia = " + cod_pericia + "", "PERICIA"); if (dt_pericia.Rows.Count > 0) { _Pericia.Cod_Pericia = Convert.ToInt32(dt_pericia.Rows[0]["Cod_Pericia"].ToString()); _Pericia.Descricao = dt_pericia.Rows[0]["Descricao"].ToString(); _Pericia.Cod_Atributo = Convert.ToInt32(dt_pericia.Rows[0]["Cod_Atributo"].ToString()); _Pericia.penalidade_peso = Convert.ToInt32(dt_pericia.Rows[0]["penalidade_peso"].ToString()); _Pericia.Campanha = Convert.ToInt32(dt_pericia.Rows[0]["Campanha"].ToString()); _Pericia.requisito_classe = new List <int>(Array.ConvertAll(dt_pericia.Rows[0]["requisito_classe"].ToString().Split('_'), int.Parse)); _Pericia.Treinada = Convert.ToBoolean(dt_pericia.Rows[0]["Treinada"].ToString()); _Pericia.Caracteristicas = dt_pericia.Rows[0]["Caracteristicas"].ToString(); _Pericia.Campanha = Convert.ToInt32(dt_pericia.Rows[0]["Campanha"].ToString()); _Pericia.Ativo = Convert.ToBoolean(dt_pericia.Rows[0]["Ativo"].ToString()); } return(_Pericia); }
public NotificationResult Salvar(Pericia entidade) { return(_periciaServico.Salvar(entidade)); }
public NotificationResult Excluir(Pericia entidade) { return(_periciaServico.Excluir(entidade)); }
public NotificationResult Atualizar(Pericia entidade) { return(_periciaServico.Atualizar(entidade)); }
public string Excluir(Pericia entidade) { return(pericia_Servico.Excluir(entidade)); }
public NotificationResult Salvar(Pericia entidade) { throw new NotImplementedException(); }