NEAR EAST UNIVERSITY. Faculty of Engineering



Similar documents
İNTERNET TABANLI PROGRAMLAMA- 13.ders GRIDVIEW, DETAILSVIEW, ACCESSDATASOURCE NESNELERİ İLE BİLGİ GÖRÜNTÜLEME

Website Login Integration

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

<script type="text/javascript"> var _gaq = _gaq []; _gaq.push(['_setaccount', 'UA ']); _gaq.push(['_trackpageview']);

Caldes CM12: Content Management Software Introduction v1.9

How to use SSO with SharePoint 2010 (FBA) using subdomains. Moataz Esmat EXT.1386

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Web Development 1 A4 Project Description Web Architecture

A PROJECT REPORT ON. SkyDrive. Submitted for the partial fulfillment of the requirement for the Award of the degree of MASTER OF COMPUTER APPLICATION

Cisco Adaptive Security Appliance (ASA) Web VPN Portal Customization: Solution Brief

WEB DESIGN LAB PART- A HTML LABORATORY MANUAL FOR 3 RD SEM IS AND CS ( )

Script Handbook for Interactive Scientific Website Building

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

2. Modify default.aspx and about.aspx. Add some information about the web site.

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

Creating Form Rendering ASP.NET Applications

Introduction to XHTML. 2010, Robert K. Moniot 1

HOTEL RESERVATION SYSTEM. Database Management System Project

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

Website Planning Checklist

Introduction to Web Design Curriculum Sample

HTML Tables. IT 3203 Introduction to Web Development

Introduction to ASP.NET and Web Forms

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

Tutorial #1: Getting Started with ASP.NET

Chapter 2 HTML Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Building A Very Simple Web Site

Fortigate SSL VPN 4 With PINsafe Installation Notes

Accessibility in e-learning. Accessible Content Authoring Practices

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

Web Design and Databases WD: Class 7: HTML and CSS Part 3

Create Your own Company s Design Theme

Short notes on webpage programming languages

CS412 Interactive Lab Creating a Simple Web Form

A send-a-friend application with ASP Smart Mailer

Fortigate SSL VPN 3.x With PINsafe Installation Notes

Further web design: HTML forms

Working with RD Web Access in Windows Server 2012

Guide to Integrate ADSelfService Plus with Outlook Web App

GoDaddy (CentriqHosting): Data driven Web Application Deployment

HELP DOCUMENTATION SSRPM CITRIX AND MICROSOFT TERMINAL SERVICES

Advanced Web Design. Zac Van Note.

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

Creating your personal website. Installing necessary programs Creating a website Publishing a website

LAB MANUAL CS (22): Web Technology

Embedding a Data View dynamic report into an existing web-page

Intermediate ASP.NET Web Development with C# Instructor: Frank Stepanski. Data Sources on the Web

Using Form Tools (admin)

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

ICT 6012: Web Programming

WEB PROGRAMMING LAB (Common to CSE & IT)

Database Communica/on in Visual Studio/C# using ASP.NET Web Forms. Hans- PeBer Halvorsen, M.Sc.

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

mpdf Example 37. Barcodes <?php

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS COPYRIGHT 2013 TERRY ANN MORRIS, ED.D

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

In order for the form to process and send correctly the follow objects must be in the form tag.

Programming the Web 06CS73 SAMPLE QUESTIONS

ASP.NET(C#) ile Kayıt Listeleme, Silme ve Düzenleme İşlemi

How to Create a Mobile Responsive Template in ExactTarget

How to code, test, and validate a web page

ITNP43: HTML Lecture 4

Visualization: Combo Chart - Google Chart Tools - Google Code

HTML Form Widgets. Review: HTML Forms. Review: CGI Programs

Campaign Guidelines and Best Practices

Client-side Web Engineering From HTML to AJAX

Installation and Integration Manual TRANZILA Secure 5

Dynamic HTML: Filters and Transitions

HTML Forms and CONTROLS

Web Server Lite. Web Server Software User s Manual

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

To be able to use web parts to create a portal-style web application

AJAX The Future of Web Development?

Appendix for Tx5xx and P85x1 manuals

Installation & Configuration Guide Version 2.2

Caldes CM2: Marketing s Support Document v1.12

Visualizing an OrientDB Graph Database with KeyLines

Advanced Drupal Features and Techniques

The McGill Knowledge Base. Last Updated: August 19, 2014

Chapter 22 How to send and access other web sites

So we're set? Have your text-editor ready. Be sure you use NotePad, NOT Word or even WordPad. Great, let's get going.

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

How to Properly Compose HTML Code : 1

Visualizing a Neo4j Graph Database with KeyLines

Kentico CMS 7.0 Tutorial ASPX

Transcription:

NEAR EAST UNIVERSITY Faculty of Engineering Department of Computer Engineering ONLINE BOOKING SYSTEM Graduation Project COM 400 Students: İSKliR CİHAN (20031426) Supervisor: ÜMİT SOYER Nicosia - 2008

ACKNOWLEDGMENT "First i would like to thank my supervisor Umit Sayer for his invaluable advice and belief in my work and myself over the course fo this Graduation Project.. Second, I would like to express my gratitude to Near East University for the scolarship that made the work possible. Third, I thank my family for their constant encouragement and support during the preparetion of this project. Finally I would also like to thank all my friends Nadeem and Serkan for their advice and support."

LIST OF ABBREVIATIONS NEU Near East University WWW World Wide Web OMS Database Management Systems SQL Structured Query Language ASP Active Server Pages.NET.NET Framework C# C sharp ii

TABLE OF CONTENTS ACKNOWLEDGMENT i LIST OF ABBREVIATIONS ii TABLE OF CONTENTS iii INTRODUCTION 1 CHAPTER 1 : MASTER PAGES 2 1.1 - MASTER PAGE 2 1.1 -a) BaşSayfa.Master 2 1.1-b) CODE ASP FOR MASTER PAGE başsayfa.master 2 1.1 -c) CODEC# FOR MASTER PAGE başsayfa.master 4 CHAPTER 2 : ALLUSERS PAGES 5 2.1 - FOR GUESTS Anasayfa.aspx... 5 2.1 - a ) ASP CODE FOR GUEST Anasayfa.aspx 5 2.2 - FOR Admin Anasayfa.aspx 7 2.2 - a ) ASP CODE FOR Admin Anasayfa.aspx 7 2.2 - b ) C# Code FOR Anasayfa.aspx 8 2.3 - Search.aspx!" 9 2.3 - a ) ASP CODE FOR Search.aspx... 10 2.3 - b) C# CODE FOR search.aspx... 11 2.4 - Hesap.aspx 12 2.4 - a ) ASP CODE FOR hesap.aspx 12 2.4 - b ) C# CODE FOR hesap.aspx 15 2.4 - c) Continue to hesap.aspx and Complete to create user 16 2.5 - Login Page 17 iii

2.5 - a ) ASP CODE FOR Login.aspx... 17 2.5 - b ) C# CODE FOR Login.aspx... 19 2.6 - ÜrünSeçme.aspx Page... 20 2.6 - a) ASP CODE FOR UrunSecme.aspx...21 2.6 - b ) C# CODE FOR UrunSecme.aspx... 25 2.7 - Sepet PAGE... 26 2.7 - a ) ASP CODE FOR Sepet.aspx 26 2.7 - b ) C# CODE FOR Sepet.aspx 28 2.8 - SatınAI PAGE... 29 2.8 - a) ASP CODE FOR SatınAl.aspx 29 2.8 - b) CODEC# FOR SatınAl.aspx 31 CHAPTER3: ONLY ADMIN PAGES 33 3.1 - PAGE KategoriEkle.aspx 33 3.1 - a ) ASP CODE FOR KategoriEkle.aspx... 33 3.1 - b ) C# CODE FOR KategoriEKle.aspx... 36 3.2 - PAGE MarkaEkle.aspx... 37 3.2 - a) ASP CODE FOR MarkaEkle.aspx... 37 3.2 - b) C# CODE FOR MarkaEkle.aspx 40 3.3 - PAGE ModelEkle!'\. 41 3.3 - a ) ASP CODE FOR ModelEkle.aspx... 41. 3.3 - b) C# CODE FOR ModelEkle.aspx 45 3.4 - PAGE UrunEkle.aspx... 46 3.4- a) ASP CODE FOR UrunEkle.aspx 47 3.4- b) C# CODE FOR UrunEkle.aspx 49 CHAPER4: CONFIGURATION PAGES...51 iv

4.1 - CONFIGURATION FOR ADMIN PAGES...51 4.1 - a ) PAGE Web.config...51 4.2 - CONFIGURATION FOR ALL USERS 52 4.2 - a ) PAGE web.config 52 CHAPTER 5: WORK ENVIRONMENT 53 CHAPTER 6: TABLES 54 6.1 - APLICATION TABLE 54 6.2 - MEMBERSHIP TABLE 54 6.3 - PATH TABLE...55 6.4 - PERSONALIZATION ALLUSER TABLE... 55 6.5 - PERSONALIZATION PER USER TABLE... 55 6.6 - PROFILE TABLE 56 6.7 - ROLES TABLE 56 6.8 - SCHEMA TABLE 56 6.9 - USERS TABLE 56 6.10 - USERSINROLE TABLE... 57 6.11 - WEB EVENT TABLE 57 6.12 - KATEGORiTABLE!L 58 6.13 - MARKA TABLE 58. 6.14 - MODEL TABLE 58 6.15 - MODELOZELLIK TABLE 58 6.16 - SEPET TABLE... 59 6.17 - URUN TABLE... 59 CHAPER 7: QUERIES AND DESIGNS AND RESULTS FOR VIEWS 60 V

7.1 - DETAY VIEWS 60 7.1-a) RESULT... 61 7.2 - SEPET VIEW 61 7.2 - a) RESULT... 62 7.3 -APPLICATIONS VIEW 63 7.4 - MEMBERSHIPUSERS VIEW 64 7.5 - PROFILES VIEW 64 7.6 - ROLES VIEW... 65 7.7 - USERS VIEW 65 7.8 - USERSINROLES VIEW... 65 7.9 - PATHS VIEW 65 7.10 - SHARED VIEW 65 7.11 - WEBPARTUSERS VIEWS 66 CHAPTER 8 : STORED PROCEDURES 67 8.1 - ANYDATAINTABLES 67 8.2 - CREATE APLICATION 69 8.3 - CHECHSCHEMAVERSION 70 8.4 - EDITMEMBERSHIP 71 8.5 - CREATEUSER 72 8.6 - FINDUSERBYEMAIL!':.................. 76 8.7 - FINDUSERSBYNAME... - 78 8.8 - GETALLUSERS... 79 8.9 - GETNUMBEROFUSERSONLINE 80 8.10 - GETPASSWORD 81 8.11 - GETPASSWORDWITHFORMAT 82 8.12 - GETUSERSBYEMAIL... 83 8.13 - GETUSERBYNAME 84 vi

8.14 - GETUSERBYUSERID... 85 8.15 - RESETPASSWORD 86 8.16 - SETPASSWORD 89 8.17 - UNLOCKUSERS 89 8.18 - UPDATEUSERS 90 8.19 - UPDATEUSERINFO... 92 8.20 - CREATEPATH... 96 8.21 - GETAPPLICATIONID... 96 8.22 - DELETEALLSTATE 97 8.23 - FINDSTATE... 97 8.24 - GETCOUNTOFSTATE... 100 8.25 - RESETSHAREDSTATE... 101 8.26 - RESETUSERSTATE 101 8.27 - GETPAGESETIINGS... 102 8.28 - RESETPAGESETIINGS... 103 8.29 - SETPAGESETIINGS 104 8.30 - PERUSERGETPAGESETIINGS 105 8.31 - PERUSERRESETPAGESETIINGS 106 8.32 - PERUSERSETPAGESETIINGS 107 8.33 - DELETEINACTIVEUSERS!'\......... 108 8.34 - DELETEPROFILES 109. 8.35 - GETNUMBEROFINACTIVEUSERS 110 8.36 - GETPROFILES... 111 8.37 - GETPROPERTIES 113 8.38 - SETPROPERTIES 113 8.39 - REGISTERSCHEMAVERSIOPS... 116 8.40 - CRETAEROLES 116 vii

8.41 - DELETEROLES 118 8.42 - GETALLROLES 120 8.43 - ROLEEXISTS 120 8.44 - REMOVEALLROLEMEMBERS... 121 8.45 - RESTOREPERMISSIONS 122 8.46 - UNREGISTERSCHEMAVERSION 122 8.47 - CREATEUSER 123 8.48 - DELETEUSER 124 8.49 - ADDUSERSTOROLES 127 8.50 - FINDUSERSINROLES... 130 8.51 - GETROLESFORUSERS 130 8.52 - GETUSERSINROLES 131 8.53 - ISUSERINROLES 132 8.54 - REMOVEUSERSFROMROLES 133 8.55 - LOG EVENT 136 CHAPTER 9 : TEN TERMS 138 9.1 - You Look Smart 138 9.2 - Web Application 138 9.3 - Developer 138 9.4 - Data-Driven...!' 139 9.5 - ASP.NET 2.0... 139 9.6 - Visual Studio... 139 9.7 - IDE 140 9.8 - Control 140 9.9 - Code 141 9.10 - Programmatic 141 9.11 - Database 142 viii

CHAPER 10: TEN ALTERNATIVESTO BEING HELPLESS 144 10.1 - Microsoft Developer Network (MSDN) 144 10.2 - HTML Home Page 145 10.3 - Cascading Style Sheets Home Page... 145 10.4 -ASP.NET Forums 146 10.5 - SQL Server Developer Center 146 10.6 - Dotnetjunkies 146 10.7 - Microsoft Technical Communities 147 CONCLUSION 148 REFERENCES 149 ix

INTRODUCTION The Objective of this project is to build a Web Based Online System.The Project consists introduction nine chapter nad conclusion. Chapter one presents the architecture of MASTER PAGE Chapter two presents the architecture of ALLUSER PAGES Chapter three presents the architecture of ONLYADMIN PAGES Chapter four presents the architecture of CONFIGURATION PAGES Chapter five describes WORK ENVIRONMENT Chapter six describes the TABLES Chapter seven describes QUERIES AND DESIGNS AND RESULTS FOR VIEWS Chapter eight describes the PROCEDURES Chapter nine describe some definition TEN TERMS 1

CHAPTER 1: MASTER PAGES l.j 1. r.ı CODE ASP rou MASnmPAGE <:,%:@ Master Language="C#" AutoEventWireup="true" CodeFile="BaşSayfa.master.cs" Inherits="BaşSayfa" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/l999/xhtml" > <head runat="server"> <titlec-untitled Page-c/title> <script languagee'javascript" typee.'fext/javascript"> <!-- function DIVl_onclick() { II--> </script> <zhead> <body> <form id="forml" runat="server"> <div> <br I> <br I> <brl> 2

<ldiv> <div id="divl" style="z-index: 100; left: Opx; width: 102%; position: absolute; top: Opx; height: 200px; background-color: gainsboro" language="javascript" onclickevreturn DIVl_onclick()"> <div styleez-index: 100; left: 544px; width: 120px; position: absolute; top: 8px; height: 112px11> <asp.login View ID=11Login View 111 runat=cserver"> <LoggedlnTemplate> Hoşgeldin &nhsp; <br I> için <asp:loginname ID=11LoginNamel II runat='tserver" Style="z-index: 100; left: 72px; position: absolute; top: 24px11 I> <asp:loginstatus ID=11LoginStatus211 runat="server" LogoutTexteçıkış" Style="z-index: 102; left: 8px; position: absolute; top: 40px" I> <!Lo ggedln Template> «Anonymous'Iemplate> hoşgeldin misafir <asp:loginstatus ID="LoginStatus 111 runat='tserver" Login'Text=t'giriş" Style="left: Opx; position: static; top: Opx" I> için <a href="hesap.aspx">üye <la>olmak için &ııbsp; <I AnonymousTemplate> </asp:login View> <zdiv> <img srceresimler/logosgif" runat=server style=z-index: 101; left: 216px; position: absolute; top: 16px" I> <a href="anasayfa.aspx">ana Sayfa-c/ac-c/div> II <asp:contentplaceholder id="contentplaceholderl nmat="server"> <I asp: contentplaceholder> <!form> <!body> <!html> 3

1.1 -c) CODEC# FOR MASTER PAGE using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class BaşSayfa: System.Web.UI.MasterPage { protected void Page_Load(object sender, EvcntArgs e) { 4

CHAPTER 2 : ALLUSERS PAGES 2 z.ı - a ) ASP CODE FOR GUEST,s,%@ Page LanguageeCs" MasterPageFile=11-/BaşSayfa.master11 Autofivcntwireupetrue" CodefiilceAnaôayfa.aspx.cs'' InhcritseAuaxayfa" Titlee.Untitled Page" %> II 11 <asp.content ID=11Contentl ContentPlaceHolderID=11ContentPlaceHolderl Runat="Server"> <div sıyle='z-index: 100; left: 464px; width: loopx; position: absolute; top: 288px; height: loopx"> <asp:login View ID=11Login View 1" runatevserver"> <RoleGroups> <asp:rolegroup RoleseAdmin"> <Content'I'emplate> <a href= 11 AdminPages/KategoriEkle.aspx 11> Kategori Ekle-c/a> 5

<a hrcf="adminpages/urunekle.aspx">ürün Ekle<la> <a href="adminpages/markaekle.aspx">marka Ekle-c/a> <a href="adminpages/modelekle.aspx">model Ekle-c/a> -c/content'i'emplate> <lasp:rolegroup> <IRoleGroups> <Anonymous Template> <I AnonymousTemplate> -c/asp.login View> «/div» <br I> <a hrcf="adminpages/kategoriekle.aspx"> <br I> <la> <a hrefe.search.aspx'c-arac/a> <br Z> <br I> <a href="urunsecme.aspx">ürün Seçme<la><br I> <br I> <lasp:content> 6

2 Doşye Dü~en Görünüm.~eçmiŞ Y~r İmi.er[ Ar.açlar )'.,ardım Kategori Ek.le Ürün Seçme Model.Ekle. <1 ı@ Page Language="C#11 MasterPageF'ile="-/BaşSayfa.master11 Autoliventwireupetrue" CodeFile="AnaSayfa.aspx.cs" InheritseAnaxayfa" Titlee.'Tlntitled Page" %> II 11 <asp.content ID="Contentl ContentP1aceHo1dcr1D="ContentPlaceHolderl Runat='Eerver''> <div style="z-index: 100; left: 464px; width: loopx; position: absolute; top: 288px; height: loopx11> -casp.login View ID="Login View l" runate+server"> <RoleGroups> <asp:rolegroup Roles="Admin"> <ContentTemplate> <a href= 11 AdminPages/Kate goriekle. aspx" >Kategori Ekle</ a> -cbr I> <a href=11adminpages/urunekle.aspx">ürün Ekle-c/a> 7

<br I> <a href="adminpages/markaekle.aspx">marka Ekle-c/a> <br I> <br I> <a href="adminpages/modelekle.aspx">model Ekle-c/a> <IContentTemplate> <lasp:rolegroup> </Rol egrou ps> <Anonymous'Template> <I AnonymousTemplate> <lasp:login View> <Zdiv> <br I> <a href=" AdminPages/KategoriEkle.aspx "> <br Z> <la> <a hrefesearch.aspx'c-ara-c/a> <br I> <a hrcfeururıxecme.aspx'c-ürün Seçme-c/ac-cbr I> <br I> <br I> <br I> <br I> </asp:content> --------------------------------------"------------------------------------------------------------------- using System; using System.Data; using System.Configuration; using System. Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web.UI.WebControls; 8

using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class AnaSayfa: System.Web.Ul.Page { protected void Page_Load(object sender, EvcntArgs e) { Doşye Dü~e'n ~ö~ür:ıü.ın 2eçrniŞ Y~~ İml~r[ Araçlar t_ar'dır'n windowsoriiinel l)rün Avantajı Sis.teminiz risk altında olabilir. BuWindowskopvesr,orijinal Windows doğrulamasındcm geçmedi. Microsoft tarafından sağlananpekçokyükseltmeyi almak için doğrulama gereklidir. Bu sorunla!j!»jll!l!l!l!l/!l/!l/!l/!l/!1/!l!l!lll!l!lljilgili yardım almakiçin~tıklatın. 9

2.3 - a} ASP CODE FOR <%@ Page Language="C#" MasterPageFile="-/BaşSayfa.master" AutoEvent\Vireup="true" CodeFilc="Search.aspx.cs" InheritseSearch" Title='Tlntitled Page",%> <asp.content ID="Contentl" ContentPlaceHoldedD="ContentPlaceHolderl" Runat=" Server"> <asp:textbox ID="TextBoxl" runat=''server" Stylee-z-index: 100; left: 392px; position: absolute; top: 304px "><lasp:textbox> <asp:sqldatasource ld="sqldatasourcel II runat="server" Connections tring= ";<%$ ConnectionStrings:M yconnection %> 11 SelectCommand="SELECT [KategoriAdi], [UrunAdi], [MarkaAdi], [ModelAdi] FROM [DetayView] WHERE (([KategoriAdi] = @KategoriAdi) OR ([UrunAdi] = @UrunAdi) OR ([MarkaAdi] = @MarkaAdi) OR ([ModelAdi] = @ModelAdi)) ORDER BY [MarkaAdi], [ModelAdi]"> <Selectf'arameters> <asp:controlparameter ControlID="TextBoxl" Name="KategoriAdi" Propcrtylvamev'Text" I> <asp:controlparameter ControlID="TextBox 1" Name="UrunAdi" PropertylvaıneeText" I> <asp:controlparameter ControlID="TextBoxl" Name="MarkaAdi" PropertyName="Text" I> <asp:controlparameter ControlID="TextBoxl" Name="ModelAdi" PropertyName="Text" I> <ISelectParameters> <lasp:sqldatasource> <asp:button ID="Buttonl" runat='tserver'' OnClick="Buttonl_Click" Stylc="z-index: 101; left: 280px; position: absolute; top: 304px" Text=Ara'' I> <br I> <asp.grid View ID="GridViewl" runate+server" Autofieneratef.olumns=t'False" DataS0urccJD=11SqlDataS0urcel" Stylee=z-index: 103; left: 376px; position: absolute; top: 360px"> <Columns> <asp:boundfield Datal-ieldeKategori Adi'' HeaderText=''KategoriAdi" SortlixpressioneKategori Adi'' I> <asp:boundfield DataField=11UrunAdi" HeaderText=11UrunAdi" SortExpression="UrunAdi" I> <asp:boundfield DataField= "Marka.Adi" HeaderText= "MarkaAdi" SortExpression= "MarkaAdi" I> 10

<asp:boundfield DataField= "ModelAdi" HeaderText= "ModelAdi" SortExpression="ModelAdi" I> </Columns> <lasp:gridview> <br I> <lasp:content> 2.3 - b ] C# CODE FOR using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.Ul; using System.Web.DI.WebControls; using System.Web.DI.WebControls.WebParts; using System.Web.Ul.HtmlControls; public partial class Search: Systern.Web.Ul.Page { protected void Page_Load(object sender, EventArgs e) { protected void Buttonl_Click(object sender, EventArgs e) { GridView1.DataBind(); 11

