Exemple #1
0
        public Boolean UpdateHero(HeroeBE objHeroeBE)
        {
            connection.ConnectionString = MiConexion.GetCnx();
            command.Connection          = connection;
            command.CommandType         = CommandType.StoredProcedure;
            command.CommandText         = "ActualizarHeroe";

            command.Parameters.AddWithValue("@IdHeroe", objHeroeBE.IdHeroe);
            command.Parameters.AddWithValue("@NomHeroe", objHeroeBE.NomHeroe);
            command.Parameters.AddWithValue("@Atributo", objHeroeBE.Atributo);
            command.Parameters.AddWithValue("@Tipo", objHeroeBE.Tipo);
            command.Parameters.AddWithValue("@Complejidad", objHeroeBE.Complejidad);
            try
            {
                connection.Open();
                command.ExecuteNonQuery();
                return(true);
            }
            catch (SqlException x)
            {
                throw new Exception(x.Message);
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
                command.Parameters.Clear();
            }
        }
Exemple #2
0
 private void Hero03_Load(object sender, EventArgs e)
 {
     try
     {
         objHeroeBE          = objHeroeBL.ConsultHero(Codigo);
         txtNomHeroe.Text    = objHeroeBE.NomHeroe;
         txtAtributo.Text    = objHeroeBE.Atributo;
         txtTipo.Text        = objHeroeBE.Tipo;
         txtComplejidad.Text = objHeroeBE.Complejidad;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error : " + ex.Message);
     }
 }
        public ActionResult Update(HeroeBE objHeroe)
        {
            if (objHeroe == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (miservHeroes.HeroeUpdate(objHeroe) == true)
            {
                return(View(objHeroe));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Exemple #4
0
        public HeroeBE ConsultHero(String HeroeId)
        {
            HeroeBE objHeroeBE = new HeroeBE();

            try
            {
                connection.ConnectionString = MiConexion.GetCnx();
                command.Connection          = connection;
                command.CommandType         = CommandType.StoredProcedure;
                command.CommandText         = "ConsultarHeroe";

                command.Parameters.AddWithValue("@IdHeroe", HeroeId);

                connection.Open();
                dataReader = command.ExecuteReader();



                if (dataReader.HasRows)
                {
                    dataReader.Read();

                    objHeroeBE.IdHeroe     = Convert.ToInt32(dataReader["IdHeroe"]);
                    objHeroeBE.NomHeroe    = dataReader["NomHeroe"].ToString();
                    objHeroeBE.Atributo    = dataReader["Atributo"].ToString();
                    objHeroeBE.Tipo        = dataReader["Tipo"].ToString();
                    objHeroeBE.Complejidad = dataReader["Complejidad"].ToString();
                }
                dataReader.Close();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
                command.Parameters.Clear();
            }
            return(objHeroeBE);
        }
Exemple #5
0
 public Boolean UpdateHero(HeroeBE objHeroBE)
 {
     return(objHeroeADO.UpdateHero(objHeroBE));
 }
Exemple #6
0
 public Boolean InsertHero(HeroeBE objHeroBE)
 {
     return(objHeroeADO.InsertHero(objHeroBE));
 }