protected void gvwProductos_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridViewRow row         = (GridViewRow)gvwProductos.Rows[e.RowIndex];
        Label       lbldeleteid = (Label)row.FindControl("lblID");

        conn.OpenConection();
        conn.ExecuteQueries("delete FROM producto where id_producto=" + Convert.ToInt32(gvwProductos.DataKeys[e.RowIndex].Value.ToString()));
        conn.CloseConnection();
        gvbind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        ConexionDB conn = new ConexionDB();

        conn.OpenConection();
        conn.ExecuteQueries("insert into producto values ('" + Nombre.Text + "','" + Marca.Text + "'," + Precio.Text + ",'','" + Descripcion.Text + "')");
        conn.CloseConnection();
    }
Beispiel #3
0
 protected void LogIn(object sender, EventArgs e)
 {
     if (IsValid)
     {
         ConexionDB conn = new ConexionDB();
         conn.OpenConection();
         SqlDataReader dr = conn.DataReader("Select Id_usuario, nombre From usuario where usuario = '" + UserName.Text + "' and password = '******'");
         if (dr.HasRows)
         {
             dr.Read();
             HttpContext.Current.Session["UserId"]   = dr["Id_usuario"].ToString();
             HttpContext.Current.Session["UserName"] = dr["Nombre"].ToString();
             conn.CloseConnection();
             IdentityHelper.RedirectToReturnUrl("~/default", Response);
         }
         else
         {
             conn.CloseConnection();
             FailureText.Text     = "Usuario o password invalidos.";
             ErrorMessage.Visible = true;
         }
     }
 }
Beispiel #4
0
        public string TestConnection()
        {
            DataFramework.ConexionDB con = new ConexionDB();
            var conexion = con.ConectarDB();

            con.OpenConnection();

            if (conexion.State == System.Data.ConnectionState.Open)
            {
                string strConn = "ConnectionWorks";
                con.CloseConnection();
                return(strConn);
            }

            return("Connection Not Work");
        }