2.4 - a) ASP CODE FOR ~7 @ Page Language="C#" MasterPageFile="-/BaşSayfa.master" AutoEventWireup="true" Codef'ileeHesap.aspx.cs" Inherits="Hesap" Title="Untitled Page"%> <asp:content ID="Contentl" ContentPlaccHoldcrID="ContentPlaceHolderl" Runat="Scrver"> <asp:createuserwizard ID="CreateUserWizardl" runat="server" OnCreatcd User='' Create User Wizard l _Created User" Style='tz-index: 100; left: 16px; position: absolute; top: 272px"> <Wizards teps> <asp: Create UserW izards tep run at=" server"> <Content'I'emplate> <table bordcr="o"> <tr> <td align="center" colspan="2" style="height: 21 px"> 12

yeni hesab oluşturrna-c/td> <!tr> <tr> <td align="right"> <asp.label ld="usernamelabel" runat="server" AssociatedControlID="UserName">kullanıcı adı-c/asp.labeb-c/td> <tel> <asp:textbox ID="UserName" runat="server"><lasp:textbox> <asp:requiredfieldvalidator ID=''UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="CreateUserWizardl ">*<lasp:requiredfieldvalidator> <ltd> <!tr> <tr> <td align="right"> -casp.label ID="PasswordLabel" runat="server" AssociatedControlID=''Password''>şifre<lasp:Label><ltd> <td> <asp:textbox ld="password" runat="server" TextMode="Password"></asp:TextBox> <asp:requiredfieldvalidator ID="PasswordRequired" run at=" server" ControlTo Validate= "Password" Errorlvlessage='Password is required." TooITip="Password is required." ValidationôroupeCreatel,' serwizardl ">*</asp:requiredfieldvalidator> <ltd> <ztr> <tr> <td align="right"> <asp.label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">şifre tekrarı<lasp:label><ltd> <td> <asp:textbox ID="ConfirmPassword" runat="server" TextMode="Password"><lasp:TextBox> <asp:requiredfieldvalidator ID="ConfirmPasswordRequired" run at=" server" Control'I'o'Validate> "ConfirmPassword" ErrorMessage="Confirm Password is required." TooITip="Confirm Password is required." ValidationGroup= "Create User Wizard 1 ">*</asp:requiredfieldv alidator> <ltd> <!tr> <tr> <td ajign="right"> <asp.label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:<lasp:Label></td> <td> <asp:textbox ID="Email" runat="server"></asp:textbox> <asp:requiredfieldvalidator ID="EmailRequired" runat="server" ControITo Validatc="Email'' 13

ErrorMessage="E-mail is required." ToolTip="E-mail is required." ValidationGroup="CreateU serwizard 1 ">*<lasp:requiredfieldvalidator> <ltd> <!tr> <tr> <td align="right"> <asp:label ID="QuestionLabel" nmat="server" AssociatcdControHD="Question">güvenlik sorusu-c/asp.labelc-x/td> <td> <asp:textbox ID="Question" nmat="server"><lasp:textbox> <asp:requiredfieldvalidator ID="QuestionRequired" run at=" server" ControlToValidate=" Question" ErrorMessage="Security question is required." ToolTip="Security question is required." VaLidation(}roup="CreateU serwizard l ">*<lasp:requiredfieldvalidator> <ltd> <!tr> <tr> <td align="right"> -casp.label ID="AnswerLabel" runat="server" AssociateclControlID="Answer">güvenlik cevabı<lasp:label><ltd> <td> <asp:textbox ID="Answer" runat="server"><lasp:textbox> <asp:requiredfieldvalidator ID="AnswerRequired" runat="server" Control'To Valiclate="Answer" ErrorMessage="Security answer is required." ToolTip="Security answer is required." ValidationGroup="CreateUserWizardl">*<lasp:RequiredFieldValidator> <ltd> <!tr> <tr> <td align="center" colspan="2"> <asp: Compare Validator ID= "PasswordCompare" run at=" server" Control'Tot.omparee'Password' ControlTo Validate="ConfirrnPassword" Display= "Dynamic" ErrorMessagc="şifre ve şifre tekrarı uyumsuz" ValidationGroup="CreateUserWizardl "e-c/asp.compare'validator> <ltd> <ztr> <tr> <td align="center" colspan=l'z" style="color: red"> <asp:literal ID="ErrorMessage" runat="server" Enable Views tate="false "><lasp:literal> <ltd> «/tr» -otable> <IContentTemplate> 14

