예제 #1
0
    public DataTable TraerRegistroPrestamos()
    {
        DataTable       elemento  = new DataTable();
        EElemento       dElemento = new EElemento();
        MySqlConnection conection = new MySqlConnection(ConfigurationManager.ConnectionStrings["Mybd"].ConnectionString);//conexion base de datos

        try
        {
            MySqlDataAdapter dataAdapter = new MySqlDataAdapter("sp_consultar_registrar_prestamo", conection);//proceso almancenado a usar
            dataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            conection.Open();
            dataAdapter.Fill(elemento);
        }
        catch (Exception Ex)
        {
            throw Ex;
        }
        finally
        {
            if (conection != null)
            {
                conection.Close();
            }
        }
        return(elemento);
    }
예제 #2
0
    public DataTable TraerEstado(int id)
    {
        DataTable       elemento  = new DataTable();
        EElemento       dElemento = new EElemento();
        MySqlConnection conection = new MySqlConnection(ConfigurationManager.ConnectionStrings["Mybd"].ConnectionString);//conexion base de datos

        try
        {
            MySqlDataAdapter dataAdapter = new MySqlDataAdapter("sp_mostrar_estado", conection);//proceso almancenado a usar
            dataAdapter.SelectCommand.Parameters.Add("_id", MySqlDbType.Int16).Value = id;
            dataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            conection.Open();
            dataAdapter.Fill(elemento);
        }
        catch (Exception Ex)
        {
            throw Ex;
        }
        finally
        {
            if (conection != null)
            {
                conection.Close();
            }
        }
        return(elemento);
    }
예제 #3
0
        public Carta()
        {
            this.claseCarta    = 0;
            this.elementoCarta = 0;
            this.gradoCarta    = 0;
            this.idCarta       = 0;
            this.nivelCarta    = 0;
            this.nombreCarta   = "Default";
            this.descripCarta  = "AnyDescription";

            this.ataqueFisico  = 1;
            this.ataqueMagico  = 1;
            this.defensaFisica = 1;
            this.defensaMagica = 1;
        }
예제 #4
0
    public DataTable AgregarElementos(EElemento elemento, String user)
    { //metodo para registrar Usuarios
        string          ipAddress  = Ip.GetIP();
        string          MacAddress = Mac.GetMACAddress2();
        DataTable       Elemento   = new DataTable();
        MySqlConnection conection  = new MySqlConnection(ConfigurationManager.ConnectionStrings["Mybd"].ConnectionString);//procede la conexion llamada "Mybd" ver web.config

        try
        {
            conection.Open();                                                                       //abre coneccion
            MySqlDataAdapter dataAdapter = new MySqlDataAdapter("sp_agregar_elementos", conection); //crea objeto para llamar el proceso almacenado
            dataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            dataAdapter.SelectCommand.Parameters.Add("_nombre", MySqlDbType.VarChar, 50).Value    = elemento.Nombre;
            dataAdapter.SelectCommand.Parameters.Add("_editorial", MySqlDbType.VarChar, 50).Value = elemento.Editorial;
            dataAdapter.SelectCommand.Parameters.Add("_año", MySqlDbType.Int32).Value             = elemento.Año;
            dataAdapter.SelectCommand.Parameters.Add("_tipo_id", MySqlDbType.Int32).Value         = elemento.Tipo_id;
            dataAdapter.SelectCommand.Parameters.Add("_url", MySqlDbType.VarChar, 500).Value      = elemento.Url;
            dataAdapter.SelectCommand.Parameters.Add("_cantidad", MySqlDbType.Int32).Value        = elemento.Cantidad;
            dataAdapter.SelectCommand.Parameters.Add("_reserva", MySqlDbType.Int32).Value         = elemento.Reserva;
            dataAdapter.SelectCommand.Parameters.Add("_ip", MySqlDbType.VarChar, 100).Value       = ipAddress;
            dataAdapter.SelectCommand.Parameters.Add("_mac", MySqlDbType.VarChar, 100).Value      = MacAddress;
            dataAdapter.SelectCommand.Parameters.Add("_user", MySqlDbType.VarChar, 30).Value      = user;
            dataAdapter.Fill(Elemento);
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            if (conection != null)
            {
                conection.Close();
            }
        }
        return(Elemento);
    }
예제 #5
0
        public Carta(int id, int nivel, string nombre, string descripcion, EClase clase, EGrado grado, EElemento elemento, float aFisico, float aMagico, float dFisica, float dMagica) : this()
        {
            this.Clase       = clase;
            this.Elemento    = elemento;
            this.Grado       = grado;
            this.ID          = id;
            this.Nivel       = nivel;
            this.Nombre      = nombre;
            this.Descripcion = descripcion;

            this.AtaqueFisico  = aFisico;
            this.AtaqueMagico  = aMagico;
            this.DefensaFisica = dFisica;
            this.DefensaMagica = dMagica;
        }
