introduction à asp.net

50
Introduction à ASP.NET

Upload: cricket

Post on 25-Feb-2016

35 views

Category:

Documents


0 download

DESCRIPTION

Introduction à ASP.NET . Développement Web . Généralités sur le web Passage du Native apps au web apps Architecture client/server Les langages web Introduction au Web 2.0 RIA ( Rich Interface Application) Exemples . ASP. NET. Visual studio et les Frameworks Architecture et syntaxe . - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction à ASP.NET

Introduction à ASP.NET

Page 2: Introduction à ASP.NET

Développement Web

Généralités sur le webPassage du Native apps au web appsArchitecture client/serverLes langages web

Introduction au Web 2.0RIA ( Rich Interface Application)Exemples

Page 3: Introduction à ASP.NET

ASP. NET

Visual studio et les Frameworks Architecture et syntaxe

Page 4: Introduction à ASP.NET

Généralités sur le web

Native apps Vs Web apps

Page 5: Introduction à ASP.NET

Généralités sur le web

Architecture client/server

Page 6: Introduction à ASP.NET
Page 7: Introduction à ASP.NET

Développement Web

Les langages web PHP JAVA (JSP/Servlet) ASP.NET (C# / Vb)Ruby and RailsPython

Page 8: Introduction à ASP.NET

Introduction au Web 2.0

RIA ( Rich Interface Application)Social Web AJAXCSS/XHTMLWeb Service (xml ,soap,rest)

Page 9: Introduction à ASP.NET

Introduction au Web 2.0

Future HTML 5Web 3 (WebOS)

Google Chrome OS Microsoft azure

Page 10: Introduction à ASP.NET

Introduction au Web 2.0

Exempleshttp://www.beautyoftheweb.com/ http://html5demos.com

Page 12: Introduction à ASP.NET

ASP. NET

Visual studio et les Frameworks VS 2008 Framework 3.5

LINQ WCF

VS 2010 Framework 4 Microsoft Ajax Microsoft MVC WPF Silverlight

Page 13: Introduction à ASP.NET

Framework?

Page 14: Introduction à ASP.NET

ArchitectureClient / Server

Page 15: Introduction à ASP.NET

syntaxe <head> <script language= "c#" runat="server"> type

fct (type i) { … } </script> <script language= "javascript"> function f ; </script> </head> <body> <asp :Label [Propriétés]> </asp :Label> <% =fct(5) %> </body>

Page 16: Introduction à ASP.NET

Session

Session[“username"]

Page 17: Introduction à ASP.NET

User Control

<%@ Register TagPrefix="My" TagName="UserInfoBoxControl" Src="~/UserInfoBoxControl.ascx" %>

<My:UserInfoBoxControl runat="server" ID="MyUserInfoBoxControl" />

Page 19: Introduction à ASP.NET

LINQ

Language Integrated Query évolution majeure de l’accès aux données dans le Framework .NET

projet de requêtage de données LINQ To ADO.NET LINQ pour les autres type de donnée

Page 20: Introduction à ASP.NET

LINQ To ADO.NET

LINQ To DataSet Il est utile pour

obtenir une copie déconnecté de données LINQ To Entities LINQ To SQLLINQ To SQL

exécuter des requêtes sur une base de données

faire du mapping objet-relationnel

Page 21: Introduction à ASP.NET

LINQ pour les autres type de donnée LINQ To XML LINQ To Objects

Page 22: Introduction à ASP.NET

Linq to SQL

utiliser LINQ pour exécuter des requêtes SQL

LINQ transformer objects to requêtes SQL Objet/Relationnel

Page 23: Introduction à ASP.NET

Why Linq?

Syntaxe Simple limiter très fortement les risques d'injection SQL  ne nécessitent pas de connaissances

approfondies du code SQL Le compilateur ne vérifiait pas le contenu de ce

qui était entre double quotes Il n’y avait pas de vérification de type sur les

valeurs retournées

Page 24: Introduction à ASP.NET

How to linq?

Select: myDataContext db = new myDataConext()Var myprd = from p in db.productWhere p.id == 1Select p;

Page 25: Introduction à ASP.NET

How to linq?

InsertProduit prod = new Produit()Prod.price = 109Prod.desc = ‘nice product’Prod.InsertOnSubmit()Db.SubmitChanges()

Page 26: Introduction à ASP.NET

How to linq?

Updateproduct prodt;prodt = db.product.First(p => p.id == idp);prodt.title = prod.Text;prodt.desc = desc.Text;Db.SubmitChanges()

Page 27: Introduction à ASP.NET

How to linq?

Deleteproduct pppp = db.product.Single(p => p.id == 1);db.product.DeleteOnSubmit(pp);db.SubmitChanges();

Page 28: Introduction à ASP.NET

Bind Data

GridView Datalist Repeater Listdata

Page 29: Introduction à ASP.NET

Linq

Top Nvar data = (from p in people

           select p).Take(100); Skip

var data = (from p in people           select p).Skip(5).Take(100);

Page 30: Introduction à ASP.NET

Join Operators var q = from c in categories join p in products on c.Category equals p

.Category select new { myCategory = c.Category, p

.ProductName };

Page 31: Introduction à ASP.NET

Group by

var query = from product in Products            group product by StartsWith = product.ProductName[0] into myGroup

select myGroup;

Page 32: Introduction à ASP.NET

Distinct var categoryNames = (         from p in products         select p.Category)         .Distinct();

Page 33: Introduction à ASP.NET

Union  var productFirstChars =         from p in products         select p.ProductName;     var customerFirstChars =         from c in customers         select c. ProductName;       var uniqueFirstChars = productFirstChars.U

nion(customerFirstChars)

Page 34: Introduction à ASP.NET

Intersect var productFirstChars =         from p in products         select p.ProductName;     var customerFirstChars =         from c in customers         select c.CompanyName;       var commonFirstChars = productFirstChars.I

ntersect(customerFirstChars);

Page 35: Introduction à ASP.NET

Except var productFirstChars =         from p in products         select p.ProductName;     var customerFirstChars =         from c in customers         select c.CompanyName;       var productOnlyFirstChars = productFirstCh

ars.Except(customerFirstChars);

Page 36: Introduction à ASP.NET

AJAX

asynchronous JavaScript and XML HTML , XHTML , CSS = presentation XMLHttpRequest = communication Javascript = interaction

Page 37: Introduction à ASP.NET

Ajax var xmlhttp;

if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safari  xmlhttp=new XMLHttpRequest();  }else  {// code for IE6, IE5  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  }

Page 38: Introduction à ASP.NET

Ajax

xmlhttp.open("GET","ajax_info.txt",true);xmlhttp.send();

Page 39: Introduction à ASP.NET

Ajax

document.getElementById("myDiv").innerHTML=xmlhttp.responseText;

Page 40: Introduction à ASP.NET

AJAX xmlhttp.onreadystatechange=function()

  {  if (xmlhttp.readyState==4 && xmlhttp.status==200)    {    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;    }  }

Page 41: Introduction à ASP.NET

AJAX JQuery

jQuery est une bibliothèque JavaScript (comprenant AJAX) pour but de simplifier des commandes communes de JavaScriptParcours et modification du HTMLEffets et animations ;Manipulations des CSS (ajout/suppression

des classes, d'attributs…) ;AJAX ;

Page 42: Introduction à ASP.NET

animation

//Quand le document est chargé on exécute une fonction

jQuery(document).ready(function() {jQuery("#container").fadeIn("slow"); jQuery("#div_a_effacer").slideUp("fast"); });

Page 43: Introduction à ASP.NET

Syntax

$("p") $("img") $("a") // select balise HTML $("#id") //Select Element by ID $(".class") // select by class css name

Page 44: Introduction à ASP.NET

Events

Click$("button").click ( Function )<script> $("button").click(function () {Alert("hello")}); </script>

Html content$('div).html('<p>All new content. <em>You

bet!</em></p>');

Page 45: Introduction à ASP.NET

Attribute $("#myImage ").attr("title"); $("#myImage ").attr("src"); <img id="myImage" src="image.gif" alt="An image"

class="someClass" title="This is an image"/> Add Class Css

$("#myImage").addClass("selected"); Before and after $(div).before('<div class="div"></div>' );

Page 46: Introduction à ASP.NET

Ajax

$('div').bind('click', function( event ){ alert('Hi there!'); });

$('div').bind(‘keypress ', function( event ){ alert('Hi there!'); });

Page 47: Introduction à ASP.NET

AJAX  var ajax_load = "<img src='img/

load.gif' alt='loading...' />";      //  load() functions       var loadUrl = "ajax/load.php";       $("#load_basic").click(function(){           $

("#result").html(ajax_load).load(loadUrl);       }); 

Page 48: Introduction à ASP.NET

Jquery Ajax

Méthode GET $("#load_get").click(function(){      $("#result")           .html(ajax_load)           .load(loadUrl, "language=asp&version=

4");   });

Page 49: Introduction à ASP.NET

Ajax jquery

Méthode Post $("#load_post").click(function(){       $("#result")           .html(ajax_load)           .load(loadUrl, {language: "php", version

: 5});   });

Page 50: Introduction à ASP.NET

Exemple Ajax <html> <head> <title>the title</title>

<script type="text/javascript" src="/jquery/jquery-1.3.2.min.js"></script>

<script type="text/javascript" language="javascript"> $(document).ready(function() { $("#driver").click(function(event){ $('#stage').load('/jquery/result.html'); }); }); </script>

</head> <body> <p>Click on the button to load result.html file:</p> <div id="stage" style="background-color:blue;"> STAGE </div> <input type="button" id="driver" value="Load Data" /> </body> </html>