<I asp: Create DserWizardStep> <asp:completewizardstep runat="server"> <ContentTemplate> <table horder="o"> <tr> <td align="center" colspan="?"> tamamlandı <ltd> <!tr> <tr> <td> hesabınız başarılı bir şekilde oluşturuldu.c/td> <!tr> <tr> <td align="right" colspan="2"> <asp.button ID="ContinueButton" runat="server" Causes Validation="False" CommandNamc="Continue" PostBackUrl="-/AnaSayfa.aspx" Text="devam" ValidationGroup="CreateUserWizardl" I> <ltd> <!tr> <!table> <IContentTemplate> <lasp:complete WizardStep> <IWizardS teps> <lasp:createdserwizard> <hr I> <lasp:content> using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web.DI.WebControls; using System.Web.DI.WebControls.WebParts; using System.Web. Ul.Html Controls; public partial class Hesap: System.Web.Ul.Page { ıs

protected void Page_Load( object sender, EventArgs e) { protected void CreateUserWizardl_CreatedUser(object sender, EventArgs e) { Roles.AddUserToRole(CreateUserWizardl.UserName, "SiteUye"); 2.4 - c ] Continue to to create user Doşye Düien Görünüm.eçmiş V~.r 'imleri Araçlar t_ardım tamamlandı hesabınız başarılı bır şekilde oluşturuldu. ~ 16

2 Giriş yapmak için lütfen kullanıcı adınızı ve şifrenizi doğru bir şekilde giriniz Kul!anıti.6.dı Şifre CJ.seni ı~atırla 2.5 - a) ASP CODE FOR ::5%@ PageLanguagc="C#" Ma~tcrPagcFilc="-/BaşSayfa.master" AutoEventWircup="true" CodcFilc="Login.aspx.cs" Inheritse'Login'' 'I'itle='Tfntitled Page"%? <asp:content ID="Contentl" ContentPlaceHolderID="ContentPlaceHolderl" Runat="Server"> ' <asp.login ld="loginl" runat="server" BackColor="#EFF3FB" BorderColor="#B5C7DE" BorderPadding="4" BorderStyle= "Solid" Border\Vidth=" 1 px" Font-Names= "Verdana" Font Sizce "0. 8em" ForeColor="#333333" Stylc="z-index: 100; left: 40px; position: absolute; top: 360px"> <TextBoxStyle Font-Size="0.8em" I> <LoginButtonStyle BackColor="White" BorderColor="#507CD1" Borderxtylee" Solid" Border Width='' 1 px" Font-Names=Verdana" Font-Size="0.8em" ForeColor="#284E98" I> <Layout'Template> 17

<table border="o" cellpaddingevl" cellspacing='d" style="border-collapse: collapse"> <tr> <td> <table border="o" cellpaddinge-'d"> <tr> <td align="center" colspan="2" styleefont-weight: bold; font-size: 0.9em; color: white; background-color: #507cdl "> Log In-c/td> <ztr> <tr> <td align="right"> <asp.label ID="UserNameLabel" runat="server" AssociatcdControIID= "UserN ame ">Kullanıcı Adı : <lasp:label><ltd> <td> <asp:textbox ID="UserName" runat="server" Font Size="0.8em"><lasp:TextBox> <asp:requiredfieldvalidator ID="U sern amerequired" runat="server" ControlToValidatc="UserName" ErrorMessagc="User Name is required." ToolTip="User Name is required." ValidationGroup="Loginl ">*<lasp:requiredfieldvalidator> <ltd> <!tr> <tr> <td align="right"> <asp.label ID="PasswordLabel" runat="server" AssociatcdControlID= "Password "c-şifre : -c/asp:labeb-c/td> <td> <asp:textbox ID="Password" runat="server" Font-Size="0.8em" TextMode="Password ''><lasp:textbox> <asp:requiredfieldvalidator ID="PasswordRequired" run at=" server" Control'To'Validatee "Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login 1 ">*<lasp:requiredfieldvalidator> <ltd> ıı. <!tr> <tr> <td colspan="2"> <asp:check:box ID="RemembcrMe" runat="servcr" Text="Beni Hatırla" I> <ltd> <ztr> <tr> <td align="center" colspan="2" style="color: red"> <asp:literal ID="FailureText" runat="server" EnahleVic\vStatc="False"><lasp:Literal> <ltd> <ztr> <tr> 18

<td align="right" colspan="?"> -casp.button ID="LoginButton" runat="server" BackColor="White" BorderColor="#507CD1" BorderStyle="Solid" BordcrWidth=" lpx" CommandName="Login" Font-NameseVerdana'' Font-Sizc="0.8em" ForcColor="#284E98" Text="Giriş" ValidationGroup="Login 1" I> <ltd> </tr> <ztable> <ltd> <ztr> </table> <ILayoutTemplate> <lnstructiontextstyle Font- Italic= "True" ForcColor= "Black" I> <TitleTextStyle BackColor="#507CD1" Font-Bold="True" Font-Sizc="0.9em" ForeColor="White" I> <lasp:login> <br I> Giriş yapmak için lütfen kullanıcı adınızı ve şifrenizi doğru bir şekilde giriniz... <br I> <br I> <br I> <br I> <br I> <br I> -c/asp.content> --------------------------------------.A.------------------------------------------------------------------ using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web. UI. W ebcontrols; using System.Web.UI.WebControls.WebParts; 19

using System.Web.UI.HtrnlControls; public partial class Login : Systern.Web.Ul.Page { protected void Page_Load(object sender, EventArgs e) { Kategori Urı:ın Marka Model Label [.Sepete Eki~ J [ Sepete Git) 20

2.6 - a) ASP CODE FOR <~.@ Page Language="C#" MasterPageFile="-/BaşSayfa.master" Autobventwireupetrue" CodeFile="UrunSecme.aspx.cs" Inherits="UrunSecme" Titlc="Untitled Page" ff > II <asp.content ID=11Contentl ContentPlaceHo1der1D="ContentPlaceHolderl" Runat="Server"> II <asp:dropdownlist ID="DropDownListl runate+server" AutoPostBack="True" DataSourceID="SqlDataSourcel" DataTextField="KategoriAdi" DataVaiueField="KategoriAdi'' Style="z-index: 100; left: 200px; position: absolute; top: 328px" Width="104px"> </asp:dropdownlist> <asp:dropdownlist ID="DropDownList2" runat=''server" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTcxtField= "Urun Adi" Data Valuef'ield= "Urun Adi" Height= "22px" Style= "zindex: 101; left: 330px; position: absolute; top: 328px" Width=" 104px"> <lasp:dropdownlist> <asp:dropdownlist ID="DropDownList3" runat="server" AutoPostBack="True" DataSourceID= "SqlDataSource3" DataTextField="MarkaAdi" Data ValueField="MarkaAdi" Height=1122px11 Style="z-index: 102; left: 460px; position: absolute; top: 328px" Width=" 104px11> <lasp:dropdownlist> <asp:dropdownlist ID=11DropDownList411 runateserver" Autof'ostlracke'True" DataSourceID=" Sqll'ıataôource-t" DataTextField="ModelAdi" Data ValueField=11ModelAdi" Height="22px11 Style='tz-index: 103; left: 592px; position: absolute; top: 328px11 Widthe " 104px"> <lasp:dropdownlist> <asp.label 1D="Label2" runat="server" Style="z-index: 104; left: 330px; position: absolute; & top: 288px" Text="Ürün" Wiclth="104px"></asp:Label> -casp.label ID=11Label3" runat="server" Stylc="z-index: 105; left: 460px; position: absolute; top: 288px11 Text="Marka11 Width="104px"></asp:Label> <asp.label ID="Label511 runate 'xerver" Height=1119px" Style="z-index: 106; left: 712px; position: absolute; top: 288px11 Text=Label" Widthe" 104px11></asp:Label> «asp.label ID="Label4" runat='tserver" Styleez-index: 107; left: 200px; position: absolute; top: 288px" 'Iext=Kategori" Width="104px"><lasp:Label> <asp:sqldatasource ID=11SqlDataSource4" runat='tserver" ConnectionString=''<%$ ConnectionStrings:MyConnection %>" 21

SelectCommand=11SELECT [ModelAdi] FROM [DetayView] WHERE (([MarkaAdi] = @MarkaAdi) AND ([UrunAdi] = @UrunAdi)) ORDER BY [ModelAdi]11> <SelectParameters> <asp :ControlParameter ControHD= "Dropfrownl.istô 11 Name= "Marka.Adi 11 Propertylvarrıe=+Selected Value" Type="String" I> <asp:controlparameter Contro1ID="DropDownList2" Name="UrunAdi" Propertylv ame=" Selected Value" Type="String" I> </SelectParameters> <lasp:sqldatasource> <asp:label ID=11Labell II nmat="server" Style="z-index: 108; left: 592px; position: absolute; top: 288px11 TexteModel'' Width="104px11></asp:Label> <asp: SqlDataSource ID= 11 SqlDataSource3 11 run at= 11 server" ConnectionString= 11 <~$ ConnectionStrings:MyConnection %>" SelectCommand=11SELECT DISTINCT [MarkaAdi] FROM [DetayView] WHERE ([UrunAdi] = @UrunAdi) ORDER BY [MarkaAdi]"> <Selectf'arameters> <asp:controlparameter ControLID="DropDownList211 Namce=UrurrAdi" PropertyName="SelectedValue" Type="String" I> </SelectParamctcrs> </asp:sqldatasource> <asp:sqldatasource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnection %>11 SelectCommand="SELECT DISTINCT [UrunAdi] FROM [DetayView] WHERE ([KategoriAdi] = @KategoriAdi) ORDER BY [UrunAdi]"> <Selectl-arameters> <asp:controlparameter GontrolID="DropDownListl" Name="KategoriAdi" PropertyName="SelectedValue" Type="String" I> </SelectParameters> <lasp:sqldatasource> <br I> <asp:sqldatasource ID="SqlDataSourcel" runat='tserver" ConnectionString=1\<%$ ConnectionStrings:MyConnection %>11 SelectCornmand=11SELECT DISTINCT [KategoriAdi] FROM [Detay View] ORDER BY [KategoriAdi]"> </asp:sqldatasource> <br I> 11 <asp:details View ID="Details View 1" runat="server" Autofieneratelcows=r'False DatakeyblameseModel Adi" 22

DataSourceID="SqlDataSource5" Height="50px" Style="z-index: 109; left: 200px; position: absolute; top: 392px" \Vidth="504px"> <Fields> <asp:boundfield DataField= "ModelAdi" HeadcrTcxt= "ModelAdi" ReadOnly="True" SortExpression="ModelAdi" I> <asp:boundfield DataField= "Model Ozellikleri" HcadcrTcxt="Model Ozellikleri" SortExprcssion= "Model Ozellikleri" I> <asp.bou ndfield Dataf'ield= "ModelFi yatı" HcaderTcxt= "ModelFi yatı" SortExpression="ModelFiyatı" I> <asp:boundfield DataFielcl=''Taksit_ay" HeaderText="Taksit_ay'' SortExprcssion="Taksit_ay" I> <!Fields> <lasp:details View> <asp.button ID="Button2" runat="server" Style='tz-index: 110; left: 208px; position: absolute; top: 512px" Text="Sepete Ekle" OnClick="Button2_Click" I> <asp:dropdownlist ID= "DropDownList5" run at=" server" AutoPostBack= "True" DataSourceID=" SqlDataSource7" DataTextFicld="Fiyat" Data ValueFicld="Fiyat" Styie="z-index: 111; left: 712px; position: absolute; top: 328px" Height="22px" \Vidth="l04px''> <lasp:dropdownlist> <asp: SqlDataSource ID=" SqlDataSource5" runat="server" ConnectionString=" <%$ ConnectionStrings:MyConnection %>" SelectCommand="SELECT * FROM [ModelOzellik] WHERE ([ModelAdi] = @ModelAdi) ORDER BY [ModelAdi]" OldValuesParaınctcrFormatString="original_ {O}"> <Selectf'arameters> <asp:controlparameter ControlID="DropDownList4" Name="ModelAdi'' PropcrtyName="SelectedValue" Typc="String" I> <ISelectParameters> <lasp:sqldatasource> <asp.button ID="Button3" nmat="server" PostBackUrl="-/Sepet.aspx" Stylc="zindex: 114; ıo. left: 336px; position: absolute; top: 512px" Text="Sepete Git" I> <asp: SqlDataSource ID=" SqlDataSource6" run at=" server" ConnectionString= "<%$ ConnectionStrings:MyConnection 1t>" SeiectCornmand="SELECT * FROM Model" UpdateCommand="UPDATE Model SET StokMiktari = StokMiktari - l WHERE (ModelAdi = @ModelAdi)"> <Updatef'arameters> <asp:controlparameter Controlid= "DropDownList4" Name= "ModelAdi" PropcrtyNamc="SelectedValue" Typc="String" I> <IV pdateparameters> <lasp:sqldatasourcc> <br I> <br I> 23

<asp:sqldatasource ID="SqlDataSource7" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnection %~" SelectCommand="SELECT [Fiyat] FROM [Model] WHERE ([ModelAdi] = @ModelAdi)"> <SelectParameters> <asp:controlparameter ControlID="DropDownList4" Name="ModelAdi" PropertyName="SelectedValue" Typc="String" I> -c/selectl'arameters» <lasp:sqldatasource> <br Z> <asp:sqldatasource ID="SqlDataSource8" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnection %>" InseıtCommand="INSERT INTO Sepet(ModelAdi, Fiyat) VALUES (@ModelAdi, @Fiyat)" Sc1ectCommand="SELECT* FROM Sepet"> <Insertl'arameters> <asp:controlparameter ControlID="DropDownList4" Name="ModelAdi" PropertyName="SelectedValue" Type="String" I> <asp:controlparameter ControlID="DropDownList5" Name="Fiyat" PropertyNamc="SelectedValue" Type="String" I> <IInsertParametcrs> <lasp:sqldatasource> <br I> "' <br I> <lasp:content> 24

2.6 - b ] C# CODE FOR using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web.DI.WebControls; using System.Web.DI.WebControls.WebParts; using System.Web.DI.HtmlControls; public partial class UrurrSecme: Systern.Web.Ul.Page { protected void Page_Load(object sender, EventArgs e) { protected void Buttonl_Click(object sender, EventArgs e) { SqlDataSource6.Dpdate(); protected void Button2_Click(object sender, EventArgs e) { SqlDataSource8.Insert(); 25

2 Do~ya Ürün seçmeye Devam 2.7 - a) ASP CODE FOR <~;@ Page Language="C#" MasterPageFile="-/BaşSayfa.master" AutoEventWireup="true" Codel-ile=Sepet.aspx.cs" lnherits="sepet" 'I'itle='Tlntitled Page"%> <asp.content ID="Contentl" ContentPlaccHolderID="ContentPlaccHolderl" Runat="Server"> <br I> Ürün seçmeye <a hrcf="urunsccme.aspx">devam <la><br I> 26

<asp:sqldatasource ID="SqlDataSourcel" runat="server" ConnectionString=I'~%$ ConnectionStrings:MyConnection.%>" OldVa]ucsParameterFormatString="original_{O}" SelectCommand="SELECT * FROM [Sepet] ORDER BY [ModelAdi]" ConflictDctcction="CompareAllValues" DeleteCommand="DELETE FROM [Sepet] WHERE [Sepetld] = @original_sepetid AND [ModelAdi] = @original_modeladi AND [Fiyat]= @original_fiyat" InscrtCommand="INSERT INTO [Sepet] ([ModelAdi], [Fiyat]) VALUES (@ModelAdi, @Fiyat)" UpdateCommand="UPDATE [Sepet] SET [ModelAdi] = @ModelAdi, [Fiyat]= @Fiyat WHERE [Sepetld] = @original_sepetld AND [ModelAdi] = @original_modeladi AND [Fiyat]= @original_fiyat"> <Delete Parameters> <asp.parameter Name="original_Sepetid" Type="lntl6" I> <asp:parameter Name="original_ModelAdi" Typc="String" I> <asp:parameter Namc="original_Fiyat" Type="Int32" I> <IDeleteParameters> <UpdateParameters> -casp.parameter Namc="ModelAdi" Type="String" I> <asp:parameter Narne="Fiyat" Type="Int32" I> -casp.parameter Name="original_Sepetld" Typc="lnt16" I> -casp.parameter Name="original_ModelAdi" Type="String" I> <asp:parameter Name="original_Fiyat" Type="lnt32" I> -o'update Parameters> <Insertl'arameters> -casp.parameter Name="ModelAdi" Typc="String" I> «asp.parameter Name="Fiyat" Type="Int32" I> </InsertParameters> <lasp:sqldatasource> <br I> <hr/> <br I> <br I> <asp:gridview ID="GridViewl" runat="server" AllowPaging="True" AIIowSorting="True" AutoGenerateColumns= "Failse" DataKey Naınes=" Sepetld" DataSourceID="SqlDataSourcel" Style="z-index: 100; left: 352px; position: absolute; top: 352px"> <Columns> <asp:commandfield ShowDeleteButton="True" De!eteText="Sil" I> <asp:boundfield DataField=" Sepetld" HeaderText=" Sepetld" Insert'visible=t'False" ReadOnly="True" SortExprcssion="Sepetid" I> <asp:boundfield DataField="ModelAdi" HeaderText="ModelAdi" SortExpression="ModelAdi" I> <asp: BoundField Dataf'ield= "Fiyat" HcaderTcxt="Fi yat" SortExpression="Fiyat" I> </Columns> <lasp:gridview> <brl> 27

<asp:button ID="Buttonl" runat="server" Style="z-index: 101; left: 544px; position: absolute; top: 280px" Tcxt="Satın Al" PostBackUrI="-/SatinAl.aspx" I> <br I> <br I> <br,'> <br I> <br z> <br I> <asp:detailsview ID="DetailsViewl" runat="server" DataSourccID="SqlDataSource2" Height="50px" Style="z-index: 103; left: 352px; position: absolute; top: 640px" Width="125px"> <lasp:details View> <asp:sqldatasource ID=''SqlDataSource2" runat="server" ConnectionString='\?~$ ConnectionStrings:MyConnection %>" SclectCommand="SELECT SUM(Fiyat) AS Toplam FROM Sepet"><lasp:SqlDataSource> <lasp:content> 2.7 b ) C# CODE FOR using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.Ul; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Sepet: System.Web.Ul.Page 28

protected void Page_Load(object sender, EventArgs e) { DOiYd Düıen Görünüm. Lütfen Gerekli Alanlan Doldurun İsim ve Soyisiın Adres Kart Tipi Kart Numarası CV Numarası 2.8 a) ASP CODE FOR <%@ Page Languagc="C#" MasterPagcFilc="-/BaşSayfa.master" AutofiventWireup=t'true'' CodeFile="SatinAl.aspx.cs" Inherits="SatınAl" Title="Untitled Page" %> 29

<asp:content ID="Contentl" ContentPlaceHolderID="ContentPlaceHolderl" Run at=" Server"> <asp:textbox ld="textboxl" runat="server" Styleez-index: 100; left: 224px; position: absolute; top: 384px "><lasp:textbox> <asp:textbox ld="textbox2" runat="server" Style="z-index: 101; left: 224px; position: absolute; top: 430px "><lasp:textbox> <asp:textbox ID="TextBox3" runat="server" Style="z-index: 102; left: 224px; position: absolute; top: 476px"><lasp:TextBox> <asp:textbox ID="TextBox4" nmat="server" Style=I'z-index: 103; left: 224px; position: absolute; top: 522px"><lasp:TextBox> <asp:textbox ID="TextBox5" runat="server" Stylc="z-index: 104; left: 224px; position: absolute; top: 568px"><iasp:TextBox> <asp.label ID="Label 1" runat="server" Height="22px" Style="z-index: 105; left: 40px; position: absolute; top: 384px" Tcxt="İsim ve Soyisim" Width=" 155px"><lasp:Label> <asp.label ID="Label2" runat="server" Hcight="22px" Style="z-index: 106; left: 40px; position: absolute; top: 424px" Text="Adres" \Vidth="155px"><lasp:Label> <asp:label ID="Label3" runat="server" Height="22px" Style="z-index: 107; left: 40px; position: absolute; top: 472px" Text=Kart Tipi" Width="155px"><lasp:Label> <asp:labcl 1D="Label4" runat="server" Height="22px" Stylc="z-index: 108; left: 40px; position: absolute; top: 520px" Text="Kart Numarası" Width=" 155px"><lasp:Label> <br I> <br I> <img src="rcsimler/kartlar.jpg" sryleez-index: 100; left: 504px; width: 208px; position: absolute; top: 392px; height: 128px" > Lütfen Gerekli Alanları Doldurun... <br I> <brl> <br I> <asp.label 1D="Label5" runat="server" Height="22px" Style="z-index: 109; left: x; position: absolute; top: 568px" Text="CV Numarası" -ıdth=" 155px"><lasp:Label> <br I> <brl> <br I> <brl> <brl> 30

<br I> <br z> <br I> <asp: Button ID= "Button 1" run at=" server" OnClick= "Button 1_Click" Style=" z-index: 111; left: 560px; position: absolute; top: 608px" Text="Satın Al" I> <asp:sqldatasource ID="SqlDataSourcel" runat="server" ConncctionString="<~$ ConnectionStrings:MyConnection DeleteCommand="DELETE FROM Sepet" SelectComrnand="SELECT Sepet." FROM Sepet" UpdateCommand="UPDATE Model SET StokMiktari = StokMiktari - 1 WHERE (Modelld IN (SELECT Model.Modelld FROM Sepet))"> <lasp:sqldatasource> -cbr I> <br I> <lasp:content> using System; using System.Data; using System.Configuration; using System. Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtrnlControls; public partial class SatmAl : System.Web.Ul.Page { protected void Page_Load( object sender, EventArgs e) { protected void Buttonl_Click(object sender, EventArgs e) { SqlDataSource 1. Update(); 31

SqlDataSource 1.Delete(); ---------------------------------------------------------------------------------------- 32

CHAPTER 3: ONLY ADMIN PAGES Doşya Dü{en Kategori Düzenle!Kategorıid i 1 ı:rz~t~~?!11\dı :C:clıt I)e)ete New ı;;_... (BezazJ~ıza 3.1- a) <%@ Page Language="C#" MasterPageFile="-/BaşSayfa.master" toevcntwireup="true'' CodeFile="KategoriEkle.aspx.cs" lnherits="urunekle" le="untitled Page" %> p:content ID="Contentl" ContentPlaceHoldedD="ContentPlaceHolderl" nat="server"> <asp:detailsview fd="detailsviewl" runat="server" AHowPaging="True" ogeneratcrows="false" 33

Datakeylvames=Kategorild" Dataôourcell.ıeSqll.ıataôource I II Height=1140px11 Stylee'z-index: 100; left: 160px; position: absolute; top: 344px11 Width="264px11> <Fields> <asp:boundfield Datal-ieldeKategorild" Header'TexreKategorild" Insert Visible= 11F alse 11 ReadOnly=11True11 SortlixpressioneKategorild" I> <asp:boundfield Datal-ield=Kategori.Adi" Header'I'exteKategori Adi" S0rtExpression="KategoriAdi11 I> <asp: CommandField Show DeleteB utton=true II Show EclitButton= "True 11 Showlnsertlsuttone'True" I> <!Fields> <lasp:details View> II <asp:sqldatasource ID=11SqlDataSourcel runat='tserver" Con flictdetection= 11 CompareAll Values 11 ConnectionString=11<%$ ConnectionStrings:MyConnection %?11 De1eteCommand="DELETE FROM [Kategori] WHERE [Kategorild] = @original_kategorild AND [KategoriAdi] = @original_kategoriadi" fnsertcommand=11insert INTO [Kategori] ([KategoriAdi]) VALUES ( @KategoriAdi) 11 Oldvaluesl'araıneterltormatx tring= 11 original_ {O} 11 SelectCommand= 11 SELECT * FROM [Kategori] ORDER BY [KategoriAdi]" UpdateCornmand=11UPDATE [Kategori] SET [KategoriAdi] = @KategoriAdi WHERE [Kategorild] = @original_kategorild AND [KategoriAdi] = @original_kategoriadi 11> <DeleteParameters> <asp:parameter Namee'toriginafKategorild" Type='Tnt l ô" I> -casp.parameter Namee.'toriginal Kategori Adi" Type=11String11 I> <IDeleteParameters> <UpdateParameters> <asp:parameter NamceKategori.Adi" TypeeString" I> <asp:parameter Name=11original_Kategorild11 Typcevlnt lô" I> -casp.parameter Namee'toriginal Kategori.Adi" TypeeString" I> </U pdateparameters> <lnsertparameters> -casp.parameter NameeKategori.Adi" TypeeString" I> <IInsertParameters> <lasp:sqldatasource> <asp.label ID=11Labell II runat='tserver" Style="z-index: 101; left: 160px; position: absolute; top: 304px11 Text=Kategori Düzenle'c-x/asp.Label> <br I> <a href="../anasayfa.aspx11>geri<la> nbsp; cnbsp; 34

<br I> <br I> -cbr I> <br I> <br I> II <asp:gridview ID=11GridViewl runatevserver" Allowf'agingeTrue" Allowôortinge'True" Autofieneratef.olumns=t'False'' Datalçeylvames=Kategorild" DataSourceID=''SqlDataSource2'' Stylc="z-index: 103; left: 168px; position: absolute; top: 504px11> <Columns> <asp:commandfield Showl.ıeleteljuttone'True'' Showbditlsuuon=t'True" I> <asp:boundfield DataField=" Kategorild" HeaderText=" Kategorild" Insert Visibk= 11F alse 11 ReadOnlyeTrue" Sortfixpression='Kategorild" I> <asp :BoundField DataField= "Kategori Adi II HeaderText= "Kategori Adi 11 SortExpression="KategoriAdi" I> </Columns> <lasp:gridview> <asp:sqldatasouree ld="sqldatasource211 runat=11server" ConfiictDetection= "CompareAll Values" ConnectionString=11<%$ ConnectionStrings:MyConnection %>11 Delcterommande-'Dlil.E'Tf FROM [Kategori] WHERE [Kategorild] = @original_kategorild AND [KategoriAdi] = @original_kategoriadi" InsertCommand=11INSERT INTO [Kategori] ([KategoriAdi]) VALUES (@KategoriAdi)" OldValuesParameterFormabString="original_ {O}" SelectCommand=" SELECT * FROM [Kategori] ORDER BY [KategoriAdi]" UpdateCommand="UPDATE [Kategori] SET [KategoriAdi] = @KategoriAdi WHERE [Kategorild] = @original_kategorild AND [KategoriAdi] = @original_kategoriadi "> <Delete Parameters> -casp.parameter Namee'toriginafKategorild" Type="Int16" I> -casp.parameter NameetoriginafKategori.Adi" Type=t'String" I> </DeleteParameters> <UpdateParameters> -casp.parameter Name="KategoriAdi" Typc="String" I> <asp:parameter Namee.voriginalKategorild" Type=11Intl611 I> -casp.parameter Name="original_KategoriAdi" TypeeString" I> <IUpdatef'arameters> <Insertl'arameters> 35

-casp.parameter Name="KategoriAdi" Type="String" I> <llnsertparameters> <lasp:sqldatasource> <br I> -cbr I> </asp:content> 3.1- b) CODE FOR using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.Ul; using System.Web.DI.WebControls; using System.Web.DI.WebCont;ols.WebParts; using System.Web.DI.HtmlControls; public partial class Urunfikle : System.Web.Ul.Page { protected void Page_Load(object sender, EventArgs e) { 36

3 Marka Ekle Markaid 1001 Arçelik Buzdolabı.2 - a) CODEJ:OR " d@ Page Language="C#" MasterPageFilc="-/BaşSayfa.master" toeventwireup="true" CodeFile="MarkaEkle.aspx.cs" erits="adminpages_markaekle" Title="Untitled Page",%> sp.content ID="Contentl" ContentPlaccHolderID="ContentPlaceHolderl" at="server"> znbsp; <asp:label ID="Labell" rumıt="server" Sryleez-index: 100; left: 264px; position: lute; top: 312px" Tcxt="Marka Ekle'c-c/asp.Label> <asp:detailsview ID="DetailsView 1" runat="server" AllowPaging="True" GenerateRows="False" DataKeyNames="Markaid" DataSourccID="SqlDataSourcel" Height="50px" e='z-index: 101; left: 264px; position: absolute; top: 344px" Width="352px"> <Fields> 37

<asp:boundfield Dataf'ield= "Markald II Header'I'ex t= "Markald 11 InsertVisible=11False11 ReadOnly="True11 Sortfixpression=Markald" I> <asp:boundfield DataField= "Marka Adi II HeadcrText= "MarkaAdi 11 SortExpression= "MarkaAdi II I> <asp:boundfield DataltieldeLlrurtAdi" Header'Iexte'Tlrun.Adi" Sortfixpression='Tlrun.Adi'' I> <asp: CommandField ShowDeleteB utton= "True" ShowEditB utton= "True 11 Showlnsertlsutton='True" I> </Fields> <lasp:details View> <br I> <a href="../anasayfa.aspx11>geri</a><br I> <br I> <br I> <brl> <br Z> II <asp:sqldatasource ID="SqlDataSourcel runat=vserver" ConfüctDetection= 11 CompareAll Values 11 ConrıectiortString= 11<%$ ConnectionStrings: MyConnection ffo>11 DelcteCommand=11DELETE FROM [Marka] WHERE [Markaid] = @original_markatd AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi11 TnsertCommand=11INSERT INTO [Marka] ([MarkaAdi], [UrunAdi]) VALUES ( @MarkaAdi, @UrunAdi)" OldValuesParameterFormatString=11original_ {O} 11 Selectf.ommand>" SELECT * FROM [Marka] ORDER BY [MarkaAdi]" UpdateCommand=11UPDATE [Marka] SET [MarkaAdi] = @MarkaAdi, [UrunAdi] = @UrunAdi WHERE [Markald] = @original_markald AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi11> -cdeletel'arameters> «asp.parameter Nameevoriginal Markald" Type='Tntl ô" I> -casp.parameter Nameevoriginal Marka.Adi" Typee-String" I> «asp.parameter Name=11cııriginal_UrunAdi11 Type=11String" I> <IDeleteParameters> <Updatef'arameters> <asp:parameter Name="MarkaAdi" Typc=".String" I> <asp:parameter Namee'Tlrun.Adi" Type=11String" I> <asp:parameter Name="original_Markald" Type="Intl611 I> -casp.parameter Nameevoriginal jmarka.adi" Typc="String" I> -casp.parameter Name="original_UrunAdi" Type="String" I> <IUpdatel'arameters> -cinsertl'arameters> <asp.parameter Narnc="MarkaAdi" Typc="String" I> «asp.parameter Namee'Tlrun.Adi" Type=11String" I> <IInsertParameters> -o'asp: SqlDataSourcc> 38

<br I> <asp:gridview ID=11GridViewl II runaı='tserver" AllowPaging=11True11 AllowS0rting="True11 AutoGenerateColumns=11False" DataKey Names= "Markald" DataSourceID= 11 SqlDataSource2" Stylee'z-index: 103; left: 264px; position: absolute; top: 480px11 Width=11352px11> <Columns> <asp:commandfield Showpelerelıuttoue'True" ShowEditButton=11True11 I> <asp:boundfield DataField=11Markald" HeaderText=11Markald11 InsertVisihle="False11 ReadOnly=11True11 Sortlixpression= "Markald II I> <asp:boundfield DataField="MarkaAdi" Header'I'exte'tlvlarka.Adi'' Sortfixpression= ''MarkaAdi" I> II <asp:boundfield DataField="UrunAdi Header'TexteUrun.Adi" SortfixpressioneTlrurtAdi" I> -c/columns> <lasp:gridview> <asp:sqldatasource ID="SqlDataSource2" runat='tserver" ConflictDetection=11CompareAllValues" Connections tring= ".<o/d$ Connections trings: MyConnection %>" DeleteCommand="DELETE FROM [Marka] WHERE [Markald] = @original_markaid AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi" InsertCommand="INSERT INTO [Marka] ([MarkaAdi], [UrunAdi]) VALUES (@MarkaAdi, @UrunAdi)" OldValucsParametcrFormatString="original_{O}" SelectComrnand="SELECT * FROM [Marka] ORDER BY [MarkaAdi]" UpdateCommand=11UPDATE [Marka] SET [MarkaAdi] = @MarkaAdi, [UrunAdi] = @UrunAdi WHERE [Markald] = @original_markald AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi"> <Delete Parameters> -casp.parameter Name="original_Markald" Typee.'Tnt l ô" I> -casp.parameter Name=11original_MarkaAdi" Type="String11 I> <asp:parameter Name="original_UrunAdi" Typc="String11 I> <IDeleteParameters> " <UpdateParameters> <asp:parameter Name="MarkaAdi11 TypeeString" I> <asp:parameter Namc="UrunAdi" Typc="S.tring" I> -casp.parameter Name="original_Markald11 Type=11lntl611 I> -casp.parameter Name="original_MarkaAdi" Type="String" I> <asp:parameter Namee'toriginal LlrurtAdi" Type="String11 I> <IUpdateParameters> «Insertl'arameters> <asp:pararneter Narne="MarkaAdi" Type="String" I> <asp:parameter Name="UrunAdi" Typc="String" I> <llnsertparameters> <lasp:sqldatasource> <br I> 39

<br I> <br I> <br I> -cbr I> <lasp:content> 3.2 - b ) C# CODE FOR using System; using System.Data; using System. Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.Ul; using System.Web.DI.WebControls; using System.Web.DI.WebControls.WebParts; using System.Web. Ul.Html Controls; ublic partial class Adminl'agesJvlarkalikle : System.Web.Ul.Page { protected void Page_Load(object sender, Event/vrgs e) { I 40

Model Ekle imode!id 1117 [ModelAdi 3000 Devir [MarkaAdi IArçelık ju~di!çamaşırmakinesi!ıyat 450 (StokMiktari _ :Jodit Delete New fffi~ ;ii;i[ IvI~cleL'\di!Edit Delete 117 13000 Devir Arçelık!Edit Deletel121 4 ocaklıçift kapaklı :5000 Devır,vestel 3.3 - a) CODE FOR <%@ Page Language="C#" ~ MasterPagcFilc="-/BaşSayfa.master" Autolivent Wireup= "true" Code File= "ModelEkle. aspx.cs" Inherits="AdminPages_ModelEkle" Title="Untitled Page" ~> <asp:content ID="Contentl" ContentPlaccHolderID="ContentPlaceHolderl" unat=''server"> <asp.label ID="Labell" runat="server" Styleez-index: 100; left: 184px; position: olute; top: 320px" Text="Model Ekle'c-c/asp.Label> <br I> <a hrefe"../anaxayfa.aspx'c-geri-c/a>«br I> <br I> <br I> <br I> 41

<asp:gridview ID="GridViewl" runat="server" AilowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKey N ames="modelld" DataSourceID=" SqlDataSource2" Stylee.'z-index: 103; left: 528px; position: absolute; top: 368px" Width="496px"> <Columns> <asp:conunandfield ShowDeleteButton="True" ShowEditBtıtton="True" I> <asp:boundfield DataField="Modelld" HcaderText="Modelld" InscrtVisihle="False" RcadOnly="True" SortExpression="Modelld" I> <asp:boundfield DataField="ModelAdi" HeaderText="ModelAdi" SortExprcssion="ModelAdi" I> <asp:boundfield DataFicld="MarkaAdi" HcadcrTcxt="MarkaAdi" Sortlixpression= "MarkaAdi" I> <asp:boundfield DataField= "UrunAdi" HeaclerText= "UrunAdi" SortExpression="UrunAdi" I> <asp:boundfield DataField="Fiyat" HcadcrText="Fiyat" SortExpression="Fiyat" I> <asp:boundfield DataField=" StokMiktari" HeaderText=" StokMiktari" SortExprcssion="StokMiktari" I> -c/columns> <lasp:gridview> <asp: Details View ID=" Details View 1" run at=" server" Allow Paging= "True" AutoG-enerateRows="False" DataKeyNarnes="Modelld" DataSourceID="SqlDataSourcel" Height="50px" Sty1e="z-index: 102; left: 24px; position: absolute; top: 368px" Width="488px"> <Fields> <asp:boundfield Datal-ield= "Mode lid" HeaderTex t="modelld ti InsertVisible="False" ReadOnly="True" SortExpression="Modelld" I> <asp: BoundField Datal-ield= ti ModelA<li" Header'I'ext= "ModelAdi" SortExpression="ModelAdi" I> <asp:boundfield DataFicld="MarkaAditl HcaderTcxt=tlMarkaAdi" SortExpression="MarkaAdi" I> <asp:boundfield DataFicld=''UrunAditl HeaderText=tlUrunAdi" SortExpression= "UrunAdi ti I> <asp:boundfield DataField=tlFiyat'' HcadcrText=tlFiyat" Sortlixpression=Piyat" I> <asp:boundfield DataField="StokMiktaritl HeaderText=tlStokMiktari" Sorılixpressiou=" StokMiktari" I> -casp.commandf-ield ShowDeleteButton="True'' ShowEditButton="True'' Showlnsertbutton=t'True" I> <!Fields> <lasp:details View> <brl> 42

II <asp:sqldatasource ID="SqlDataSourcel runaıe+server" ConflictDetection= "CompareAllValues" Connection String= ";~o/o$ ConnectionStrings :MyConnection fo> 11 DeleteComınancl=11DELETE FROM [Model] WHERE [Modelld] = @original_modelld AND [ModelAdi] = @original_modeladi AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi AND [Fiyat]= @original_fiyat AND [StokMiktari] = @original_stokmiktari" InsertComrnand="INSERT INTO [Model] ([ModelAdi], [MarkaAdi], [UrunAdi], [Fiyat], [StokMiktari]) VALUES (@ModelAdi, @MarkaAdi, @UrunAdi, @Fiyat, @StokMiktari) 11 OldValuesParameterFormatString=" original_ {O}" SelectComınand=" SELECT * FROM [Model] ORDER BY [ModelAdi]" UpdateCommand="UPDATE [Model] SET [ModelAdi] = @ModelAdi, [MarkaAdi] = @MarkaAdi, [UrunAdi] = @UrunAdi, [Fiyat]= @Fiyat, [StokMiktari] = @StokMiktari WHERE [Modelld] = @original_modelld AND [ModelAdi] = @original_modeladi AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi AND [Fiyat]= @original_fiyat AND [StokMiktari] = @original_ S tokmiktari" > <DeleteParameters> <asp:parameter Name="original_Modelld" Type="Int16" I> -casp.parameter Name='1original_ModelAdi" Type="String" I> -casp.parameter Namee.'toriginal jvlarka.adi" Type="String" I> <asp:parameter Name="original_UrunAdi" Type=11String" I> -casp.pararneter Nameevoriginal Fiyat" Type=11Int3211 I> «asp.parameter Namc="original_StokMiktari" Type=11Intl611 I> </Delete Parameters> <UpdateParameters> -casp.parameter Name="ModelAdi11 Type=11String" I> <asp:parameter NameeMarka.Adi" Type="String11 I> <asp:parameter Narne=11UrunAdi" Typc="String11 I> <asp:parameter Narne="Fiyat" Type=11Int3211 I> -casp.parameter NameeStoklvliktari" Type="Intl611 I> <asp:parameter Name=11original_Modelld" Typee'Tntl ô" I> <asp:parameter Name="original_ModelAdi" Type=11String" I> -casp.parameter Namee'toriginal Marka.Adi" Type="String" I> <asp:parameter Nameevoriginal LlrunAdi" Type="String" I> -casp.parameter Narne="original_Fiyat" Type="Int3211 I> -casp.parameter Nameevoriginal Stoklvliktari'' Type="Int16" I> <IUpdateParameters> <lnsertparameters> -casp.parameter Name='Model.Adi" Type="String11 I> -casp.parameter NameeMarka.Adi" Type="String" I> -casp.parameter NameeUrun.Adi" Type="String" I> <asp:parameter Name=Piyat'' Type=11Int32" I> <asp:parameter Name="StokMiktari" Typc=11Intl611 I> -c/insertl'aramctcrs> </asp:sqldatasource> 43

<asp:sqldatasource ID=11SqlDataSource2" runatevserver" ConflictDetection= 11CompareAllValues 11 Connectionxtring=t'<jbô ConnectionStrings:MyConnection,%>11 DeleteCoınrnand=11DELETE FROM [Model] WHERE [Modelld] = @original_modelld AND [ModelAdi] = @original_modeladi AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi AND [Fiyat]= @original_fiyat AND [StokMiktari] = @original_stokmiktari11 InsertCornmand=11lNSERT INTO [Model] ([ModelAdi], [MarkaAdi], [UrunAdi], [Fiyat], [StokMiktari]) VALUES (@ModelAdi, @MarkaAdi, @UrunAdi, @Fiyat, @StokMiktari) 11 OldValuesParaıneterFormatString="original_ {O} 11 Se1cctCommand=11SELECT * FROM [Model] ORDER BY [ModelAdi]" UpdateCommand=11UPDATE [Model] SET [ModelAdi] = @ModelAdi, [MarkaAdi] = @MarkaAdi, [UrunAdi] = @UrunAdi, [Fiyat]= @Fiyat, [StokMiktari] = @StokMiktari WHERE [Modelld] = @original_modelld AND [ModelAdi] = @original_modeladi AND [MarkaAdi] = @original_markaadi AND [UrunAdi] = @original_urunadi AND [Fiyat]= @original_fiyat AND [StokMiktari] = @original_s tokmiktari 11 > <Delete Parameters> <asp:parameter Naıne="original_Modelld" Type="lntl611 I> -casp.parameter Narneevoriginal Model.Adi" Type=11String11 I> «asp.parameter Name=11original_MarkaAdi11 Type=11String11 I> <asp:pararneter Namee'tonginalUrun.Adi" Type=11String11 I> -casp.pararneter Name=11original_Fiyat11 Typee.'Tntô?" I> -casp.parameter Name="original_StokMiktari" Type="lnt16" I> «/Deletel'arameters> <Updatef'arameters> -casp.parameter Namee'Model.Adi" Type=11String" I> -casp.parameter Name=11MarkaAdi" 'IypeeString" I> -casp.parameter Name=11UrunAdi11 Type=11String11 I> -casp.parameter Naınc=11Fiyat11 Type=11lnt3211 I> «asp.parameter Namee'fitoklvliktari'' Tvpeee'Tnt l.ô" I> -casp.parameter Name="original_Modclld11 Typc=11lntl611 /> -casp.parameter Name=11original_ModelAdi11 Typee+String'' I> -casp.parameter Nameeongmal Markaôdi" TypeeString'' I> -casp.parameter Name="@riginal_UrunAdi11 Type=11String11 I> -casp.parameter Nameevoriginal Piyat" Typc=11lnt3211 I> -casp.parameter Narne=11original_StokMiktari" Type="lnt16" I> -c/updatel'arameters> <lnsertparameters> <asp:parameter Name="ModelAdi" Type=11String" I> -casp.parameter Namc="MarkaAdi" Type="String" I> -casp.parameter Naıne="UrunAdi" Typc="String" I> -casp.parameter Namc="Fiyat" Type=11lnt32" I> -casp.parameter Name=11StokMiktari11 Typc=11Intl611 I> <llnscrtparameters> </asp:sqldatasource> <br I> 44

<brl> <brl> <br I> <br I> <br I> &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &ııbsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; &nhsp; <br I> <hr/> <br Z> <br I> <hr/> <hr/> <hr/> <hr I> <hr/> <hr/> <br I> <hr I> <lasp:content> ---------------------------------------------------------------------------------------- - b ] C# CODE F'OR ModelElde.aspx 45

using System; using System.Data; using System.Configuration; using System. Collections; using System.Web; using System.Web.Security; using System.Web.Ul; using System.Web.DI.WebControls; using System.Web.DI.WebControls.WebParts; using System.Web.DI.HtmlControls; public partial class Adminf'agcs Modcllikle: System.Web.DI.Page { protected void Page_Load(object sender, EventArgs e) { 3,e} Untitll!d Pııru, Mozilla Firefoıı: "-- ~-ı--,,..~,~ı,~v ~..ı,....a.;tı,<- UrünDüzeııle Edit Delete SelectjlOOO ju~;~ıi,iluı~~~a.&[kateır.oıiadi IBuzdolabııBeyaz Eşya,Edi.I Delete Sele~ct 1002 f---------- --- -- Edit Delete Select 1004 ~;,i!beyaz Eşya Dız Ustü teiektronik ffufu~~11003. Fırın BeyazEş:,ı:a_j. Masa Elektronik Edıt Delete~ 1005 Üstü -.::.::: ~! 46

3.4 - a ) ASP CODE FOR ~.%@ Page Language="C#" MasterPageFile="-/BaşSayfa.master" AutoEventWireup="true" CodeFile="UrunEkle.aspx.cs" Inherits="AdminPages_UrunEkle" Title="Untitled Page"%> <asp.content ID="Contentl" ContentPlaccHolderID="ContentPlaceHolderl" Runat="Server"> <asp:detailsview ld="detailsviewl" runat="server" AllowPaging="True" DataSourceID="SqlDataSourcel" Height="50px" Style="z-index: 100; left: 120px; position: absolute; top: 344px" Width="256px"> <Fields> <asp:commandfield ShowDeleteButton="True" ShowEditButton="True" ShowinsertButton="True" I> </Fields> <lasp:details View> <asp:sqldatasource ID="SqlDataSourcel" runat="server" ConfüctDetection= "CompareAll Values" ConncctionString="<9fu$ ConnectionStrings:MyConnection :%>" DcleteCommand="DELETE FROM [Urun] WHERE [Urunid] = @original_urunld AND [UrunAdi] = @original_urunadi AND [KategoriAdi] = @original_kategoriadi" InscrtCommand="INSERT INTO [Urun] ([UrunAdi], [KategoriAdi]) VALUES (@UrunAdi, @KategoriAdi)" OldValuesParameterFormatString="original_ {O}" SelectCommand=" SELECT * FROM [Urun] ORDER BY [UrunAdi]" UpdateCommand="UPDATE [Urun] SET [UrunAdi] = @UrunAdi, [KategoriAdi] = @KategoriAdi WHERE [Urunld] = @original_urunld AND [UrunAdi] = @original_urunadi AND [KatcgoriAdi] = @original_kategoriadi"> <Delete Parameters> -casp.parameter Name="original_Urunld" Type="Int16" I> -casp.parameter Name="qriginal_UrunAdi" Type="String" I> -casp.parameter Namc="original_KategoriAdi" Type="String" I> -c/deleteparameters> <UpdateParameters>, -casp.parameter Narne="UrunAdi" Type="String" I> -casp.parameter Name="KategoriAdi" Type="String" I> -casp.parameter Naınc="original_Urunld" Type="Int16" I> -casp.parameter Name="original_UrunAdi" Typc="String" I> -casp.parameter Name="original_KategoriAdi" Type="String" I> <IUpdateParameters> <lnsertparameters> -casp.pararneter Namc="UrunAdi" Type="String" I> -casp.parameter Narne="KategoriAdi" Type="String" I> </InsertParameters> <lasp:sqldatasource> 47

<asp:label ID="Labell" runat="server" Style="z-index: 101; left: 120px; position: absolute; top: 304px" Text="Ürün Düzenle"><lasp:Label> <a href="../anasayfa.aspx">geri<la><br I> <brl> <br I> <br I> <asp:gridview ID="GridViewl" runat="server" Allowl'aging='True" AllowSorting="True" AutoGenerateColunms="False" DataKeyNames= 11U runld" DataSourcclD= 11 SqlDataSource2'' Style="z-index: 103; left: 400px; position: absolute; top: 336px" Width="264px"> <Columns> <asp:commandfield Showljeletefsutton='True" SbowEditButton="True" ShowSe1ectButton="True" I> <asp:boundfield DataField="Urunld" HeaderText="Urunld" Insertv isible="false" ReadOnly="True" SortExpression=11Urunld" I> <asp:boundfield DataFieJ,d=''UrunAdi"HeaderText=''UrunAdi'' SortExpression="UrunAdi II I> <asp:boundfield DataFiclli="KategoriAdi" HcadcrTcxt="KatcgoriAdi" SortExprcssion="KatcgoriAdi II I> «/Columns> </asp:gridvicw> <asp:sqldatasource ID="SqlDataSourcc2" runat='tservcr" ConflictDctection=''ComparcAllValucs'' ConnectionString="<%$ ConnectionStrings:MyConnection %>'' DeleteCommand="DELETE FROM [Urun] WHERE [Urunld] = @original_urunld AND [UrunAdi] = @original_urunadi AND [KategoriAdi] = @original_kategoriadi" lnsertcommand=11insert INTO [Urun] ([UrunAdi], [KategoriAdi]) VALUES (@UrunAdi, @KategoriAdi)" OldValuesParameterFormatString="original_ {O}" SelectCornmand="SELECT * FROM [Urun] ORDER BY [UrunAdi]" 48

UpdateCommand="UPDATE [Urun] SET [UrunAdi] = @UrunAdi, [KategoriAdi] = @KategoriAdi WHERE [Urunld] = @original_urunld AND [UrunAdi] = @original_urunadi AND [KategoriAdi] = @original_kategoriadi"> <DeleteParameters> -casp.parameter Name="original_Urunld" Type="lnt16" I> <asp:parameter Name="original_UrunAdi" Type="String" I> <asp:parameter Name="original_KategoriAdi" Typc="String" I> </DeleteParameters> <U pdateparameters> -casp.parameter Name="UrunAdi" Type="String" I> <asp:parameter Namc="KategoriAdi" Typc="String" I> -casp.pararneter Namc="original_Urunld" Typc="lnt16" I> <asp:parameter Name="original_UrunAdi" Type="String" I> -casp.pararneter Name="original_KategoriAdi" Type="String" I> <ı'updateparameters> <InsertParameters> <asp:parameter Name="UrunAdi" Type="String'' I> «asp.parameter Name="KategoriAdi" Type="String" I> </lnsertparamcters> <lasp:sqldatasource> <br I> <br /> <br I> «br /> <lasp:content>.., I: 3.4 b) (ODE FOR using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.DI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class AdminPages_lJrunEkle: System.Web.DI.Page { protected void Page_Load(object sender, EventArgs e) { 49

50.. ı:

CHAPER 4: CONFIGURATION PAGES 4.1-a)PAGE <?xml version>" 1.0" erıcoding=l'utf-s "?> <configuration> <system. web> <authorization> <deny roles="siteuye" I> <deny users="?" I> -c/authorization> -o'system.web> <!configuration>.. E 51

4,2 - a) PAGE <?xml version=" 1.0"?> <configuration> <connections trirıgs> <add name="myconnection" connectionstring="data Source=.\SQLEXPRESS;AttachDbFilename=JDataDirectoryl\ASPNETDB.MDF;Integr ated Securitye'True; User Instance= True" provider Name=" S ystem.data.sql Client'"> </connections trirıgs> <system. web> <authorization> <allow roles="admin"/> -c/authorization> <rolemanager enabled='frue'"> <authentication mode="forms"i> <compilation debug="true"/></system. web> </configuration> 52

CHAPTER 5 : WORK ENVIRONMENT ModelEkle.aspx. cs [0] lliunekle, aspx 1fil UrunEkle.aspx.cs il@ web.config $] App_Data Gill resimler @ AnaScıyfa.aspx C:J BaşSayfa.master ;J±ı Hesap. aspx (@] Login.aspx t@ SatinAI. aspx [El Search.aspx illfil Sepet, aspx [@j UrunSecme.aspx ]& web.config Detebese Diagrams Tables... ~ aspnet_applications +, [ill aspnet_membershıp ffi UQ aspnet_paths H+ f111 aspnet_personalizationaiiusers te Üfil aspnet_personalizationperuser ± IT1} aspnet_profile UM aspnet_roles lfj. Gfil aspnet_schemaversions l t1'a aspnet_users if ÜE aspnet_userslnroles f:ın as:pnet_webevent_events J Sill Kategori 'İJ 3iJ Marka İ illi1 Model 'f 1fil ModelOzellik 't.i Q3 Sepet H-> Q1 Urun rb f1y Views ( Qm Stored Procedures lf.ı Gd Functions i kili Synonyms $ Lill Types lt.1 C1J Assemblies VISUAL WEB DEVELOPER 2005 FOR INTERFACE AND C# AND ASP FOR PROGRAMMING AND SQLSERVER 2005 FOR DATABASE 53

CHAPTER 6 : TABLES ApplicationName nvarchar(256) LoweredApplicationName nvarchar(256) Applicationld uniqueidentifier Description nvarchar(256) Unchecked Unchecked Unchecked Checked Applicationld uniqueidentifier Unchecked Userld uniqueidentifier Unchecked Password nvarchar(128) Unchecked PasswordFormat int Unchecked PasswordSalt nvarchar(128) Unchecked MobilePIN nvarchar(16) Checked Email nvarchar(256) Checked LoweredEmail nvarchar(256) Checked PasswordQuestion nvarchar(256) Checked PasswordAnswer nvarchar(l 28) Checked lsapproved bit Unchecked IsLockedOut bit Unchecked CreateDate datetime Unchecked LastLoginDate datetime Unchecked LastPasswordChangedDate datetime Unchecked LastLockoutDate datetime Unchecked FailedPasswordAttemptCount int Unchecked 54

FailedPasswordAttempt Windows tart date time Unchecked FailedPasswordAnswerAttemptCount int Unchecked FailedPasswordAnswer Attempt Window Start date time Unchecked Comment ntext Checked 6,3 ~ Applicationld uniqueidentifier Unchecked Pathld uniqueidentifier Unchecked Path nvarchar(256) Unchecked LoweredPath nvarchar(256) Unchecked Pathld uniqueidentifier Unchecked PageSettings image Unchecked LastUpdatedDate date time Unchecked l< Id uniqueidentifier Unchecked Pathld uniqueidentifier Checked User Id uniqueidentifier Checked PageSettings image Unchecked LastUpdatedDate date time Unchecked 55

6,6 - User Id Property PropertyValuesString Property ValuesBinary LastUpdatedDate uniqueidentifier Names ntext ntext ımage date time Unchecked Unchecked Unchecked Unchecked Unchecked 6,7 - Applicationld uniqueidentifier Unchecked Roleld uniqueidentifier Unchecked RoleName nvarchar(256) Unchecked LoweredRoleN ame nvarchar(256) Unchecked Description nvarchar(256) Checked Feature nvarchar(128) Unchecked CompatibleSchema Version ~ nvarchar(128) Unchecked IsCurrent Version bit Unchecked Applicationld Userld User Name uniqueidentifier uniqueidentifier nvarchar(256) Unchecked Unchecked Unchecked 56

LoweredU sern arne nvarchar(256) Unchecked MobileAlias IsAnonyrnous LastActivityDate nvarchar(l 6) bit date time Checked Unchecked Unchecked User Id Roleld uniqueidentifier uniqueidentifier Unchecked Unchecked Eventld char(32) EventTirneUtc date time Unchecked EventTirne date time Unchecked EventType nvarchar(256) Unchecked EventSequence Unchecked decirnal(l9, O) Unchecked Eventüccurrence decirnal(l9, O) Unchecked EventCode int Unchecked EventDetailCode int Unchecked " Message nvarchar(l 024) Checked ApplicationPath nvarchar(256) Checked Application VirtualPath nvarchar(256) Checked MachineN arne nvarchar(256) Unchecked RequestUrl nvarchar( 1024) Checked Exception Type nvarchar(256) Details ntext Checked Checked 57

Kategorild smallint Unchecked KategoriAdi nvarchar(30) Unchecked Markald smallint Unchecked MarkaAdi nvarchar(30) Unchecked UrunAdi nvarchar(30) Unchecked Mode lid smallint Unchecked ModelAdi nvarchar(30) Unchecked MarkaAdi nvarchar(30) Unchecked UrunAdi nvarchar(30) Unchecked Fiyat int Unchecked StokMiktari l's. smallınt Unchecked ıs- ModelAdi nvarchar(30) Unchecked ModelOzellikleri text Unchecked ModelFiyatı int Unchecked Taksit_ay tinyint Unchecked 58

.. \ I ı,~ I; '", ''- \ ',>,,,':,\,,. to,. ' '\ -,,,..... Sepetld sınallint Unchecked ModelAdi nvarchar(30) Unchecked Fiyat int Unchecked Urunld small int Unchecked UrunAdi nvarchar(30) Unchecked KategoriAdi nvarchar(30) Unchecked 59

CHAPER 7 : QUERIES AND DESIGNS AND RESUL TS FOR VIEWS Ft LE Database Dia gr ams rf) (TuJ Tables [?... Llfil Views 1 vw_aspnet_applications vw_aspnet_membershipuseffit! vw _aspnet_profiles vw_aspnet_userslnroles vw_aspnet_webpartstate_ Kategori Urun Model li'l El Rl Marka 0 (fj dbo-.k~t e öorı: Kate ğ öriadi;- db ö-:ürun:ür~~a d i~---dbo: Mode ı: Mo;ieıAdi; dso:i;;ar~:-markaadi; aso:-r.;,oaelfiy;i; cfr;o, Modei: stokmikt:ir i dbo.kategori INNERJOIN dbo.urun ON dbo.kategori.kategoriadi = dbo.urun.kategoriadi INNER JOIN dbo.model ON dbo.urun.urunadi = dbo.model.urunadi INNER JOIN dbo.markaon dbo.model.markaadi= dbo.marka.markaadianddbo.urun.urunadi= dbo,marka.urunadi 1" SELECT dbo.kategori.kategoriadi, dbo.urun.urunadi, dbo.model.modeladi, dbo.marka.markaadi, dbo.model.fiyat, dbo.model.stokmiktari FROM dbo.kategori INNER JOIN JOIN dbo.urun ON dbo.kategori.kategoriadi = dbo.urun.kategoriadi INNER dbo.model ON dbo.urun.urunadi = dbo.model.urunadi INNER JOIN dbo.marka ON dbo.model.markaadi = dbo.marka.markaadi AND dbo.urun.urunadi = dbo.marka.urunadi 60

1-a) : Buzdolabı arç-çift kapa~ Arçelik 900 Buzdolabı arç-tek kapaklı Arçelik 750-1 Buzdolabı vest-no-frost Vest el 500 16 ı:iı l;ill1 vw_aspnet_applications Buzdolabı vest-500 It Vestel 900 5 j\ ~ 1 vw_aspnet_membershipuse Çamaşır Makinesi 5000 Devir Arçelik 600 17 ı! 1 QJJ vw_aspnet_profiles Çamaşır Makinesi 3000 Devir Arçelik 450 41 ıf;- fij vw_aspnet_roles Çamaşır Makinesi A-Plus Vest el 700 Çamaşır Makinesi C-Plus Vestel 550 10 Diz üstü Pentium3rx2 Arçelik 1000 Diz Ustü Pentium Ce\eron Arçelik 1600-2 Diz Üstü vest lptp celrn Vestel 1500 14 Diz üstü vest lptp P4+ Vestel 1100 10 Masa Üstü pentium4 Veste\ 1200 11 Masa Üstü Deskotp Celeron Vestel 800 Masa Üstü Arç Desktop P4 Arçelik 1000 Masaüstü Arç Desktop Ce\3 Arçelik 1200 NUH NUll NUii NUii NUii il 0/0 ~,., ;r, :,ıv"'" ()c,:,';:,i;~_ii:,r,t,~;u,:, Distinct Values No Q(:.)U?B'i )ı_:- < r sr <-.ı..> :..st : <,.ır..~.v. -.::,.,, _,.,.e Sw 61

(~ vw_aspnet_applications vw_aspnet_membershipuse vw_aspnet_users vw_aspnet_userslnro\es vw_aspnet_webpartstatejli Sepet Model Model EZ] Fil o [aj <>0 cıtıo :s epet : Mode ıi,,d"c"abo: M-ödei:-FıYat dbo.model INNER JOIN dbo.sepeton dbo.model.modeladi= dbo,sepet.modeladi (dbo.model.stokmiktari<> O) Description Distinct Values No SELECT FROM dbo.sepet.modeladi, dbo.model.fiyat dbo.model INNER JOIN dbo.sepet ON dbo.model.modeladi = dbo.sepet.modeladi WHERE (dbo.model.stokmiktari <> O) - a} 62

t!i ımçhıın Visum Web Develop,r :Z005 gpress EditiPtı Window Community Help 900 700 NUU SepetView vw_aspnet_applications &r [JU vw_aspnet_membershipuse ff)- ~ vw_aspnet_profiles ffj [illl vw_aspnet_roles l±i [fj] vw_aspnet_users ~ [illj vw_aspnet_usersinroles SELECT ApplicationN ame, LoweredApplicationN ame, Applicationld, Description 63

FROM dbo.aspnet_applications 7.4 SELECT dbo.aspnet_membership. User Id, dbo. aspnet_membership.passwordformat, dbo. aspnet_membershi p. MobilePIN, dbo. aspnet_membership.email, dbo.aspnet_membership.loweredemail, dbo.aspnet_membership.passwordquestion, dbo.aspnet_membership.passwordanswer, dbo.aspnet_membership.isapproved, dbo.aspnet_membership.islockedout, dbo.aspnet_membership.createdate, dbo. aspnet_membershi p.lastlo gindate, dbo.aspnet_membership.lastpasswordchangeddate, dbo. aspnet_membershi p.lastlockoutdate, dbo.aspnet_membership.failedpasswordattemptcount, dbo.aspnet_membership.failedpasswordattemptwindowstart, dbo.aspnet_membership.failedpasswordanswerattemptcount, dbo.aspnet_membership.failedpasswordanswerattemptwindowstart, dbo.aspnet_membership. Comment, dbo.aspnet_ U sers.applicationid, dbo.aspnet_ Users. UserN ame, dbo.aspnet_ Users.MobileAlias, dbo.aspnet_ Users.IsAnonymous, dbo.aspnet_ U sers.lastacti vitydate FROM dbo.aspnet_membership INNER JOIN dbo. aspnet_ Users.User Id dbo.aspnet_users ON dbo.aspnet_membership.userld = SELECT Userid, LastUpdatedDate, DATALENGTH(PropertyNames) + DATALENGTH(PropertyValuesString) + DAT ALENGTH(PropertyValuesBinary) AS DataSize FROM dbo.aspnet_profile 64

SELECT Applicationld, Roleld, RoleName, LoweredRoleName, Description FROM dbo.aspnet_roles SELECT Applicationld, Userld, UserName, LoweredUserName, MobileAlias, IsAnonymous, LastActivityDate FROM dbo.aspnet_users SELECT FROM Userld, Roleld dbo.aspnet_userslnroles SELECT Applicationld, Pathld, Path, LoweredPath FROM dbo.aspnet_paths SELECT Pathld, DATALENGTH(PageSettings) AS DataSize, LastUpdatedDate FR OM dbo. aspnet_personalizationall Users 65

SELECT Pathld, Userld, DATALENGTH(PageSettings) AS DataSize, LastUpdatedDate FROM dbo.aspnet_personalizationperu ser 66

CHAPTER 8 : STORED PROCEDURES ALTER PROCEDURE [dbo].aspnet_anydatalntables @TablesToCheck int AS -- Check Membership table if (@TablesToCheck & l) is set IF ((@TablesToCheck & 1) <> O AND (EXISTS (SELECT name FROM sysobjccts WHERE (name= N'vw_aspnet_MembcrshipUsers') AND (type= 'V')))) IF (EXISTS(SELECT TOP 1 Userld FROM dbo.aspnet_membership)) SELECT N'aspnet_Membership' RETURN -- Check aspnct_roles table if (@TablesToCheck & 2) is set IF ((@TablcsToCheck & 2) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_Roles') AND (type= 'V')))) IF (EXISTS(SELECT TOP 1 Roleid FROM dbo.aspnet_roles)) SELECT N'aspnet_Roles' RETURN ' -- Check aspnet Profile table if (@TablesToChcck & 4) is set IF ((@TablcsToCheck & 4) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_Profiles') AND (type= 'V')))) IF (EXISTS(SELECT TOP 1 Userld FROM dbo.aspnet_profile)) SELECT N'aspnet_Profile' RETURN 67

-- Check aspnet_personalizationperuser table if (@TablesToCheck & 8) is set IF ((@TablesToCheck & 8) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name= N'vw_aspnet_WebPartState_User') AND (type= 'V')))) IF (EXISTS(SELECT TOP 1 Userld FROM dbo.aspnet_personalizationperuser)) SELECT N'aspnet_PersonalizationPerUser' RETURN -- Check aspnet_personalizationperuser table if (@TablesToCheck & 16) is set IF ((@TablesToCheck & 16) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name= N'aspnet_WebEvent_LogEvent') AND (type= 'P')))) IF (EXISTS(SELECT TOP 1 * FROM dbo.aspnet_webevent_events)) SELECT N'aspnet_WebEvent_Events' RETURN -- Check aspnet_users table if (@TablesToCheck & 1,2,4 & 8) are all set IF ((@TablesToCheck & 1) <> O AND (@TablesToCheck & 2) <> O AND (@TablesToCheck & 4) <> O AND (@TablesToCheck & 8) <> O AND (@TablesToCheck & 32) <> O AND (@TablesToCheck & 128) <> O AND (@TablesToCheck & 256) <> O AND (@TablesToCheck & 512) <> O AND (@TablesToCheck & 1024) <> O) ~ IF (EXISTS(SELECT TOP 1 Userid FROM dbo.aspnet_users)) SELECT N'aspnet_Users' RETURN IF (EXISTS(SELECT TOP 1 Applicationid FROM dbo.aspnet_applications)) SELECT N'aspnet_Applications' RETURN 68