예제 #6
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        String nombreArchivo = System.IO.Path.GetFileName(FU_Imagen.PostedFile.FileName);
        string extension     = System.IO.Path.GetExtension(FU_Imagen.PostedFile.FileName);
        string tiempo        = DateTime.Now.ToFileTime().ToString() + extension;

        string saveLocation = (Server.MapPath("~\\Archivos\\Imagenes")) + "_" + tiempo;

        if (!(extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".png")))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Suba un archivo valido(.jpge .png .jgp)');</script>");
            return;
        }

        try
        {
            FU_Imagen.PostedFile.SaveAs(saveLocation);
        }
        catch (Exception exc)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error: ');</script>");
            return;
        }

        EElemento elemento = new EElemento();

        elemento.Nombre    = TB_Nombre.Text.ToString();
        elemento.Editorial = TB_Editorial.Text.ToString();
        elemento.Año       = Int32.Parse(TB_Año.Text.ToString());
        elemento.Tipo_id   = Int32.Parse(DDL_Tipo.Text.ToString());
        elemento.Url       = "~\\Archivos\\" + "Imagenes" + "_" + tiempo;
        elemento.Cantidad  = Int32.Parse(TB_Cantidad.Text.ToString());
        elemento.Reserva   = Int32.Parse(TB_Reserva.Text.ToString());
        if (elemento.Reserva <= elemento.Cantidad)
        {
            DAElemento cElemento = new DAElemento();

            String    tuser        = Session["nombre"].ToString();
            DataTable dataElemento = cElemento.AgregarElementos(elemento, tuser);

            EAutor      autor      = new EAutor();
            ECategoria  categoria  = new ECategoria();
            DAutores    dautor     = new DAutores();
            DACategoria dcategoria = new DACategoria();
            if (dataElemento.Rows.Count > 0)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El elemento ya esta registrado ');</script>");
            }
            else
            {
                foreach (ListItem li in CBL_Autores.Items)
                {
                    if (li.Selected == true)
                    {
                        autor.Id = Int32.Parse(li.Value);
                        dautor.AgregarRAutores(elemento.Nombre, autor.Id, tuser);
                    }
                }
                foreach (ListItem li in CBL_Categorias.Items)
                {
                    if (li.Selected == true)
                    {
                        categoria.Id = Int32.Parse(li.Value);
                        dcategoria.AgregarRCategorias(elemento.Nombre, categoria.Id, tuser);
                    }
                }
            }
            TB_Nombre.Text    = "";
            TB_Editorial.Text = "";
            TB_Año.Text       = "";
            FU_Imagen.Attributes.Clear();
            TB_Cantidad.Text = "";
            TB_Reserva.Text  = "";
            foreach (ListItem li in CBL_Autores.Items)
            {
                li.Selected = false;
            }

            foreach (ListItem li in CBL_Categorias.Items)
            {
                li.Selected = false;
            }
        }
        else
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El numero de reserva no puede exceder al de cantidad ');</script>");
        }
    }
예제 #7
0
 public CartaMitico(int id, int nivel, string nombre, string descripcion, EClase clase, EElemento elemento, float aFisico, float aMagico, float dFisica, float dMagica, ESkillsRaro sRaro, ESkillsLegendario sLegendario, ESkillsMitico sMitico) : base(id, nivel, nombre, descripcion, clase, EGrado.Mitico, elemento, aFisico, aMagico, dFisica, dMagica)
 {
     this.Skill_Legendario = sLegendario;
     this.Skill_Raro       = sRaro;
     this.Skill_Mitico     = sMitico;
 }
예제 #8
0
 public CartaStandard(int id, int nivel, string nombre, string descripcion, EClase clase, EElemento elemento, float aFisico, float aMagico, float dFisica, float dMagica) : base(id, nivel, nombre, descripcion, clase, EGrado.Standar, elemento, aFisico, aMagico, dFisica, dMagica)
 {
 }
예제 #9
0
 public CartaRaro(int id, int nivel, string nombre, string descripcion, EClase clase, EElemento elemento, float aFisico, float aMagico, float dFisica, float dMagica, ESkillsRaro sRaro) : base(id, nivel, nombre, descripcion, clase, EGrado.Raro, elemento, aFisico, aMagico, dFisica, dMagica)
 {
     this.Skill_Raro = sRaro;
 }