public override void alterar(EntidadeDominio entidade) { try { if (connection.State == ConnectionState.Closed) { connection.Open(); } Classe Classe = (Classe)entidade; pst.CommandText = "UPDATE Classe SET class_nome=:nome , peso=:nom WHERE class_id=:co"; parameters = new NpgsqlParameter[] { new NpgsqlParameter("nome", Classe.Nome), new NpgsqlParameter("nom", Classe.Peso), new NpgsqlParameter("co", Classe.ID) }; pst.Parameters.Clear(); pst.Parameters.AddRange(parameters); pst.Connection = connection; pst.CommandType = CommandType.Text; pst.ExecuteNonQuery(); pst.CommandText = "commit work"; pst.ExecuteNonQuery(); connection.Close(); return; } catch (Exception e) { throw e; } }
public NotificationResult Salvar(Classe entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodClasse != 0) { entidade.CodClasse = entidade.CodClasse; if (NotificationResult.IsValid) { _classeRepositorio.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 JsonResult Create(Classe classe) { classeCommand.Ajouter(classe); return(Json(null)); }
public NotificationResult Excluir(Classe entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodClasse != 0) { if (NotificationResult.IsValid) { _classeRepositorio.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 NotificationResult Atualizar(Classe entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodClasse != 0) { entidade.CodClasse = entidade.CodClasse; } if (NotificationResult.IsValid) { _classeRepositorio.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))); } }
protected void Ajouter_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(AgeDebut.Text)) { AgeDebut.Text = "0"; } if (String.IsNullOrEmpty(AgeFin.Text)) { AgeFin.Text = "0"; } Classe classe = new Classe(1, Convert.ToInt32(Niveau.Text), Nom.Text, Enseignant.Text, Convert.ToInt32(AgeDebut.Text), Convert.ToInt32(AgeFin.Text), Convert.ToString(DropDownList1.SelectedValue)); int result = ClassesDataObject.InsertClasse(classe); if (result != 0) { message.Text = "Classe '" + Nom.Text + "' créée."; } else { message.Text = "Une erreur est survenue. (Erreur: " + result + ")"; } Niveau.Text = Nom.Text = Enseignant.Text = AgeDebut.Text = AgeFin.Text = ""; message.Visible = true; ObjectDataSource1.DataBind(); GridView1.DataBind(); }
private void button1_Click(object sender, EventArgs e) { GestionClasse newclasse = GestionClasse.Instance; Classe c = new Classe(0, nomclasse.Text, Convert.ToInt32(nbPlace.Text)); newclasse.AjouterClasse(c); }
public Classes_model(string XmlFile) { XDocument myDoc = XDocument.Load(XmlFile); this.classes = new List <Classe>(); //read Classes var nodes_classes = (from n in myDoc.Descendants() where n.Name == "classes" select n).ToArray(); if (nodes_classes.Length >= 1) { //read all Class in Classes var nodes = (from n in nodes_classes.Descendants() where n.Name == "class" select n).ToArray(); foreach (XElement element in nodes) { Classe _newClasse = new Classe(); _newClasse.name = (string)element.Attribute("id"); _newClasse.parent = (string)element.Element("parent"); _newClasse.fields = new List <Field>(); _newClasse.methods = new List <Method>(); var nodes_properties = (from n in element.Descendants() where n.Name == "properties" select n).ToArray(); if (nodes_properties.Length >= 1) { _newClasse.comment = (string)nodes_properties[0].Element("comment"); _newClasse.icon = (string)nodes_properties[0].Element("icon"); } //read Fields var nodes_fields = (from n in element.Descendants() where n.Name == "field" select n).ToArray(); foreach (XElement element_fields in nodes_fields) { XNamespace ns = "http://www.w3.org/2001/XMLSchema-instance"; Field _newField = new Field(); _newField.name = (string)element_fields.Attribute("id"); _newField.name = this.UppercaseFirst(_newField.name); _newField.type = (string)element_fields.Attribute(ns + "type"); _newClasse.fields.Add(_newField); } //read Methods var nodes_methods = (from n in element.Descendants() where n.Name == "method" select n).ToArray(); foreach (XElement element_methods in nodes_methods) { if (element_methods.HasElements) { Method _newMethod = new Method(); _newMethod.name = (string)element_methods.Attribute("id"); _newMethod.name = this.UppercaseFirst(_newMethod.name); _newMethod.code = (string)element_methods.Element("code"); _newClasse.methods.Add(_newMethod); } } this.classes.Add(_newClasse); } } }
/// //////////////////////////////////////////////////// public override int GetHashCode() { if (Classe != null) { return(Classe.GetHashCode()); } return(0); }
//Deleta uma classe existente public void Deletar(int id) { Classe classeBuscada = ctx.Classes.FirstOrDefault(c => c.idClasse == id); ctx.Classes.Remove(classeBuscada); ctx.SaveChanges(); }
public IActionResult Put(int id, Classe classeAtualizada) { //Faz a chamada para o método _classeRepository.Atualizar(id, classeAtualizada); //Retorna um status code return(StatusCode(204)); }
public JsonResult Delete(int ID) { Classe cl = db.classes.Find(ID); db.classes.Remove(cl); db.SaveChanges(); return(Json(0, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Constructeur /// </summary> public Etudiant(int id, string nom, string prenom, Classe classe, DateTime dateDeNaissance) { this.Id = id; this.Nom = nom; this.Prenom = prenom; this.Classe = classe; this.DateDeNaissance = dateDeNaissance; }
public IActionResult Atualizar(int id, Classe novaClasse) { //Chama o método _classeRepository.Atualizar(id, novaClasse); //Retorna um status code return(StatusCode(204)); }
public IActionResult Post(Classe novaClasse) { // Faz a chamada para método _classeRepository.Create(novaClasse); // Retorna um status code return(StatusCode(201)); }
public async Task OnGet() { var user = await _userManager.GetUserAsync(HttpContext.User); classe = new Classe(); classe.NombreEtudiant = 0; classe.IdProf = user.Id; }
public void OnDeleteClasse() { Classe classeToDelete = Manager.Instance.GetAllClasses().Last(); Manager.Instance.DeleteClasseById(classeToDelete.Id); Assert.IsTrue(!Manager.Instance.GetAllClasses().Contains(classeToDelete)); }
public Classe GetOneClasse(int id) { ClasseQuery cq = new ClasseQuery(context); Classe c = cq.GetOne(id); c.Eleves = GetEleveByClasseId(id); return(c); }
public IActionResult Post(Classe novaClasse) { //Chama o método _classeRepository.Cadastrar(novaClasse); //Retorna um status return(StatusCode(201)); }
public ActionResult DeleteConfirmed(int id) { Classe classe = db.Classes.Find(id); db.Classes.Remove(classe); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Deletar(int id) { Classe classeBuscado = ctx.Classes.Find(id); ctx.Classes.Remove(classeBuscado); ctx.SaveChanges(); }
public static void Main() { Classe c = new Classe(); c.EventoNotificação += new Notificação(c.EventoNotificaçãoHandler); c.Método(); }
/// <summary> /// Cadastra uma nova classe /// </summary> /// <param name="novaClasse">Objeto novaClasse que será cadastrada</param> public void Cadastrar(Classe novaClasse) { //Adiciona uma nova classe ctx.Classes.Add(novaClasse); //Salva as informações para serem gravadas no banco de dados ctx.SaveChanges(); }
public void Cadastrar(Classe novaClasse) { //Cria novo cadastro ctx.Classes.Add(novaClasse); //salva o novo cadastro ctx.SaveChanges(); }
private void button2_Click(object sender, EventArgs e) { GestionClasse modifClasse = GestionClasse.Instance; Classe cla = new Classe(Convert.ToInt32(idClasse.Text), nomClasse.Text, Convert.ToInt32(nbPlace.Text)); modifClasse.ModifierClasse(cla); }
private void BoutonAjout_Click(object sender, EventArgs e) { GestionClasse suppClasse = GestionClasse.Instance; Classe cla = new Classe(Convert.ToInt32(idClasse.Text), nomClasse.Text, Convert.ToInt32(nbPlace.Text)); suppClasse.SupprimerClasse(cla); }
public IActionResult Delete(int id, int idPrefet) { Classe model = db.Classes.Find(id); db.Remove(model); db.SaveChanges(); return(RedirectToAction("Index", "Classe", new { id = idPrefet })); }
/// <summary> /// /// </summary> /// <param name="myClasse"></param> /// <returns></returns> public bool AddClasse(Classe myClasse) { using (var db = new Ef()) { db.Classe.Add(myClasse); return(db.SaveChanges() > 0); } }
public int DeleteClasseById(int id) { ClasseCommand cc = new ClasseCommand(contexte); ClasseQuerry cq = new ClasseQuerry(contexte); Classe c = cq.GetOne(id); return(cc.Supprimer(c)); }
private void ClasseCtrl_ClasseClicked(object sender, Classe e) { foreach (ClasseCtrl ctrl in _lstCalendarCtrl) { ctrl.HideInfos(); } CalendarManager.Instance.SelectedClass = e; }
public void SelecionarClasse(string current_classe) { switch (current_classe) { case "Cavaleiro": thisClasse = Classe.cavaleiro; break; case "Arqueiro": thisClasse = Classe.arqueiro; break; default: break; } SelecionarAtributos(); }
//public int spellModifications:Vector.<CharacterSpellModification>; public CharacterCharacteristicsInformations(int level, Classe breed, int aStatsPoints, int aSpellsPoints, int aKamas, int aEnergy, int aVitality, int aWisdom, int aStrength, int aIntelligence, int aChance, int aAgility) { lifePoints = (breed == Classe.Sacrieur ? 60 : 50) + (level * 5); maxLifePoints = (breed == Classe.Sacrieur ? 60 : 50) + (level * 5); statsPoints = aStatsPoints; spellsPoints = aSpellsPoints; kamas = aKamas; energyPoints = aEnergy; vitality = new CharacterBaseCharacteristic(aVitality, 0, 0, 0); wisdom = new CharacterBaseCharacteristic(aWisdom, 0, 0, 0); strength = new CharacterBaseCharacteristic(aStrength, 0, 0, 0); intelligence = new CharacterBaseCharacteristic(aIntelligence, 0, 0, 0); chance = new CharacterBaseCharacteristic(aChance, 0, 0, 0); agility = new CharacterBaseCharacteristic(aAgility, 0, 0, 0); actionPointsCurrent = level > 99 ? 7 : 6; prospecting = new CharacterBaseCharacteristic(breed == Classe.Enutrof ? 120 : 100, 0, 0, 0); initiative = new CharacterBaseCharacteristic((strength.Base + intelligence.Base + chance.Base + agility.Base) * (lifePoints / maxLifePoints), 0, 0, 0); }
public PrimeiraClasse(Ordem ordem, Classe classeAnterior = null) { Ordem = ordem; }