ALTER PROCEDURE [dbo].aspnet_applications_ CreateApplication @ApplicationNarne nvarchar(256), @Applicationld uniqueidentifier OUTPUT AS SELECT @Applicationld = Applicationld FROM dbo.aspnet_applications WHERE LOWER(@ ApplicationN arne) = LoweredApplicationN arne IF(@Applicationld IS NULL) DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O SELECT @ Applicationld = Applicationld FROM dbo.aspnet_applications WITH (UPDLOCK, HOLDLOCK) WHERE LOWER(@ ApplicationN arne) = LoweredApplicationN arne IF(@Applicationld IS NULL) SELECT @ Applicationld = NEWID() INSERT dbo.aspnet_applications (Applicationld, ApplicationN arne, LoweredApplicationN arne) VALUES (@Applicationld, @ApplicationName, LOWER(@ApplicationN arne)) ~ IF( @TranStarted = 1 ) IF(@@ERROR = O) SET @TranStarted = O COMMIT TRANSACTION ELSE SET @TranStarted = O ROLLBACK TRANSACTION 69

ALTER PROCEDURE [dbo].aspnet_applications_ CreateApplication @ApplicationN arne nvarchar(256), @Applicationld uniqueidentifier OUTPUT AS SELECT @Applicationld = Applicationld FROM dbo.aspnet_applications WHERE LOWER(@ApplicationNarne) = LoweredApplicationNarne IF(@Applicationld IS NULL) DECLARE @TranStarted bit SET @TranStarted = O IF( @@TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O ı. SELECT @ Applicationld = Applicationld FROM dbo.aspnet_applications WITH (UPDLOCK, HOLDLOCK) WHERE LOWER(@ApplicationNarne) = LoweredApplicationNarne ' IF(@Applicationld IS NULL) SELECT @ Applicationld = NEWID() INSERT dbo.aspnet_applications (Applicationld, ApplicationNarne, LoweredApplicationNarne) VALUES (@Applicationld, @ApplicationNarne, LOWER(@ApplicationNarne)) IF( @TranStarted = 1 ) 70

IF(@@ERROR = O) SET @TranStarted = O COMMIT TRANSACTION ELSE SET @TranStarted = O ROLLBACK TRANSACTION ALTER PROCEDURE [dbo].aspnet_applications_createapplication @ApplicationName nvarchar(256), @Applicationid uniqueidentifier OUTPUT AS SELECT @Applicationid = Applicationld FROM dbo.aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName, IF(@Applicationld IS NULL) DECLARE @TranStarted bit, SET @TranStarted = O IF( @ @TRANCOUNT =O) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O SELECT @ Applicationld = Applicationld FROM dbo.aspnet_applications WITH (UPDLOCK, HOLDLOCK) WHERE LOWER(@ApplicationName) = LoweredApplicationName IF(@Applicationid IS NULL) 71

SELECT @ Applicationld = NEWID() INSERT dbo.aspnet_applications (Applicationld, ApplicationName, LoweredApplicationN ame) VALUES (@Applicationld, @ApplicationName, LOWER(@ ApplicationN ame)) IF( @TranStarted = 1 ) IF(@@ERROR = O) SET @TranStarted = O COMMIT TRANSACTION ELSE SET @TranStarted = O ROLLBACK TRANSACTION ALTER PROCEDURE dbo.aspnet_membership_createuser @ApplicationN ame @UserName "" nvarchar(256), nvarchar(256), @Password @PasswordSalt @Email @PasswordQuestion @PasswordAnswer @IsApproved nvarchar( 128), nvarchar(128), nvarchar(256), nvarchar(256), nvarchar(128), bit, @Curren ff ime Ute date time, @CreateDate datetime = NULL, @UniqueEmail int = O, @PasswordFormat int = O, @Userld AS uniqueidentifier OUTPUT DECLARE @Applicationld uniqueidentifier 72

SELECT @ Applicationid = NULL DECLARE @NewUserld uniqueidentifier SELECT @NewUserld = NULL DECLARE @IsLockedOut bit SET @IsLockedOut = O DECLARE @LastLockoutDate datetime SET @LastLockoutDate = CONVERT( datetime, '17540101', 112) DECLARE @FailedPasswordAttemptCount int SET @FailedPasswordAttemptCount = O DECLARE @FailedPasswordAttemptWindowStart datetime SET @FailedPasswordAttemptWindowStart = CONVERT( datetime, '17540101', 112) DECLARE @FailedPasswordAnswerAttemptCount int SET @FailedPasswordAnswerAttemptCount = O DECLARE @FailedPasswordAnswerAttemptWindowStart datetime SET @FailedPasswordAnswerAttemptWindowStart = CONVERT( datetime, '17540101', 112) DECLARE @NewUserCreated bit DECLARE @ReturnValue int SET @ReturnValue= O DECLARE @ErrorCode SET @ErrorCode = O int DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O EXEC dbo.aspnet_applications_createapplication @ApplicationName, @Applicationid OUTPUT IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup 73

SET @CreateDate = @CurrentTimeUtc SELECT @NewUserld = Userld FROM dbo.aspnet_users WHERE LOWER(@UserName) = LoweredUserName AND @Applicationid = Applicationid IF ( @NewUserld IS NULL) SET @NewUserld = @Userid EXEC @Return Value = dbo.aspnet_ Users_ CreateU ser @Applicationid, @UserName, O, @CreateDate, @NewUserld OUTPUT SET @NewUserCreated = 1 ELSE SET @NewUserCreated = O IF( @NewUserld <> @Userid AND @Userld IS NOT NULL) SET @ErrorCode = 6 GOTO Cleanup IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup IF( @ReturnValue= -1) SET @ErrorCode = 10 GOTO Cleanup IF ( EXISTS ( SELECT Userld!< FROM dbo.aspnet_membership WHERE @NewUserid = Userld)) SET @ErrorCode = 6 GOTO Cleanup SET @Userld = @NewUserld IF (@UniqueEmail = 1) IF (EXISTS (SELECT * FROM dbo.aspnet_membership m WITH ( UPDLOCK, HOLDLOCK) 74

WHERE Applicationld = @Applicationld AND LoweredEmail = LOWER(@Email))) SET @ErrorCode = 7 GOTO Cleanup IF (@NewUserCreated = O) UPDATE dbo.aspnet_users SET LastActivityDate = @CreateDate WHERE @Userld = Userld IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup INSERT INTO dbo.aspnet_membership ( Applicationld, UserId, Password, PasswordSalt, Email, LoweredEmail, PasswordQuestion, PasswordAnswer, PasswordFormat, IsApproved, IsLockedOut, CreateDate, LastLoginDate, LastPasswordChangedDate, LastLockoutDate, ı. FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart) VALUES ( @Applicationld, @UserId, @Password, @PasswordSalt, @Email, LOWER(@Email), @PasswordQuestion, @PasswordAnswer, @PasswordFormat, @IsApproved, 75

@IsLockedOut, @CreateDate, @CreateDate, @CreateDate, @LastLockoutDate, @FailedPasswordAttemptCount, @FailedPasswordAttemptWindowStart, @FailedPasswordAnswerAttemptCount, @FailedPasswordAnswerAttemptWindowStart) IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup IF( @TranStarted = 1 ) SET @TranStarted = O COMMIT TRANSACTION RETURN O Cleanup: IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION RETURN @ErrorCode ALTER PROCEDURE dbo.aspnet_membership_findusersbyemail @ApplicationName nvarchar(256), @EmailToMatch nvarchar(256), @PageIndex int, 76

@PageSize int AS DECLARE @Applicationld uniqueidentifier SELECT @Applicationld = NULL SELECT @Applicationld = Applicationld FROM dbo.aspnet_applications WHERE LOWER(@ApplicationNaille) = Lowered Applicatiorılvame IF (@Applicationld IS NULL) RETURN O -- Set the page bounds DECLARE @PageLowerBound int DECLARE @PageUpperBound int DECLARE @TotalRecords int SET @PageLowerBound = @PageSize * @Pagelndex SET @PageUpperBound = @PageSize - 1 + @PageLowerBound -- Create a temp table TO store the select results CREATE TABLE #PagelndexForUsers ( Indexld int IDENTITY (O, 1) NOT NULL, U serld uniqueidentifier ) -- Insert into our temp table IF( @EillailToMatch IS NULL) INSERT INTO #PagelndexForUsers (Userld) SELECT u.userld FROM dbo.aspnet_users u, dbo.aspnetmembership ill WHERE u.applicationld = @Applicationld AND ill.userld = u.userld AND ill.email IS NULL ORDER BY m.loweredlimail ELSE INSERT INTO #PagelndexForUsers (Userld) SELECT u.userld FROM dbo.aspnet_users u, dbo.aspnet_meillbership ill WHERE u.applicationld = @Applicationld AND ill.userld = u.userld AND m.loweredlimail LIKE LOWER(@EillailToMatch) ORDER BY m.loweredlimail SELECT u.userlvame, m.email, m.passwordquestion, ill.comment, m.is Approved, ill. CreateDate, ill.lastlogindate, u.lastactivitydate, ill.lastpasswordchangeddate, u.userld, m.isl.ockedout, ill.lastlockoutdate FROM dbo.aspnetmembership ill, dbo.aspnet_users u, #PagelndexForUsers p WHERE u.userld = p.userld AND u.userld = ill.userld AND p.indexld >= @PageLowerBound AND p.indexld <= @PageUpperBound 77

ORDER BY rn.loweredernail SELECT @TotalRecords = COUNT(*) FROM #PagelndexForUsers RETURN @TotalRecords ALTER PROCEDURE dbo.aspnet_mernbership_findusersbynarne @ApplicationNarne nvarchar(256), @UserNarneToMatch nvarchar(256), @PageIndex int, @PageSize int AS DECLARE @Applicationld uniqueidentifier SELECT @ Applicationld = NULL SELECT @Applicationld = Applicationld FROM dbo.aspnet_applications WHERE LOWER(@ApplicationNarne) = LoweredApplicationNarne IF (@Applicationld IS NULL) RETURN O -- Set the page bounds DECLARE @PageLowerBound int DECLARE @PageUpperBounciint DECLARE @TotalRecords int SET @PageLowerBound = @PageSize * @Pagelndex SET @PageUpperBound = @PageSize - 1 + @PageLowerBound -- Create a temp table TO store the select results CREATE TABLE #PagelndexForUsers ( Indexld int IDENTITY (O, 1) NOT NULL, Userld uniqueidentifier ) -- Insert into our temp table INSERT INTO #PagelndexForUsers (Userld) SELECT u.userld 78

FROM dbo.aspnet_users u, dbo.aspnet_membership m WHERE u.applicationld = @Applicationld AND m.userld = u.userld AND u.loweredusername LIKE LOWER(@UserNameToMatch) ORDER BY u.username SELECT u.username, m.email, m.passwordquestion, m.comment, m.isapproved, m.createdate, m.lastlogindate, u.lastactivitydate, m.lastpasswordchangeddate, u.userld, m.islockedout, m.lastlockoutdate FROM dbo.aspnet_membership m, dbo.aspnet_users u, #PagelndexForUsers p WHERE u.userld = p.userld AND u.userld = m.userld AND p.indexld >= @PageLowerBound AND p.indexld <= @PageUpperBound ORDER BY u.username SELECT @TotalRecords = COUNT(*) FROM #PagelndexForUsers RETURN @TotalRecords ALTER PROCEDURE dbo.aspnet_membership_findusersbyname @ApplicationName nvarchar(256), l< @UserNameToMatch nvarchar(256), @Pagelndex int, @PageSize int AS DECLARE @Applicationld uniqueidentifier SELECT @ Applicationld = NULL SELECT @Applicationld = Applicationld FROM dbo.aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationld IS NULL) RETURN O -- Set the page bounds DECLARE @PageLowerBound int DECLARE @PageUpperBound int 79

DECLARE @TotalRecords int SET @PageLowerBound = @PageSize * @Pageindex SET @PageUpperBound = @PageSize - 1 + @PageLowerBound -- Create a temp table TO store the select results CREATE TABLE #PagelndexForUsers ( Indexid int IDENTITY (O, 1) NOT NULL, Userid uniqueidentifier ) -- Insert into our temp table INSERT INTO #PageindexForUsers (Userld) SELECT u.userid FROM dbo.aspnet_users u, dbo.aspnet_membership m WHERE u.applicationid = @Applicationid AND m.userid = u.userid AND u.loweredusername LIKE LOWER(@UserNameToMatch) ORDER BY u.username SELECT u.username, m.email, m.passwordquestion, m.comment, m.isapproved, m. CreateDate, m.lastlogindate, u.lastactivitydate, m.lastpasswordchangeddate, u.userld, m.islockedout, m.lastlockoutdate FROM dbo.aspnet_membership m, dbo.aspnet_users u, #PagelndexForUsers p WHERE u.userld = p.userld AND u.userld = m.userld AND p.indexid >= @PageLowerBound AND p.indexid <= @PageUpperBound ORDER BYu.UserName SELECT @TotalRecords = COUNT(*) FROM #PagelndexForUsers RETURN @TotalRecords ~ ALTER PROCEDURE dbo.aspnet_membership_ GetNumberOfU sersonline @ApplicationName nvarchar(256), @MinutesSinceLastlnActi ve int, 80

@CurrentTimeUtc date time AS DECLARE @DateActive datetime SELECT @DateActive = DATEADD(minute, -(@MinutesSinceLastlnActive), @CurrentTimeUtc) DECLARE @NumOnline int SELECT @NumOnline = COUNT(*) FROM dbo.aspnet_users u(nolock), dbo.aspnet_applications a(nolock), dbo.aspnet_membership m(nolock) WHERE u.applicationld = a.applicationld AND LastActivityDate > @DateActive. AND a.loweredapplicationname = LOWER(@ApplicationName) AND u.userld = m.userld RETURN( @Numünline) ALTER PROCEDURE dbo.aspnet_membership_getnumberofusersonline @ApplicationName nvarchar(256), @MinutesSinceLastlnActive int, @CurrentTimeUtc datetime AS DECLARE @DateActive datetime SELECT @DateActive = DATEADD(minute, -(@MinutesSinceLastlnActive), @CurrentTimeUtc) DECLARE @NumOnline int SELECT @NumOnline = COUNT(*) FROM dbo.aspnet_users u(nolock), dbo.aspnet_applications a(nolock), dbo.aspnet_membership m(nolock) WHERE u.applicationld = a.applicationld AND LastActivityDate > @DateActive AND a.loweredapplicationname = LOWER(@ApplicationName) AND u.userld = m.userld RETURN( @NumOnline) 81

ALTER PROCEDURE dbo.aspnet_membership_getpasswordwithformat @ApplicationN ame nvarchar(256), @UserName nvarchar(256), @UpdateLastLoginActivityDate bit, @CurrentTimeUtc datetime AS DECLARE @IsLockedOut bit DECLARE @Userld uniq ueidentifier DECLARE @Password nvarchar(128) DECLARE @PasswordSalt nvarchar(128) DECLARE @PasswordFormat int DECLARE @FailedPasswordAttemptCount int DECLARE @FailedPasswordAnswerAttemptCount int DECLARE @IsApproved bit DECLARE @LastActivityDate datetime DECLARE @LastLoginDate datetime SELECT @Userld =NULL SELECT @Userld = u.userld, @IsLockedOut = m.lslockedout, @Password=Password, @PasswordFormat=PasswordFormat, @PasswordSalt=PasswordSalt, @FailedPasswordAttemptCount=FailedPasswordAttemptCount, @FailedPasswordAnswerAttemptCount=FailedPasswordAnswerAttemptCount, @IsApproved=lsApproved, @LastActivityDate = LastActivityDate, @LastLoginDate = LastLoginDate FROM dbo.aspnet_applications a, dbo.aspnet Üsers u, dbo.aspnet_membership m WHERE LOWER(@ApplicationN ame) = a.loweredapplicationn ame AND u.applicationld = a.applicationld AND u.userld = m.userld AND LOWER(@UserName) = u.loweredusername IF ( @Userld IS NULL) RETURN 1 IF (@IsLockedOut = 1) RETURN 99 82

SELECT @Password, @PasswordFormat, @PasswordSalt, @FailedPasswordAttemptCount, @FailedPasswordAnswer AttemptCount, @lsapproved, @LastLoginDate, @LastActivityDate IF (@UpdateLastLoginActivityDate = 1 AND @lsapproved = 1) UPDATE dbo.aspnet_membership SET LastLoginDate = @CurrentTimeUtc WHERE Userld = @Userld UPDATE dbo.aspnet_users SET LastActivityDate = @CurrentTimeUtc WHERE @User Id = User Id RETURN O ALTER PROCEDURE dbo.aspnet_membership_ GetU serb yemail @ApplicationN ame nvarchar(256), @Email nvarchar(256) AS IF( @Email IS NULL) SELECT u.username FROM dbo.aspnet_applications " a, dbo.aspnet_users u, dbo.aspnet_membership m WHERE LOWER(@ApplicationN ame) = a.loweredapplicationn ame AND u.applicationld = a.applicationld AND u.userld = m.userld AND m.loweredemail IS NULL ELSE SELECT u.username FROM dbo.aspnet_applications a, dbo.aspnet_users u, dbo.aspnet_membership m WHERE LOWER(@ApplicationN ame) = a.loweredapplicationn ame AND u.applicationld = a.applicationld AND u.userld = m.userld AND LOWER(@Email) = m.loweredemail 83

IF (@ @rowcount = O) RETURN(l) RETURN(O) ALTER PROCEDURE dbo.aspnet_membership_ GetU serbyn ame @ApplicationN ame nvarchar(256), @UserName nvarchar(256), @CurrentTimeUtc datetime, @UpdateLastActivity bit= O AS DECLARE @Userld uniqueidentifier IF (@UpdateLastActivity = 1) SELECT TOP 1 m.email, m.passwordquestion, m.comment, m.lsapproved, m.createdate, m.lastlogindate, @CurrentTimeUtc, m.lastpasswordchangeddate, u.user Id, m.islockedout,m.lastlockoutdate FROM dbo.aspnet_applications a, dbo.aspnet_users u, dbo.aspnet_membership m WHERE LOWER(@ ApplicationN ame) = a.loweredapplicationn ame AND u.applicationld = a.applicationld AND LOWER(@UserName) = u.loweredusername AND u.userld = m.userld IF (@@ROWCOUNT RETURN -1 dbo.aspnet_users = O) -- Usernarne not found UPDATE SET LastActivityDate = @CurrentTimeUtc WHERE @Userld = Userld ELSE SELECT TOP 1 m.email, m.passwordquestion, m.comment, m.lsapproved, m.createdate, m.lastlogindate, u.lastactivitydate, m.lastpasswordchangeddate, u.u serld, m.lslockedout,m.lastlockoutdate FROM dbo.aspnet_applications a, dbo.aspnet_users u, dbo.aspnet_membership m WHERE LOWER(@ApplicationName) = a.loweredapplicationname AND u.applicationld = a.applicationld AND 84

LOWER(@UserName) = u.loweredusername AND u.userld = m.userld IF (@@ROWCOUNT RETURN -1 = 0)-- Username not found RETURN O ALTER PROCEDURE dbo.aspnet_membership_ GetU serb yu serld @User Id uniqueidentifier, @CurrentTime Utc date time, @UpdateLastActivity bit= O AS IF ( @UpdateLastActivity = 1 ) UPDATE dbo.aspnet_users SET LastActivityDate = @CurrentTimeUtc FROM dbo.aspnet_users WHERE @Userld = U serld IF ( @@ROWCOUNT RETURN -1 =O) -- User ID not found SELECT m.email, m.passwordquestion, m.comment, m.isapproved, m.createdate, m.lastlogindate, u.lastactivitydate, m.lastpasswordchangeddate, u.u sern ame, m.islockedout, m.lastlockoutdate FROM dbo.aspnet_users u, dbo.aspnet_membership m WHERE @Userld = u.userld AND u.userld = m.userld IF ( @@ROWCOUNT RETURN -1 =O) -- User ID not found RETURN O 85

15- ALTER PROCEDURE dbo.aspnet_membership_resetpassword @ApplicationName nvarchar(256), @UserName nvarchar(256), @NewPassword nvarchar(128), @MaxlnvalidPasswordAttempts int, @PasswordAttemptWindow int, @PasswordSalt nvarchar( 128), @CurrentTimeUtc datetime, @PasswordFormat int= O, @PasswordAnswer nvarchar(l28) = NULL AS DECLARE @IsLockedOut DECLARE @LastLockoutDate bit datetime DECLARE @FailedPasswordAttemptCount int DECLARE @FailedPasswordAttemptWindowStart datetime DECLARE @FailedPasswordAnswerAttemptCount int DECLARE @FailedPasswordAnswerAttemptWindowStart datetime DECLARE @Userld SET @Userld = NULL uniqueidentifier DECLARE @ErrorCode SET @ErrorCode = O int DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O SELECT @Userld = u.userld FROM dbo.aspnet_users u, dbo.aspnet_applications a, dbo.aspnet_membership m WHERE LoweredUserName = LOWER(@UserName) AND u.applicationld = a.applicationld AND LOWER(@ApplicationName) = a.loweredapplicationname AND u.userld = m.userld IF ( @Userld IS NULL) SET @ErrorCode = 1 GOTO Cleanup 86

SELECT @IsLockedOut = IsLockedOut, @LastLockoutDate = LastLockoutDate, @FailedPasswordAttemptCount = FailedPasswordAttemptCount, @FailedPasswordAttemptWindowStart = FailedPasswordAttemptWindowStart, @FailedPasswordAnswerAttemptCount = FailedPasswordAnswerAttemptCount, @FailedPasswordAnswerAttemptWindowStart = FailedPasswordAnswerAttemptWindowStart FROM dbo.aspnet_membership WITH ( UPDLOCK) WHERE @Userld = U serld IF( @IsLockedOut = 1 ) SET @ErrorCode = 99 GOTO Cleanup UPDATE dbo.aspnet_membership SET Password= @NewPassword, LastPasswordChangedDate = @CurrentTimeUtc, PasswordFormat = @PasswordFormat, PasswordSalt = @PasswordSalt WHERE @Userld = U serld AND ( ( @PasswordAnswer IS NULL) OR ( LOWER( PasswordAnswer) = LOWER( @PasswordAnswer))) IF ( @@ROWCOUNT =O) IF( @CurrentTimeUtc > DATEADD( minute, @PasswordAttemptWindow, @FailedPasswordAnswerAttemptWindowStart)) SET @FailedPasswordAnswerAttemptWindowStart SET @FailedPasswordAnswerAttemptCount = 1 ELSE SET @FailedPasswordAnswerAttemptWindowStart SET @FailedPasswordAnswerAttemptCount = @FailedPasswordAnswerAttemptCount + 1 IF( @FailedPasswordAnswerAttemptCount >= @MaxlnvalidPasswordAttempts ) SET @IsLockedOut = 1 SET @LastLockoutDate = @CurrentTimeUtc 87 = @CurrentTimeUtc = @CurrentTimeUtc

SET @ErrorCode = 3 ELSE IF( @FailedPasswordAnswerAttemptCount >O) SET @FailedPasswordAnswerAttemptCount = O SET @FailedPasswordAnswerAttemptWindowStart = CONVERT( datetime, '17540101', 112) IF( NOT ( @PasswordAnswer IS NULL)) UPDATE dbo.aspnet_membership SET IsLockedOut = @IsLockedOut, LastLockoutDate = @LastLockoutDate, FailedPasswordAttemptCount = @FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart = @FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount = @FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart = @FailedPasswordAnswerAttemptWindowStart WHERE @Userld = Userld IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup IF( @TranStarted = 1 ) SET @TranStarted = O COMMIT TRANSACTION RETURN @ErrorCode Cleanup: IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION RETURN @ErrorCode 88

ALTER PROCEDURE dbo.aspnet_membership_setpassword @ApplicationName nvarchar(256), @UserName nvarchar(256), @NewPassword nvarchar(128), @PasswordSalt nvarchar( 128), @CurrentTimeUtc datetime, @PasswordFormat int= O AS DECLARE @Userld uniqueidentifier SELECT @Userld = NULL SELECT @Userld = u.userld FROM dbo.aspnet_users u, dbo.aspnet_applications a, dbo.aspnet_membership m WHERE LoweredUserName = LOWER(@UserName) AND u.applicationld = a.applicationld AND LOWER(@ ApplicationN ame) = a.loweredapplicationn ame AND u. Userld = m. Userld IF (@Userld IS NULL) RETURN(l) UPDATE dbo.aspnet_membersfiip SET Password= @NewPassword, PasswordFormat = @PasswordFormat, PasswordSalt = @PasswordSalt, LastPasswordChangedDate = @CurrentTime Utc WHERE @Userld = Userld RETURN(O) 89

ALTER PROCEDURE dbo.aspnet_membership_unlockuser @ApplicationName nvarchar(256), @User Name nvarchar(256) AS DECLARE @Userld uniqueidentifier SELECT @Userld = NULL SELECT @Userld = u.userld FROM dbo.aspnet_users u, dbo.aspnet_applications a, dbo.aspnet_membership m WHERE LoweredUserName = LOWER(@UserName) AND u.applicationld = a.applicationld AND LOWER(@ApplicationName) = a.loweredapplicationname AND u.userld = m.userld IF ( @Userld IS NULL) RETURN 1 UPDATE dbo.aspnet_membership SET IsLockedOut = O, FailedPasswordAttemptCount = O, FailedPasswordAttemptWindowStart = CONVERT( datetime, '17540101', 112 ), FailedPasswordAnswerAttemptCount = O, FailedPasswordAnswerAttemptWindowStart = CONVERT( datetime, '17540101', 112 ), LastLockoutDate = CONVERT( datetime, '17540101', 112) WHERE @Userld = Userld RETURN O 8- ALTER PROCEDURE dbo.aspnet_membership_updateuser @ApplicationName nvarchar(256), @UserName nvarchar(256), @Email nvarchar(256), @Comment ntext, @IsApproved bit, @LastLoginDate datetime, @LastActivityDate datetime, @UniqueEmail int, @CurrentTimeUtc datetime AS 90

DECLARE @Userld uniqueidentifier DECLARE @Applicationid uniqueidentifier SELECT @Userld = NULL SELECT @Userid = u.userid, @Applicationid = a.applicationid FROM dbo.aspnet_users u, dbo.aspnet_applications a, dbo.aspnet_membership m WHERE LoweredUserName = LOWER(@UserName) AND u.applicationid = a.applicationid AND LOWER(@ApplicationName) = a.loweredapplicationname AND u.userid = m.userid IF (@Userid IS NULL) RETURN(l) IF (@UniqueEmail = 1) IF (EXISTS (SELECT * FROM dbo.aspnet_membership WITH (UPDLOCK, HOLDLOCK) WHERE Applicationid = @ Applicationid AND @Userld <> Userld AND LoweredEmail = LOWER(@Email))) RETURN(7) DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT =O) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O UPDATE dbo.aspnet_users WITH (ROWLOCK) SET LastActivityDate = @LastActivityDate WHERE @Userld = Userld IF( @@ERROR<> O) GOTO Cleanup UPDATE dbo.aspnet_membership WITH (ROWLOCK) SET Email = @Email, LoweredEmail = LOWER(@Email), Comment = @Comment, IsApproved = @IsApproved, 91

LastLoginDate = @LastLoginDate WHERE @Userld = Userld IF( @@ERROR<> O) GOTO Cleanup IF( @TranStarted = 1 ) SET @TranStarted = O COMMIT TRANSACTION RETURN O Cleanup: IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION RETURN -1 ALTER PROCEDURE dbo.aspnet_membership_ Update User Info @ApplicationName nvarchar(256), @User Name nvarchar(256), @IsPasswordCorrect bit, @UpdateLastLoginActivityDate bit, @MaxlnvalidPasswordAttempts int, @PasswordAttempt Window int, @CurrentTimeUtc datetime, @LastLoginDate datetime, @LastActivityDate datetime 92

AS DECLARE @Userid uniqueidentifier DECLARE @IsApproved bit DECLARE @IsLockedOut bit DECLARE @LastLockoutDate date time DECLARE @FailedPasswordAtternptCount int DECLARE @FailedPasswordAtternptWindowStart datetirne DECLARE @FailedPasswordAnswerAtternptCount int DECLARE @FailedPasswordAnswerAtternptWindowStart datetirne DECLARE @ErrorCode int SET @ErrorCode = O DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT =O) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O SELECT @Userld = u.userld, @IsApproved = rn.isapproved, @IsLockedOut = rn.islockedout, @LastLockoutDate = rn.lastlockoutdate, @FailedPasswordAtternptCount = rn.failedpasswordattemptcount, @FailedPasswordAtternptWindowStart = rn.failedpasswordatternptwindowstart, @FailedPasswordAnswerAtternptCount = rn.failedpasswordansweratternptcount, @FailedPasswordAnswerAtternptWindowStart = m.failedpasswordansweratternptwindowstart FROM dbo.aspnet_applications a, dbo.aspnet_users u, dbo.aspnet_membership rn WITH ( UPDLOCK ) WHERE LOWER(@ApplicationNarne) = a.loweredapplicationnarne AND u.applicationid = a.applicationid AND ' u.userid = rn.userid AND LOWER(@UserNarne) = u.loweredusernarne IF ( @@rowcount =O) SET @ErrorCode = 1 GOTO Cleanup IF( @IsLockedOut = 1 ) 93

GOTO Cleanup IF( @IsPasswordCorrect = O ) IF( @CurrentTimeUtc > DATEADD( minute, @PasswordAttemptWindow, @FailedPasswordAttemptWindowStart)) SET @FailedPasswordAttemptWindowStart = @CurrentTimeUtc SET @FailedPasswordAttemptCount = 1 ELSE SET @FailedPasswordAttemptWindowStart = @CurrentTimeUtc SET @FailedPasswordAttemptCount = @FailedPasswordAttemptCount + 1 IF( @FailedPasswordAttemptCount >= @MaxlnvalidPasswordAttempts) SET @IsLockedOut = 1 SET @LastLockoutDate = @CurrentTimeUtc ELSE IF( @FailedPasswordAttemptCount > O OR @FailedPasswordAnswerAttemptCount >O) SET @FailedPasswordAttemptCount = O SET @FailedPasswordAttemptWindowStart = CONVERT( datetime, '17540101', 112) SET @FailedPasswordAnswerAttemptCount = O SET @FailedPasswordAnswerAttemptWindowStart = CONVERT( datetime, '17540101 ', 112) SET @LastLockoutDate = CONVERT( datetime, '17540101', 112) IF( @UpdateLastLoginActivityDate = 1 ) UPDATE dbo.aspnet_users SET LastActivityDate = @LastActivityDate WHERE @Userld = Userld IF( @@ERROR<> O) SET @ErrorCode = -1 94

GOTO Cleanup UPDATE dbo.aspnet_membership SET LastLoginDate = @LastLoginDate WHERE Userld = @Userld IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup UPDATE dbo.aspnet_membership SET IsLockedOut = @IsLockedOut, LastLockoutDate = @LastLockoutDate, FailedPasswordAttemptCount = @FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart = @FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount = @FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart = @FailedPasswordAnswerAttemptWindowStart WHERE @Userld = Userld IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup IF( @TranStarted = 1 ) SET @TranStarted = O COMMIT TRANSACTION RETURN @ErrorCode Cleanup: IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION RETURN @ErrorCode 95

ALTER PROCEDURE dbo.aspnet_paths_ CreatePath @Applicationid UNIQUEIDENTIFIER, @Path NVARCHAR(256), @Pathid UNIQUEIDENTIFIER OUTPUT AS TRANSACTION IF (NOT EXISTS(SELECT * FROM dbo.aspnet_paths WHERE LoweredPath = LOWER(@Path) AND Applicationid = @Applicationid)) INSERT dbo.aspnet_paths (Applicationid, Path, LoweredPath) VALUES (@Applicationid, @Path, LOWER(@Path)) COMMIT TRANSACTION SELECT @Pathid = Pathid FROM dbo.aspnet_paths WHERE LOWER(@Path) = LoweredPath AND Applicationid = @ Applicationid ı - ALTER PROCEDURE dbo.aspnet_personalization_getapplicationid ( @ApplicationName NVARCHAR(256), @Applicationid UNIQUEIDENTIFIER OUT) AS SELECT @Applicationld = Applicationid FROM dbo.aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName 96

ALTER PROCEDURE dbo.aspnet_personalizationadministration_deleteallstate ( @AllUsersScope bit, @ApplicationName NVARCHAR(256), @Count int OUT) AS DECLARE @Applicationid UNIQUEIDENTIFIER EXEC dbo.aspnet_personalization_ GetApplicationid @ApplicationN ame, @Applicationid OUTPUT IF (@ Applicationid IS NULL) SELECT @Count= O ELSE IF (@AllUsersScope = 1) DELETE FROM aspnet_personalizationallusers WHERE Pathid IN (SELECT Paths.Pathid FROM dbo.aspnet_paths Paths WHERE Paths.Applicationid = @Applicationid) ELSE DELETE FROM aspnet_personalizationperuser WHERE Pathid IN (SELECT Paths.Pathid FROM dbo.aspnet_paths Paths WHERE Paths.Applicationid = @Applicationid) SELECT @Count= @@ROWCOUNT ALTER PROCEDURE dbo.aspnet_personalizationadministration_findstate ( @AllUsersScope bit, @ApplicationName NVARCHAR(256), @PageIndex INT, @PageSize INT, @Path NVARCHAR(256) = NULL, @UserName NVARCHAR(256) = NULL, 97

@InactiveSinceDate DATETIME = NULL) AS DECLARE @Applicationld UNIQUEIDENTIFIER EXEC dbo.aspnet_personalization_ GetApplicationld @ApplicationName, @Applicationld OUTPUT IF (@ Applicationld IS NULL) RETURN -- Set the page bounds DECLARE @PageLowerBound INT DECLARE @PageUpperBound INT DECLARE @TotalRecords INT SET @PageLowerBound = @PageSize * @Pagelndex SET @PageUpperBound = @PageSize - 1 + @PageLowerBound -- Create a temp table to store the selected results CREA TE TABLE #Pagelndex ( Indexld int IDENTITY (O, 1) NOT NULL, Itemld UNIQUEIDENTIFIER ) IF (@AllUsersScope = 1) -- Insert into our temp table INSERT INTO #Pagelndex (Itemid) SELECT Paths.Pathld FROM dbo.aspnet_paths Paths, ((SELECT Paths.Pathid FROM dbo.aspnet_personalizationallusers AllUsers, dbo.aspnet_paths Paths WHERE Paths.Applicationld = @Applicationld AND AllUsers.Pathid = Paths.Pathid AND (@Path IS NULL OR Paths.LoweredPath LIKE LOWER(@Path)) ) AS SharedDataPerPath FULL OUTER JOIN (SELECT DISTINCT Paths.Pathid FROM dbo.aspnet_personalizationperuser PerUser, dbo.aspnet_paths Paths WHERE Paths.Applicationid = @Applicationid AND PerUser.Pathld = Paths.Pathid AND (@Path IS NULL OR Paths.LoweredPath LIKE LOWER(@Path)) ) AS UserDataPerPath ON SharedDataPerPath.Pathld = UserDataPerPath.Pathld ) WHERE Paths.Pathld = SharedDataPerPath.Pathid OR Paths.Pathid = UserDataPerPath.Pathid ORDER BY Paths.Path ASC SELECT @TotalRecords = @@ROWCOUNT SELECT Paths.Path, 98

SharedDataPerPath.LastUpdatedDate, SharedDataPerPath.SharedDataLength, U serdataperpath. UserDataLength, U serdataperpath. UserCount FROM dbo.aspnet_paths Paths, ((SELECT Pagelndex.Itemld AS Pathld, AllUsers.LastUpdatedDate AS LastUpdatedDate, DATALENGTH(AllUsers.PageSettings) AS SharedDataLength FROM dbo.aspnet_personalizationallusers AllUsers, #Pagelndex Pagelndex WHERE AllUsers.Pathld = Pagelndex.Itemld AND Pagelndex.lndexld >= @PageLowerBound AND Pagelndex.lndexld <= @PageUpperBound ) AS SharedDataPerPath FULL OUTER JOIN (SELECT Pagelndex.Itemld AS Pathld, SUM(DATALENGTH(PerUser.PageSettings)) AS UserDataLength, COUNT(*) AS UserCount FROM aspnet_personalizationperuser PerUser, #Pagelndex Pagelndex WHERE PerUser.Pathld = Pagelndex.Itemld AND Pagelndex.lndexld >= @PageLowerBound AND Pagelndex.lndexld <= @PageUpperBound GROUP BY Pagelndex.Itemld ) AS UserDataPerPath ON SharedDataPerPath.Pathld = UserDataPerPath.Pathld ) WHERE Paths.Pathld = SharedDataPerPath.Pathld OR Paths.Pathld = UserDataPerPath.Pathld ORDER BY Paths.Path ASC ELSE -- Insert into our temp table INSERT INTO #Pagelndex (ltemld) SELECT PerUser.Id FROM dbo.aspnet_personalizationperuser PerUser, dbo.aspnet_users Users, dbo.aspnet_paths Paths " WHERE Paths.Applicationld = @Applicationld AND PerUser.Userld = Users.Userld AND PerUser.Pathld = Paths.Pathld AND (@Path IS NULL OR Paths.LoweredPath LIKE LOWER(@Path)) AND (@UserName IS NULL OR Users.LoweredUserName LIKE LOWER(@UserName)) AND (@lnactivesincedate IS NULL OR Users.LastActivityDate <= @InactiveSinceDate) ORDER BY Paths.Path ASC, Users.UserName ASC SELECT @TotalRecords = @@ROWCOUNT SELECT Paths.Path, PerUser.LastUpdatedDate, DATALENGTH(PerUser.PageSettings), Users.UserName, Users.LastActivityDate 99

FROM dbo.aspnet_personalizationperuser PerUser, dbo.aspnet_users Users, dbo.aspnet_paths Paths, #Pageindex Pagelndex WHERE PerUser.Id = Pageindex.Itemid AND PerUser.Userid = Users.Userld AND PerUser.Pathid = Paths.Pathid AND Pageindex.Indexid >= @PageLowerBound AND Pageindex.Indexid <= @Page Upper Bound ORDER BY Paths.Path ASC, Users.UserName ASC RETURN @TotalRecords ALTER PROCEDURE dbo.aspnet_personalizationadministration_ GetCountOfState ( @Count int OUT, @AllUsersScope bit, @ApplicationN ame NV ARCHAR(256), @Path NVARCHAR(256) = NULL, @UserName NVARCHAR(256) = NULL, @InactiveSinceDate DATETIME = NULL) AS DECLARE @Applicationid UNIQUEIDENTIFIER EXEC dbo.aspnet_personalization_ GetApplicationid @ApplicationN ame, @Applicationid OUTPUT IF (@Applicationid IS NULL) SELECT @Count= O ELSE IF (@AllUsersScope = 1) SELECT @Count= COUNT(*) FROM dbo.aspnet_personalizationallusers AllUsers, dbo.aspnet_paths Paths WHERE Paths.Applicationid = @Applicationid AND AllUsers.Pathid = Paths.Pathid AND (@Path IS NULL OR Paths.LoweredPath LIKE LOWER(@Path)) ELSE SELECT @Count= COUNT(*) FROM dbo.aspnet_personalizationperuser PerUser, dbo.aspnet_users Users, dbo.aspnet_paths Paths WHERE Paths.Applicationid = @Applicationid AND PerUser.Userld = Users.Userld AND PerUser.Pathid = Paths.Pathid 100

AND (@Path IS NULL OR Paths.LoweredPath LIKE LOWER(@Path)) AND (@UserName IS NULL OR Users.LoweredUserName LIKE LOWER(@UserName)) AND (@InactiveSinceDate IS NULL OR Users.LastActivityDate <= @InactiveSinceDate) 5 - ALTER PROCEDURE dbo.aspnet_personalizationadministration_resetsharedstate ( @Count int OUT, @ApplicationName NVARCHAR(256), @Path NVARCHAR(256)) AS DECLARE @Applicationid UNIQUEIDENTIFIER EXEC dbo.aspnet_personalization_ GetApplicationid @ApplicationN ame, @Applicationid OUTPUT IF (@Applicationid IS NULL) SELECT @Count = O ELSE DELETE FROM dbo.aspnet_personalizationallu sers WHERE Pathid IN (SELECT AllUsers.Pathid FROM dbo.aspnet_personalizationallusers AllUsers, dbo.aspnet_paths Paths WHERE Paths.Applicationid = @Applicationid AND AllUsers.Pathid = Paths.Pathid AND Paths.Loweredl'ath = LOWER(@Path)) SELECT @Count= @@ROWCOUNT ALTER PROCEDURE dbo.aspnet_personalizationadministration_resetuserstate ( 101

@Count @ ApplicationN ame @InactiveSinceDate int OUT, NV ARCHAR(256), DATETIME = NULL, NV ARCHAR(256) = NULL, NV ARCHAR(256) = NULL) @UserName @Path AS DECLARE @Applicationld UNIQUEIDENTIFIER EXEC dbo.aspnet_personalization_ GetApplicationld @ApplicationName, @Applicationld OUTPUT IF (@Applicationld IS NULL) SELECT @Count = O ELSE DELETE FROM dbo.aspnet_personalizationperuser WHERE Id IN (SELECT PerUser.ld FROM dbo.aspnet_personalizationperuser PerUser, dbo.aspnet_users Users, dbo.aspnet_paths Paths WHERE Paths.Applicationld = @Applicationld AND PerUser.Userld = Users.Userld AND PerUser.Pathld = Paths.Pathld AND (@lnactivesincedate IS NULL OR Users.LastActivityDate <= @InactiveSinceDate) AND (@UserName IS NULL OR Users.LoweredUserName = LOWER(@UserName)) AND (@Path IS NULL OR Paths.LoweredPath = LOWER(@Path))) SELECT @Count= @@ROWCOUNT ALTER PROCEDURE dbo.aspnet_personalizationallusers_getpagesettings ( @ApplicationName NVARCHAR(256), @Path NVARCHAR(256)) AS DECLARE @Applicationld UNIQUEIDENTIFIER DECLARE @Pathld UNIQUEIDENTIFIER SELECT @ Applicationld = NULL SELECT @Pathld = NULL 102

EXEC dbo.aspnet_personalization_ GetApplicationid @ApplicationN ame, @Applicationid OUTPUT IF (@Applicationid IS NULL) RETURN SELECT @Pathid = u.pathid FROM dbo.aspnet_paths u WHERE u.applicationid = @Applicationid AND u.loweredpath = LOWER(@Path) IF (@Pathid IS NULL) RETURN SELECT p.pagesettings FROM dbo.aspnet_personalizationallusers p WHERE p.pathid = @Pathid ALTER PROCEDURE dbo.aspnet_personalizationallusers_resetpagesettings ( @ApplicationName NVARCHAR(256), @Path NVARCHAR(256)) AS DECLARE @Applicationid UNIQUEIDENTIFIER DECLARE @Pathid UNIQUEIDENTIFIER SELECT @ Applicationid = NULL SELECT @Pathid = NULL EXEC dbo.aspnet_personalization_getapplicationid @ApplicationName, @Applicationid OUTPUT. IF (@Applicationid IS NULL) RETURN SELECT @Pathid = u.pathid FROM dbo.aspnet_paths u WHERE u.applicationid = @Applicationid AND u.loweredpath = LOWER(@Path) IF (@Pathid IS NULL) RETURN 103

DELETE FROM dbo.aspnet_personalizationallusers RETURN O WHERE Pathld = @Pathld ALTER PROCEDURE dbo.aspnet_personalizationallusers_setpagesettings ( @ApplicationName NVARCHAR(256), @Path NVARCHAR(256), @PageSettings IMAGE, @CurrentTimeUtc DATETIME) AS DECLARE @Applicationld UNIQUEIDENTIFIER DECLARE @Pathld UNIQUEIDENTIFIER SELECT @ Applicationld = NULL SELECT @Pathld = NULL EXEC dbo.aspnet_applications_createapplication @ApplicationName, @Applicationld OUTPUT SELECT @Pathld = u.pathld FROM dbo.aspnet_paths u WHERE u.applicationld = @Applicationld AND u.loweredpath = LOWER(@Path) IF (@Pathld ıs NULL) EXEC dbo.aspnet_paths_createpath @Applicationld, @Path, @Pathld OUTPUT ' IF (EXISTS(SELECT Pathld FROM dbo.aspnet_personalizationallusers WHERE Pathld = @Pathld)) UPDATE dbo.aspnet_personalizationallusers SET PageSettings = @PageSettings, LastUpdatedDate = @CurrentTimeUtc WHERE Pathld = @Pathld ELSE INSERT INTO dbo.aspnet_personalizationallusers(pathld, PageSettings, LastUpdatedDate) VALUES (@Pathld, @PageSettings, @CurrentTimeUtc) RETURN O 104

ALTER PROCEDURE dbo.aspnet_personalizationperuser_getpagesettings ( @ApplicationN ame NV ARCHAR(256), @UserName NVARCHAR(256), @Path NVARCHAR(256), @CurrentTimeUtc DATETIME) AS DECLARE @Applicationld UNIQUEIDENTIFIER DECLARE @Pathld UNIQUEIDENTIFIER DECLARE @Userid UNIQUEIDENTIFIER SELECT @ Applicationld SELECT @Pathld = NULL SELECT @Userld = NULL = NULL EXEC dbo.aspnet_personalization_getapplicationld @ ApplicationName, @Applicationid OUTPUT IF (@Applicationld IS NULL) RETURN SELECT @Pathid = u.pathld FROM dbo.aspnet_paths u WHERE u.applicationid = @Applicationid AND u.loweredpath = LOWER(@Path) IF (@Pathid IS NULL) RETURN SELECT @Userld = u.userld FROM dbo.aspnetdsers u WHERE u.applicationid = @Applicationid AND u.loweredusername = LOWER(@UserName) IF (@Userld IS NULL) RETURN UPDATE dbo.aspnet_users WITH (ROWLOCK) SET LastActivityDate = @CurrentTimeUtc WHERE Userid = @Userld IF (@@ROWCOUNT = O) -- Username not found RETURN 105

SELECT p.pagesettings FROM dbo.aspnet_personalizationperuser p WHERE p.pathld = @Pathld AND p.userld = @Userld 1- ALTER PROCEDURE dbo.aspnet_personalizationperuser_resetpagesettings ( @ApplicationName NVARCHAR(256), @UserName NVARCHAR(256), @Path NVARCHAR(256), @CurrentTimeUtc DATETIME) AS DECLARE @Applicationld UNIQUEIDENTIFIER DECLARE @Pathid UNIQUEIDENTIFIER DECLARE @Userid UNIQUEIDENTIFIER SELECT @ Applicationid = NULL SELECT @Pathid = NULL SELECT @Userld = NULL EXEC dbo.aspnet_personalization_getapplicationid @ApplicationName, @Applicationid OUTPUT IF (@Applicationld IS NULL) RETURN SELECT @Pathid = u.pathid FROM dbo.aspnet_paths u WHERE u.applicationid = @Applicationid AND u.loweredpath = LOWER(@Path) IF (@Pathid IS NULL) RETURN SELECT @Userld = u.userld FROM dbo.aspnet_users u WHERE u.applicationid = @Applicationid AND u.loweredusername = LOWER(@UserName) IF (@Userid IS NULL) RETURN 106

UPDATE dbo.aspnet_users WITH (ROWLOCK) SET LastActivityDate = @CurrentTimeUtc WHERE Userld = @Userld IF (@ @ROWCOUNT = O) -- Username not found RETURN DELETE FROM dbo.aspnet_personalizationperuser WHERE Pathld = @Pathld AND Userld = @Userld RETURN O ALTER PROCEDURE dbo.aspnet_personalizationperuser_setpagesettings ( @ApplicationName NVARCHAR(256), @UserName NVARCHAR(256), @Path NVARCHAR(256), @PageSettings IMAGE, @CurrentTimeUtc DATETIME) AS DECLARE @Applicationld UNIQUEIDENTIFIER DECLARE @Pathld UNIQUEIDENTIFIER DECLARE @Userld UNIQUEIDENTIFIER SELECT @ Applicationld = NULL SELECT @Pathld = NULL SELECT @Userld = NULL EXEC dbo.aspnet_applications_createapplication @ApplicationName, @Applicationld OUTPUT SELECT @Pathld = u.pathld FROM dbo.aspnet_paths u WHERE u.applicationld = @Applicationld AND u.loweredpath = LOWER(@Path) IF (@Pathld IS NULL) EXEC dbo.aspnet_paths_createpath @Applicationid, @Path, @Pathid OUTPUT SELECT @Userld = u.userld FROM dbo.aspnet_users u WHERE u.applicationld = @Applicationld AND u.loweredusername = LOWER(@UserName) IF (@Userld IS NULL) EXEC dbo.aspnet_users_createuser @Applicationld, @UserName, O, @CurrentTimeUtc, @Userld OUTPUT 107

UPDATE dbo.aspnet_users WITH (ROWLOCK) SET LastActivityDate = @CurrentTimeUtc WHERE Userld = @Userld IF (@@ROWCOUNT = O) -- Userrıame not found RETURN IF (EXISTS(SELECT Pathld FROM dbo.aspnet_personalizationperuser WHERE Userld = @Userld AND Pathld = @Pathld)) UPDATE dbo.aspnet_personalizationperuser SET PageSettings = @PageSettings, LastUpdatedDate = @CurrentTimeUtc WHERE Userld = @Userld AND Pathld = @Pathld ELSE INSERT INTO dbo.aspnet_personalizationperuser(userld, Pathld, PageSettings, LastUpdatedDate) VALUES (@Userld, @Pathld, @PageSettings, @CurrentTimeUtc) RETURN O ALTER PROCEDURE dbo.aspnet_profile_deletelnactiveprofiles @ApplicationN ame nvarchar(256), @ProfileAuthOptions int, @InactiveSinceDate datetime AS DECLARE @Applicationld uniqueiderıtifier SELECT @Applicationld = NULI, SELECT @Applicationld = Applicationld FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationld IS NULL) SELECT O RETURN DELETE FROM dbo.aspnet_profile WHERE User Id IN ( SELECT U serld FROM dbo.aspnet_users u WHERE Applicationld = @ Applicationld AND (LastActivityDate <= @InactiveSinceDate) 108

SELECT ) AND( (@ProfileAuthOptions = 2) OR (@ProfileAuthOptions = O AND IsAnonymous = 1) OR (@ProfileAuthOptions = 1 AND IsAnonymous = O) ) @@ROWCOUNT ALTER PROCEDURE dbo.aspnet_profile_deleteprofiles @ApplicationN ame nvarchar(256), @UserNames nvarchar(4000) AS DECLARE @UserName nvarchar(256) DECLARE @CurrentPos int DECLARE @NextPos int DECLARE @NumDeleted int DECLARE @DeletedUser int DECLARE @TranStarted bit DECLARE @ErrorCode int SET @ErrorCode = O SET @CurrentPos = 1 SET @NumDeleted = O SET @TranStarted = O IF( @@TRANCOUNT =O) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O WHILE (@CurrentPos <= LEN(@UserNames)) SELECT @NextPos = CHARINDEX(N',', @UserNames, @CurrentPos) 109

IF (@NextPos = O OR @NextPos IS NULL) SELECT @NextPos = LEN(@UserNames) + 1 SELECT @UserName = SUBSTRING(@UserNames, @CurrentPos, @NextPos - @CurrentPos) SELECT @CurrentPos = @NextPos+l IF (LEN(@UserName) > O) SELECT @DeletedUser = O EXEC dbo.aspnet_users_deleteuser @ApplicationName, @UserName, 4, @DeletedUser OUTPUT IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup IF (@DeletedUser <> O) SELECT @NumDeleted = @NumDeleted + 1 SELECT @NumDeleted IF (@TranStarted = 1) SET @TranStarted = O COMMIT TRANSACTION SET @TranStarted = O RETURN O Cleanup: IF (@TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTI@N RETURN @ErrorCode 5 - ALTER PROCEDURE dbo.aspnet_profile_ GetNumberOflnacti veprofiles 110

@ ApplicationN ame @ProfileAuthOptions @InactiveSinceDate AS nvarchar(256), int, datetime DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationid IS NULL) SELECT O RETURN SELECT COUNT(*) FROM dbo.aspnet_users u, dbo.aspnet_profile p WHERE Applicationid = @ Applicationid AND u.userld = p.userld AND (LastActivityDate <= @InactiveSinceDate) AND( (@ProfileAuthOptions = 2) OR (@ProfileAuthOptions = O AND IsAnonymous = 1) OR (@ProfileAuthOptions = 1 AND IsAnonymous = O) ) ALTER PROCEDURE dbo.aspnet_profile_getprofiles @ApplicationName nvarchar(256), @ProfileAuthOptions int, @Pagelndex int, @PageSize int, @UserNameToMatch nvarchar(256) = NULL, @InactiveSinceDate datetime = NULL AS DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationid IS NULL) 111

RETURN -- Set the page bounds DECLARE @PageLowerBound int DECLARE @PageUpperBound int DECLARE @TotalRecords int SET @PageLowerBound = @PageSize * @Pageindex SET @PageUpperBound = @PageSize - 1 + @PageLowerBound -- Create a temp table TO store the select results CREATE TABLE #PageindexForUsers ( lndexid int IDENTITY (O, 1) NOT NULL, Userld uniqueidentifier ) -- Insert into our temp table INSERT INTO #PageindexForUsers (Userld) SELECT u.userid FROM dbo.aspnet_users u, dbo.aspnet_profile P WHERE Applicationid = @ Applicationid AND u.userid = p.userid AND (@InactiveSinceDate IS NULL OR LastActivityDate <= @InactiveSinceDate) AND ( (@ProfileAuthOptions = 2) OR (@ProfileAuthOptions = O AND IsAnonymous = 1) OR (@ProfileAuthOptions = 1 AND IsAnonymous = O) ) AND (@UserNameToMatch IS NULL OR LoweredUserName LIKE LOWER(@UserNameToMatch)) ORDER BY UserName SELECT u.username, u.isanonymous, u.lastactivitydate, p.lastupdateddate, DATALENGTH(p.PropertyNames) + DATALENGTH(p.PropertyValuesString) + DATALENGTH(p.PropertyValuesBinary) FROM dbo.aspnet_users u, dbe.aspnet Profile p, #PageindexForUsers i WHERE u.userld = p.userld AND p.userid = i.userld AND i.indexid >= @PageLowerBound AND i.indexid <= @PageUpperBound SELECT COUNT(*) FROM #PageindexForUsers DROP TABLE #PageindexForUsers 112

7- ALTER PROCEDURE dbo.aspnet_profile_getproperties @ApplicationName nvarchar(256), @UserName nvarchar(256), @CurrentTimeUtc datetime AS DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM dbo.aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationid IS NULL) RETURN DECLARE @Userld uniqueidentifier SELECT @Userld = NULL SELECT @Userld = Userld FROM dbo.aspnet_users WHERE Applicationid = @Applicationid AND LoweredUserName = LOWER(@UserName) IF (@Userid IS NULL) RETURN SELECT TOP 1 PropertyNames, PropertyValuesString, PropertyValuesBinary FROM dbo.aspnet_profile WHERE Userid = @Userid IF (@@ROWCOUNT > O) UPDATE dbo.aspnet_users. LastActivityDate=@CurrentTimeUtc SET WHERE Userid = @Userid 113

ALTER PROCEDURE dbo.aspnet_profile_setproperties @ApplicationN ame nvarchar(256), @Property Names ntext, @PropertyValuesString ntext, @PropertyValuesBinary image, @UserName nvarchar(256), @IsUserAnonymous bit, @CurrentTimeUtc datetime AS DECLARE @Applicationld uniqueidentifier SELECT @Applicationld = NULL DECLARE @ErrorCode int SET @ErrorCode = O DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O EXEC dbo.aspnet_applications_ CreateApplication @ApplicationN ame, @Applicationld OUTPUT IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup DECLARE @Userld uniqueidentifier DECLARE @LastActivityDate datetime SELECT @Userld = NULL SELECT @LastActivityDate = @CurrentTimeUtc SELECT @Userld = Userld FROM dbo.aspnet_users WHERE Applicationld = @ Applicationld AND LoweredU sern ame = LOWER(@UserName) IF (@Userld IS NULL) EXEC dbo.aspnet_users_createuser @Applicationld, @UserName, @IsUserAnonymous, @LastActivityDate, @Userld OUTPUT 114

IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup UPDATE dbo.aspnet_users SET LastActivityDate=@CurrentTimeUtc WHERE Userid = @Userid IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup IF (EXISTS( SELECT * FROM dbo.aspnet_profile WHERE Userid = @Userid)) UPDATE dbo.aspnet_profile SET PropertyNames=@PropertyNames, PropertyValuesString = @Property ValuesString, PropertyValuesBinary = @PropertyValuesBinary, LastUpdatedDate=@CurrentTimeUtc WHERE Userid = @Userid ELSE INSERT INTO dbo.aspnet_profile(u serld, PropertyN ames, PropertyValuesString, PropertyValuesBinary, LastUpdatedDate) VALUES (@Userld, @PropertyNames, @PropertyValuesString, @PropertyValuesBinary, @CurrentTimeUtc) IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup IF( @TranStarted = 1 ) SET @TranStarted = O COMMIT TRANSACTION RETURN O Cleanup: IF( @TranStarted = 1 ) SET @TranStarted = O 115

ROLLBACK TRANSACTION RETURN @ErrorCode ALTER PROCEDURE [dbo].aspnet_registerschema Version @Feature nvarchar(l28), @CompatibleSchemaVersion nvarchar(128), @IsCurrentVersion bit, @RemovelncompatibleSchema bit AS IF( @RemoveincompatibleSchema = 1 ) DELETE FROM dbo.aspnet_schema Versions WHERE Feature = LOWER( @Feature) ELSE IF( @IsCurrentVersion = 1 ) UPDATE dbo.aspnet_schema Versions SET IsCurrentVersion = O WHERE Feature= LOWER( ~Feature) INSERT dbo.aspnet_schemaversionsı Feature, Compatible.SchemaVersion, IsCurrentVersion ) VALUES( LOWER( @Feature), @CompatibleSchemaVersion, @IsCurrentVersion ) 116

ALTER PROCEDURE dbo.aspnet_roles_ CreateRole @ApplicationN ame nvarchar(256), @RoleName nvarchar(256) AS DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL DECLARE @ErrorCode int SET @ErrorCode = O DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O EXEC dbo.aspnet_applications_ CreateApplication @ApplicationName, @Applicationid OUTPUT IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup IF (EXISTS(SELECT Roleid FROM dbo.aspnet_roles WHERE LoweredRoleName = LOWER(@RoleName) AND Applicationid = @Applicationid)) SET @ErrorCode = 1 GOTO Cleanup INSERT INTO dbo.aspnet_roles (Applicationid, RoleName, LoweredRoleName) VALUES (@Applicationid, @RoleN ame, LOWER(@RoleN ame)) IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup IF( @TranStarted = 1 ) 117

SET @TranStarted = O COMMIT TRANSACTION RETURN(O) Cleanup: IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION RETURN @ErrorCode ALTER PROCEDURE dbo.aspnet_roles_deleterole @ApplicationN ame nvarchar(256), @RoleName nvarchar(256), @DeleteOnlyifRoleisEmpty bit AS DECLARE @ Applicationid uniqueiderıtifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM aspnet_applications WHERE LOWER(@ ApplicationN ame) = Lowered.Applicationlv ame IF (@Applicationid IS NULL) RETURN(l) DECLARE @ErrorCode int SET @ErrorCode = O DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 118

ELSE SET @TranStarted = O DECLARE @Roleld uniqueidentifier SELECT @Roleld = NULL SELECT @Roleld = Roleld FROM dbo.aspnet_roles WHERE LoweredRoleName = LOWER( @RoleName) AND Applicationld = @ Applicationld IF (@Roleld IS NULL) SELECT @ErrorCode = 1 GOTO Cleanup IF (@DeleteOnlylfRolelsEmpty <> O) IF (EXISTS (SELECT Roleld FROM dbo.aspnet_userslnroles WHERE @Roleld = Roleid)) SELECT @ErrorCode = 2 GOTO Cleanup DELETE FROM dbo.aspnet_userslnroles WHERE @Roleid = Roleld IF( @@ERROR<> O) SET @ErrorCode = - 1 GOTO Cleanup DELETE FROM dbo.aspnet_roles WHERE @Roleld = Roleld AND Applicationid = @Applicationld IF( @@ERROR<> O) SET @ErrorCode = -1 GOTO Cleanup IF( @TranStarted = 1 ) SET @TranStarted = O COMMIT TRANSACTION RETURN(O) Cleanup: 119

IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION RETURN @ErrorCode ALTER PROCEDURE dbo.aspnet_roles_getallroles ( @ApplicationName nvarchar(256)) AS DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationid IS NULL) RETURN SELECT RoleName FROM dbo.aspnet_roles WHERE Applicationid = @Applicationid ORDER BY RoleName ALTER PROCEDURE dbo.aspnet_roles_roleexists @ApplicationName nvarchar(256), @RoleName nvarchar(256) AS DECLARE @Applicationid uniqueidentifier 120

SELECT @Applicationld = NULL SELECT @Applicationld = Applicationld FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationld IS NULL) RETURN(O) IF (EXISTS (SELECT RoleName FROM dbo.aspnet_roles WHERE LOWER(@RoleName) = LoweredRoleName AND Applicationld = @ Applicationld ) ) RETURN(l) ELSE RETURN(O) ALTER PROCEDURE [dbo].aspnet_setup_removeallrolemembers @name sysname AS CREATE TABLE #aspnet_rolemembers ( Group_name sysname, Group_id smallint, Users_in_group sysname, User_id smallint ) INSERT INTO #aspnet_rolemembers EXEC sp_helpuser @name DECLARE @user_id smallint DECLARE @cmd nvarchar(500) DECLARE cl cursor FORWARD_ONLY FOR SELECT User_id FROM #aspnet_rolemembers OPEN cl FETCH cl INTO @user_id WHILE (@ @fetch_status = O) SET @cmd = 'EXEC sp_droprolemember' +""+@name+'","'+ USER_NAME(@user_id) + 1111 EXEC (@cmd) FETCH cl INTO @user_id 121

CLOSE cl DEALLOCATE c 1 ALTER PROCEDURE [ dbo].aspnet_setup_restorepermissions @name sysname AS DECLARE @object sysname DECLARE @protecttype char(lü) DECLARE @action varchar(60) DECLARE @grantee sysname DECLARE @cmd nvarchar(500) DECLARE cl cursor FORW ARD_ONL Y FOR SELECT Object, ProtectType, [Action], Grantee FROM #aspnet_permissions where Object= @name OPEN cl FETCH cl INTO @object, @protecttype, @action, @grantee WHILE (@ @fetch_status = O) SET @cmd = @protecttype +''+@action+' on'+ @object+' TO['+ @grantee+']' EXEC (@cmd) FETCH cl INTO @object, @protecttype, @action, @grantee CLOSE cl DEALLOCATE c 1 122

ALTER PROCEDURE [dbo].aspnet_ UnRegisterSchema Version @Feature nvarchar(128), @CompatibleSchema Version nvarchar( 128) AS DELETE FROM dbo.aspnet_schema Versions WHERE Feature= LOWER(@Feature) AND @CompatibleSchemaVersion = CompatibleSchema Version ALTER PROCEDURE [dbo].aspnet_users_createuser @Applicationld uniqueidentifier, @UserName nvarchar(256), @IsUserAnonymous bit, @LastActivityDate DATETIME, @Userld uniqueidentifier OUTPUT AS IF( @Userld IS NULL ) SELECT @Userld = NEWID() ELSE IF( EXISTS( SELECT Userld FROM dbo.aspnet_users WHERE @Userld = Userld)) RETURN -1 INSERT dbo.aspnet_users (Applicationld, Userid, UserName, LoweredUserName, IsAnonymous, LastActivityDate) VALUES (@Applicationid, @Userld, @UserName, LOWER(@UserName), @IsUserAnonymous, @LastActivityDate) RETURN O 123

I I ALTER PROCEDURE [dbo].aspnet_users_deleteuser @ApplicationN ame nvarchar(256), @UserName nvarchar(256), @TablesToDeleteFrom int, @NumTablesDeletedFrom int OUTPUT AS DECLARE @Userld uniqueidentifier SELECT @Userid =NULL SELECT @NumTablesDeletedFrom = O DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O) TRANSACTION SET @TranStarted = 1 ELSE SET @TranStarted = O DECLARE @ErrorCode int DECLARE @RowCount int SET @ErrorCode = O SET @RowCount = O SELECT @Userld = u.userld FROM dbo.aspnet_users u, dbo.aspnet_applications a WHERE u.loweredusername = LOWER(@UserName) AND u.applicationld = a.applicationld AND LOWER(@ApplicationName) = a.loweredapplicationname IF ( @Userld IS NULL) GOTO Cleanup -- Delete from Membership table if (@TablcsToDe1eteFrom& l) is set IF ((@TablesToDeleteFrom & 1) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_MembershipUsers') AND (type= 'V')))) 124

DELETE FROM dbo.aspnet_membership WHERE @Userid = Userld t I SELECT @ErrorCode = @@ERROR, @RowCount = @@ROWCOUNT IF( @ErrorCode <> O ) GOTO Cleanup IF (@RowCount <> O) SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1 -- Delete from aspnet_usersinroles table if ( @TablesToDeleteFrom & 2) is set IF ((@TablesToDeleteFrom & 2) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name= N'vw_aspnet_UsersinRoles') AND (type= 'V')))) DELETE FROM dbo.aspnet_usersinroles WHERE @Userld = Userid SELECT @ErrorCode = @@ERROR, @RowCount = @@ROWCOUNT IF( @ErrorCode <> O ) GOTO Cleanup IF ( @RowCount <> O) SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1 -- Delete from aspnet Profile table if (@TablcsToDcictcFrom & 4) is set IF ((@TablesToDeleteFrom & 4) <> O AND (EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_Profiles') AND (type= 'V')))) DELETE FROM dbo.aspnet_prnfile WHERE @Userid = Userid SELECT @ErrorCodc = @@ERROR, @RowCount = @@ROWCOUNT IF( @ErrorCode <> O ) GOTO Cleanup IF (@RowCount <> O) SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1 -- Delete from aspnet_personalizationperuser table if (@TablesToDeleteFrom & 8) is set IF ((@TablesToDeleteFrom & 8) <> O AND 125

(EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_ WebPartState_User') AND (type= 'V')))) DELETE FROM dbo.aspnet_personalizationperuser WHERE @Userld = Userld ı I SELECT @ErrorCode = @@ERROR, @RowCount = @@ROWCOUNT IF( @ErrorCode <> O ) GOTO Cleanup IF ( @RowCount <> O) SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1 -- Delete from aspnetusers table if (@TablesToDelcteFrorn & 1,2,4 & 8) are all set IF ((@TablesToDeleteFrom & 1) <> O AND (@TablesToDeleteFrom & 2) <> O AND (@TablesToDeleteFrom & 4) <> O AND (@TablesToDeleteFrom & 8) <> O AND (EXISTS (SELECT Userld FROM dbo.aspnet_users WHERE @Userld = Userld))) DELETE FROM dbo.aspnet_users WHERE @Userld = Userld SELECT @ErrorCode = @@ERROR, @RowCount = @@ROWCOUNT IF( @ErrorCode <> O ) GOTO Cleanup IF (@RowCount <> O) SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1 IF( @TranStarted = 1 ) ~ SET @TranStarted = O COMMIT TRANSACTION RETURN O Cleanup: SET @NumTablesDeletedFrom = O IF( @TranStarted = 1 ) SET @TranStarted = O ROLLBACK TRANSACTION 126

RETURN @ErrorCode ALTER PROCEDURE dbo.aspnet_ UserslnRoles_AddU serstoroles @ApplicationName nvarchar(256), @UserNames nvarchar(4000), @RoleNames nvarchar(4000), @CurrentTimeUtc datetime AS DECLARE @Appld uniqueidentifier SELECT @Appld = NULL SELECT @Appld = Applicationld FROM aspnet_applications WHERE LOWER(@ ApplicationN ame) = LoweredApplicationN ame IF (@Appld IS NULL) RETURN(2) DECLARE @TranStarted bit SET @TranStarted = O IF( @@TRANCOUNT =O) TRANSACTION SET @TranStarted = 1 KEY) KEY) KEY) DECLARE @tbnames table(name nvarchar(256) NOT NULL PRIMARY ' DECLARE @tbrolestable(roleld uniqueidentifier NOT NULL PRIMARY DECLARE @tbuserstable(userld uniqueidentifier NOT NULL PRIMARY DECLARE DECLARE DECLARE DECLARE @Num @Pos @NextPos @Name int int int nvarchar(256) SET @Num=O SET @Pos= 1 127

WHILE(@Pos <= LEN(@RoleNames)) SELECT @NextPos = CHARINDEX(N',', @RoleNames, @Pos) IF (@NextPos = O OR @NextPos IS NULL) SELECT @NextPos = LEN(@RoleNames) + 1 SELECT @Name= RTRIM(LTRIM(SUBSTRING(@RoleNames, @Pos, @NextPos - @Pos))) SELECT @Pos= @NextPos+l INSERT INTO @tbnames VALUES (@Name) SET @Num = @Num + 1 INSERT INTO @tbroles SELECT Roleid FROM dbo.aspnet_roles ar, @tbnames t WHERE LOWER(t.Name) = ar.loweredrolename AND ar.applicationid = @Appid IF (@@ROWCOUNT <> @Num) SELECT TOP 1 Name FROM @tbnames WHERE LOWER(Name) NOT IN (SELECT ar.loweredrolename FROM dbo.aspnet_roles ar, @tbroles r WHERE r.roleld = ar.roleid) IF( @TranStarted = 1 ) ROLLBACK TRANSACTION RETURN(2) DELETE FROM @tbnames WHERE 1=1 SET @Num=O SET @Pos= 1 WHILE( @Pos <= LEN ( @UserN ames)) SELECT @NextPos = CHARINDEX(N',', @UserNames, @Pos) IF (@NextPos = O OR @NextPos IS NULL) SELECT @NextPos = LEN(@UserNames) + 1 SELECT @Name= RTRIM(LTRIM(SUBSTRING(@UserNames, @Pos, @NextPos - @Pos))) SELECT @Pos= @NextPos+l INSERT INTO @tbnames VALUES (@Name) SET @Num = @Num + 1 INSERT INTO @tbusers SELECT U serld FROM dbo.aspnet_users ar, @tbnames t 128

WHERE LOWER(t.Name) = ar.loweredusername AND ar.applicationid = @Appid IF (@@ROWCOUNT <> @Num) DELETE FROM @tbnames WHERE LOWER(Name) IN (SELECT LoweredUserName FROM dbo.aspnet_users au, @tbusers u WHERE au.userld = u.userid) INSERT dbo.aspnet_users (Applicationid, Userld, UserName, LoweredUserName, IsAnonymous, LastActivityDate) SELECT @Appid, NEWID(), Name, LOWER(Name), O, @CurrentTimeUtc FROM @tbnames INSERT INTO @tbusers SELECT Userld FROM dbo.aspnet_users au, @tbnames t WHERE LOWER(t.Name) = au.loweredusername AND au.applicationid = @Appid IF (EXISTS (SELECT* FROM dbo.aspnet_usersinroles ur, @tbusers tu, @tbroles tr WHERE tu.userid = ur.userld AND tr.roleid = ur.roleid)) SELECT TOP 1 UserName, RoleName FROM dbo.aspnet_usersinroles ur, @tbusers tu, @tbroles tr, aspnet_users u, aspnet_roles r WHERE u.userld = tu.userld AND r.roleid = tr.roleid AND tu.userid = ur.userid AND tr.roleid = ur.roleid IF( @TranStarted = 1 ) ROLLBACK TRANSACTION RETURN(3) INSERT INTO dbo.aspnet_usersinroles (Userld, Roleid) SELECT Userld, RoleId FROM @tbusers, @tbroles IF( @TranStarted = 1 ) COMMIT TRANSACTION RETURN(O) 129

ALTER PROCEDURE dbo.aspnet_ UserslnRoles_FindU serslnrole @ApplicationN ame nvarchar(256), @RoleName nvarchar(256), @UserN ametomatch nvarchar(256) AS DECLARE @Applicationld uniqueidentifier SELECT @ Applicationld = NULL SELECT @Applicationld = Applicationld FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationld IS NULL) RETURN(l) DECLARE @Roleld uniqueidentifier SELECT @Roleld = NULL SELECT @Roleld = Roleld FROM dbo.aspnet_roles WHERE LOWER(@RoleName) = LoweredRoleName AND Applicationld = @ Applicationld IF (@Roleld IS NULL) RETURN(l) SELECT u.username FROM dbo.aspnet_users u, dbo.aspnet_userslnroles ur WHERE u.userld = ur.userld AND @Roleld = ur.roleld AND u.applicationld = @Applicationld AND LoweredUserName LIKE LOWER(@UserNameToMatch) ORDER BY u.username RETURN(O) 51 ~ ALTER PROCEDURE dbo.aspnet_userslnroles_getrolesforuser @ApplicationName nvarchar(256), @UserName nvarchar(256) AS 130

DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM aspnet_applications WHERE LOWER(@ ApplicationN ame) = LoweredApplicationN ame IF (@Applicationid IS NULL) RETURN(l) DECLARE @Userid uniqueidentifier SELECT @Userld = NULL SELECT FROM @Userld = Userld dbo.aspnet_users WHERE LoweredUserName = LOWER(@UserName) AND Applicationid = @ Applicationid IF ( @Userld IS NULL) RETURN(l) SELECT r.rolen ame FROM dbo.aspnet_roles r, dbo.aspnet_usersinroles ur WHERE r.roleid = ur.roleid AND r.applicationid = @ Applicationid AND ur.userid = @Userld ORDER BY r.rolename RETURN (O) ALTER PROCEDURE dbo.aspnet_ UsersinRoles_ GetU sersinroles @ApplicationName nvarchar(256), @RoleName nvarchar(256) AS DECLARE @Applicationid uniqueidentifier SELECT @ Applicationid = NULL SELECT @Applicationid = Applicationid FROM aspnet_applications LOWER(@ApplicationN ame) = LoweredApplicationN ame WHERE IF (@Applicationld IS NULL) RETURN(l) DECLARE @Roleid uniqueidentifier SELECT @Roleid = NULL SELECT @Roleid = Roleid 131

FROM dbo.aspnet_roles WHERE LOWER(@RoleName) = LoweredRoleName AND Applicationld = @Applicationld IF (@Roleld IS NULL) RETURN(!) SELECT u.username FROM dbo.aspnet_users u, dbo.aspnet_userslnroles ur WHERE u.userld = ur.userld AND @Roleld = ur.roleld AND u.applicationld = @ Applicationld ORDER BY u.username RETURN(O) ALTER PROCEDURE dbo.aspnet_userslnroles_isuserlnrole @ApplicationName nvarchar(256), @UserName nvarchar(256), @RoleName nvarchar(256) AS DECLARE @Applicationld uniqueidentifier SELECT @ Applicationld = NULL SELECT @Applicationld = Applicationld FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Applicationld IS NULL) I!' RETURN(2) DECLARE @Userld uniqueidentifier SELECT @Userld = NULL DECLARE @Roleld uniqueidentifier SELECT @Roleld = NULL SELECT @Userld = Userld FROM dbo.aspnet_users WHERE LoweredUserName = LOWER(@UserName) AND Applicationld = @ Applicationld IF ( @Userld IS NULL) RETURN(2) SELECT @Roleld = Roleld 132

FROM dbo.aspnet_roles WHERE LoweredRoleName = LOWER(@RoleName) AND Applicationid = @ Applicationid IF (@Roleid IS NULL) RETURN(3) IF (EXISTS( SELECT* FROM dbo.aspnet_usersinroles WHERE Userld = @Userld AND Roleid = @Roleid)) RETURN(l) ELSE RETURN(O) ALTER PROCEDURE dbo.aspnet_userslnroles_removeusersfromroles @ApplicationName nvarchar(256), @UserNames nvarchar(4000), @RoleNames nvarchar(4000) AS DECLARE @Appid uniqueidentifier SELECT @Appid = NULL SELECT @Appid = Applicationid FROM aspnet_applications WHERE LOWER(@ApplicationName) = LoweredApplicationName IF (@Appid IS NULL) RETURN(2) DECLARE @TranStarted bit SET @TranStarted = O IF( @ @TRANCOUNT = O ) TRANSACTION SET @TranStarted = 1 KEY) KEY) DECLARE @tbnames table(name nvarchar(256) NOT NULL PRIMARY DECLARE @tbroles table(roleid uniqueidentifier NOT NULL PRIMARY 133

KEY) DECLARE @tbusers table(userld uniqueidentifier NOT NULL PRIMARY DECLARE @Num int DECLARE @Pos int DECLARE @NextPos int DECLARE @Name nvarchar(256) DECLARE @CountAll int DECLARE @CountU int DECLARE @CountR int SET @Num=O SET @Pos= 1 WHILE( @Pos <= LEN ( @RoleN ames)) SELECT @NextPos = CHARINDEX(N',', @RoleNames, @Pos) IF (@NextPos = O OR @NextPos IS NULL) SELECT @NextPos = LEN(@RoleNames) + 1 SELECT @Name= RTRIM(LTRIM(SUBSTRING(@RoleNames, @Pos, @NextPos - @Pos))) SELECT @Pos= @NextPos+l INSERT INTO @tbnames VALUES (@Name) SET @Num = @Num + 1 INSERT INTO @tbroles SELECT Roleid FROM dbo.aspnet_roles ar, @tbnames t WHERE LOWER(t.Name) = ar.loweredrolename AND ar.applicationid = @Appid SELECT @CountR = @@ROWCOUNT IF (@CountR <> @Num) SELECT TOP 1 N4', Name FROM @tbnames WHERE LOWER(Name) NOT IN (SELECT ar.loweredrolename FROM dbo.aspnet_roles ar, @tbroles r WHERE r.roleld = ar.roleid) IF( @TranStarted = 1 ) ROLLBACK TRANSACTION RETURN(2) DELETE FROM @tbnames WHERE 1=1 SET@Num=O SET @Pos= 1 134

WHILE(@Pos <= LEN ( @UserN ames)) SELECT @NextPos = CHARINDEX(N',', @UserNames, @Pos) IF (@NextPos = O OR @NextPos IS NULL) SELECT @NextPos = LEN(@UserNames) + 1 SELECT @Name= RTRIM(LTRIM(SUBSTRING(@UserNames, @Pos, @NextPos - @Pos))) SELECT @Pos= @NextPos+l INSERT INTO @tbnames VALUES (@Name) SET @Num= @Num+ 1 INSERT INTO @tbusers SELECT Userid FROM dbo.aspnet_users ar, @tbnames t WHERE LOWER(t.Name) = ar.loweredusername AND ar.applicationid = @Appid SELECT @CountU = @@ROWCOUNT IF (@CountU <> @Num) SELECT TOP 1 Name, N" FROM @tbnames WHERE LOWER(Name) NOT IN (SELECT au.loweredusername FROM dbo.aspnet_users au, @tbusers u WHERE u.userld = au.userld) IF( @TranStarted = 1 ) ROLLBACK TRANSACTION RETURN(l) SELECT @CountAll = COUNT(*) FROMdbo.aspnet_UsersinRoles ur, @tbusers u, @tbroles r WHERE ur.userld = u.userid AND ur.roleid = r.roleid IF (@CountAll <> @CountU * @CountR) SELECT TOP 1 UserName, RoleName FROM @tbusers tu, @tbroles tr, dbo.aspnet_users u, dbo.aspnet_roles r WHERE u.userld = tu.userld AND r.roleid = tr.roleid AND tu.userld NOT IN (SELECT ur.userld FROM dbo.aspnet_usersinroles ur WHERE ur.roleid = tr.roleid) AND tr.roleid NOT IN (SELECT ur.roleid FROM dbo.aspnet_usersinroles ur WHERE ur.userld = tu.userld) IF( @TranStarted = 1 ) ROLLBACK TRANSACTION RETURN(3) 135

DELETE FROM dbo.aspnet_usersinroles WHERE Userld IN (SELECT Userld FROM @tbusers) AND Roleid IN (SELECT Roleid FROM @tbroles) IF( @TranStarted = 1 ) COMMIT TRANSACTION RETURN(O) 55~ ALTER PROCEDURE dbo.aspnet_webevent_logevent @Eventld char(32), @EventTimeUtc datetime, @EventTime datetime, @EventType nvarchar(256), @EventSequence decimal(l 9,0), @EventOccurrence decimal(l9,0), @EventCode int, @EventDetailCode int, @Message nvarchar(1024), @ApplicationPath nvarchar(256), @ApplicationVirtualPath nvarchar(256), @MachineName nvarchar(256), @RequestUrl nvarchar(l024), @ExceptionType nvarchar(256), @Details ntext AS INSERT dbo.aspnet_webevent_events ( Eventld, EventTimeUtc, EventTime, EventType, EventSequence, EventOccurrence, EventCode, EventDetailCode, Message, ApplicationPath, ApplicationVirtualPath, 136

MachineN ame, RequestUrl, Exception Type, Details ) VALUES ( @Eventld, @EventTimeUtc, @EventTime, @EventType, @EventSequence, @Eventüccurrence, @EventCode, @EventDetailCode, @Message, @ApplicationPath, @ Application VirtualPath, @MachineN ame, @RequestUrl, @Exception Type, @Details ) 137

CHAPTER 9 : TEN TERMS l m You Even if this book were 3,000 pages long, it still wouldn't be long enough to cover everything there is to know about Visual Web Developer, HTML, CSS, ASP.NET, and programming. You'll often need to refer to online resources or books for more information. Given that Visual Web Developer is a tool for software developers, you'll have to get accustomed to terminology that developers use. This chapter presents the top ten terms that everyone will assume you already know and understand. Familiar computer terms can change when they venture onto the World Wide Web. For instance, you may already know application as a program such as a word processor or spreadsheet, but the term Web application basically means a Web site or Web page that contains more than just static, uncharıging HTML and text that looks the same to all visitors. A Web application is more dynamic than that; the page's exact content is created just before the page is sent. Exactly what the visitor sees depends on who that visitor is, or the specific information the user requested. There are two main types of computer users in the world, those who use ' software, and those who create software. The people who create software are called developers. Everyone else is called a user. It's a lot easier to be a user than a developer. As a user, you can often figure out how to do things just by guessing and hacking away until you get it right. Not so for a developer. You have to actually know how the technology works - as well as what you're doing with it - to create software. Guessing and hacking away at 138

random generally leads to nothing but endless hours of hair-pulling frustration. A data-driven Web site consists of Web pages whose content depends upon ("is driven by") the data stored in a database. For example, when you search the Internet with a search engine such as Google, you're basically sending a query string to Google's database. What you get back is a dynamic page created in response to your query; exactly what appears on it depends on what you searched for. The page's specific content is "driven" (determined) by what's in Google's database that matches what you searched for. 5 - ASP stands for Active Server Pages, and is Microsoft's fundamental technology for building dynamic, data-driven Web sites. As with all technologies, ASP has evolved over the years to become ever more powerful and easy to use. As I write this book, ASP.NET 2.0 is the latest version of ASP. It's also the version of ASP used by Visual Web Developer to create dynamic data-driven Web sites. To publish a site you created with Visual Web Developer, you must find a hosting provider that supports ASP.NET 2.0. Visual Studio is Microsoft's main software-development tool. It has all kinds of functionality for creating all kinds of programs. It's big, complex, and easy to get lost in because Visual Studio provides a seemingly-endless array of tools and options. Even so, Visual Web Developer is (believe it or not) a greatly uncomplicated version of Visual Studio; it focuses on developing one type of application: dynamic, data-driven Web sites. In effect, Visual Web Developer just "hides" 139

the parts of Visual Studio that aren't relevant to developing Web applications. IDE acronym stands for Integrated Development Environment. Both Visual Studio and Visual Web Developer are IDEs. They're called integrated because they give you access to all the various tools and technologies you need to get the job done. To create data-driven Web sites, for example, you need a pretty specific list of things: HTML, CSS, ASP.NET, a data source (such as SQL Server), and at least one programming language (such as C#). An IDE like Visual Web developer brings all those technologies together under one roof, so to speak, so you can get all your work done in one program window. (What a concept.) You've seen a similar (but unrelated) term before: In hard drives, IDE stands for Integrated Device Electronics. But that concept is in no way related to software development. In hard drives, it just means that all the electronics the disk needs to operate are contained within the drive' s case... When used as a noun within the context of programming, the term control refers to things in a program, or on a page, that allow users to control the action. For example, open any Windows dialog box and you see a bunch of text boxes, drop-down menus, check boxes, and buttons. All of these are relatively small, simple controls. In a more general sense, a control can be anything on the page that a user interacts with. In Visual Web Developer's Toolbox, each item actually represents a control that you can drag and drop onto a page. As a developer, you 140

choose which controls users will see, and can program what happens when a user interacts with a control. Code is the text that forms the instructions for the computer, written in some programming language such as C# or Visual Basic. It has a different function from text that's typed in a human language. Unlike regular text, code uses no sentences or paragraphs. Instead, code consists of statements (lines) written in the programming language rather than in a human language. When you write in (say) English, you can get away with murder in terms of spelling and punctuation; even if the text would make your composition teacher cry, your human recipient will probably still be able to figure out what you mean - simply by studying the context of the message. (If you've spent any time in online forums, you've no doubt seen the extent to which people can get away with worse-than-iffy spelling and punctuation.) When you write code, there is no such margin for error. Every character of every word counts; if it isn't just so, you'll likely get an error message rather than code that works. Unlike a human being who can figure out (at least) the intent of some dreadfully composed written message, a computer can't "figure out" diddley squat. You either write the code correctly and it works, or you write it incorrectly and it doesn't work. There are two ways to interact with controls. One way is manual: You actually use the finished control yourself. For example, when you click a button in a Windows dialog box, you are manually operating the control with your mouse and keyboard. As a programmer, you can also write code to specify the exact appearance 141

and behavior of a control, as well as what happens after a user interacts with the control. That sort of code is generally executed in response to some event, as when the user clicks a button or makes a selection from a dropdown menu. In essence, a user who is viewing a page and makes a selection from the options provided is manually using the control. But exactly what happens after the user makes a selection is generally handled programmatically - the control runs some code you' ve written, and that code tells the machine exactly what to do. 1 ' The term database is often used casually to refer to any body of knowledge or collection of information. In programming terms, it's more specific - referring to data that's organized into tables that consist of columns and rows so it can be stored and accessed consistently. The database for a Web site is made available through the Database Explorer tab in Visual Web Developer, as shown in Figure 13-2. A database management system (DBMS) is a program that allows you to organize data into tables, and retrieve data programmatically. Microsoft Access and SQL Server are examples of database-management systems. Microsoft Access is a self-contained DBMS; it contains all the tools you need to create tables, queries, forms, reports, and other aspects of an application - in one program. Server isn't so much an application as it is a server - a single-minded program obsessed with serving up data. Unlike an application program, which has its own program window, a server works behind the scenes; it has no particular interface or program window of its own. Instead, the server just 142

"serves up" data to some external application - such as (for a convenient example) a dynamic data-driven Web site you create in Visual Web Developer 143

CHAPER 10: TEN ALTERNATIVES TO BEING HELPLESS Visual Web Developer brings together all the technologies you need to create dynamic, data-driven Web sites. Those technologies include HTML, CSS, ASP.NET, C#, the.net Framework, and SQL Server- each and every one of which is an enormous topic in itself. (For example, the first printed documentation for the.net Framework alone consisted of over 8,000 pages, bound into several volumes.) To deal with such a gigantic body of knowledge, you must find ways to get exactly the information you need, when you need it. Sending desperate "PLEASE HELP!!!!" messages generally won't cut it. You have to be more resourceful - and know where the people you're asking are getting their information, so you can go get that information too. The sites listed in this chapter get you in the ballpark. Of course, Web sites being what they are, some of the URLs listed here may change between now and the time you actually read this. That's why I keep an up-to-date list of links on www.coolnerds.com/vwdjust in case any change occurs. If you have any problems finding a page, try looking there. Developer The Microsoft Developer Network at http://msdn.microsoft.com is home to all Microsoft software-development tools and technologies. This is where the hardcore computer geeks go to get information about Microsoft developer products. 144

-HTML All Web pages are formatted using HyperText Markup Language (HTML). The W3C (Word Wide Web Consortium) is the "official" site for all things HTML (including that useful new mutant, XHTML). To go straight to documentation on HTML or XHTML, use the link www.w3.org/markup/. Cascading Style Sheets (CSS) are a must if you intend to give your Web site a consistent look and feel. They're even more indispensable if you intend to use themes, because every theme includes some CSS. The home page for CSS is at www.w3.org/style/css/. XML Home Page XML (extensible Markup Language) is a standardized means of transmitting raw data across the Internet via the Word Wide Web. (By "raw" I mean unformatted, like the data in a database - useful even if it isn't pretty to look at.) Whether your site needs (or can even use) XML depends on many factors. In Visual Web Developer, you may be able to get by with little or no XML at all - that depends on your site. If you do need XML info, the official site at www.w3.org/xml/ contains all the specs. I' ASP.NET If I was forced to pin down my choice for the main technology behind Visual Web Developer, ASP.NET 2.0 would be the one I'd choose. Although there are plenty of Web sites that address this topic, the most "official" would have to be the one whose URL is also the easiest in the world to remember: http://asp.net. ASP.NET Starter Kits Clicking the Starter Kits tab at the ASP.NET Web site takes you to a page of 145

sample Web applications that you can download for free. There are different kinds of Starter Kits for different types of Web sites. If you have a particular type of site in mind, but don't quite know how to organize things, a Starter Kit could be a great way to get started. The ASP.NET Forums at http://forums.asp.net give you a handy place to go for questions and answers. There are a lot of discussions to choose from. You may have to scroll down to find Visual Web Developer and related discussions. You can discover a lot about what the technology can do just by reading through some of the questions and answers that have already been posted. The subtitle to this Web page, "Enabling a world of data-driven applications," is what SQL Server is all about. In a Visual Web Developer site, SQL Server contains all the data that drives the Web site. As I write this, the URL for SQL Server 2005 is http://msdn.microsoft.com/sql/2005. If that doesn't work, try the more general URL http://msdn.microsoft.com/sql. The Microsoft.NET Framework is a huge collection of pre-written software ' that most modern programmers use to create modern programs. In fact, all the Using statements you see at the top of a code-behind page in VWD are references to namespaces within the.net Framework. Each namespace is like a folder containing usable code organized into classes. The dotnetjunkies site (at www.dotnetjunkies.com) is a place for people who are into the whole.net way of doing things. Though it spans the whole 146

of.net Framework development tools, there's always info on ASP.NET 2.0 and Visual Web Developer. This site encompasses all of Microsoft's software-development tools - and discusses them in blogs, technical chats, newsgroups, webcasts, communities, user groups, and forums. There are all sorts of ways to interact with other people who use the same tools you're using. The URL for this site is www.microsoft.com/communities. 147

CONCLUSION We are in the 21century and the time is short, business is expanding jobs are much likely to be done with the least time and power resources. The technology out of all is the web which is burning the mid night out in this fast world. To sum up I have being using such a fast and brilliant technology of web and internet facilities to get the best out of it. The most vital factor considered while building this project was the dynamic Driven, simply not just being awesome but being proficient in the task. Security is one the basic and very much to be faced out in the whole cyber world every single day. To get sorted out in a fabulous way I used GUI the high level security identification system... 148

REFERENCES [1] Alan Simpson, Visual Web Developer 2005 Express Edition Publishing : WROX 2005 [2] David Sussman Alex Hommer, ASP.NET Visual Web Developer 2005 Express Edition STARTER KIT Publishing WROX 2005 [3] A guide for writing asp codes retrived from the world wide web http://www.asp.net ASP FORUMS [4]Tutorials for writing asp and c# retrieved from world wide web http://www.w3schools.com/asp/default.asp TUTORIAL OF ASP [5] Tutotials and code examples retrieved from world wide web http://www.aspfree.com ALL ABOUT ASP 149