So been a bit isnce i posted, have been working on a lot of legacy system stuff, so nothing interesting. However I am finally back to learning new technologies and thought i would make that the subject of this blog.
 
 
Code: asp.net
	- Imports System.Web.Services
- Imports System.Web.Services.Protocols
- Imports System.ComponentModel
- Imports Oracle.DataAccess.Client
- ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
- <System.Web.Script.Services.ScriptService()> _
- <System.Web.Services.WebService(Namespace:="http://canfor.ca/")>_
- <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
- <ToolboxItem(False)> _
- Public Class session    
- Inherits System.Web.Services.WebService    
- ''' <summary>    
- ''' This sets the session variable for the application and user listed below.    
- ''' </summary>    
- ''' <param name="varValue">This is the value for the session variable</param>    
- ''' <param name="UserID">The Users UserID</param>    
- ''' <param name="appid">The application ID as listed in the APPLICATION Table</param>    
- ''' <param name="varName">What is the session variable name</param>    
- ''' <remarks></remarks>    
- <WebMethod()> _
-     Public Sub SetSessionVar(ByVal varValue As String, ByVal UserID As String, ByVal appid As Integer, ByVal varName As String)        
- Dim conn As New OracleConnection(ConfigurationManager.ConnectionStrings("WEB_APPS_DEV").ConnectionString)       Dim comm As New OracleCommand        
- Dim strSQL As String        
- strSQL = "PKG_SESSION_UTIL.SET_SESSION_VAR"
-         comm.CommandText = strSQL
-         comm.Connection = conn
-         comm.CommandType = CommandType.StoredProcedure
-         comm.Parameters.Add(New OracleParameter("p_userid", UserID))
-         comm.Parameters.Add(New OracleParameter("p_applid", appid))
-         comm.Parameters.Add(New OracleParameter("p_sessionvar", varName))
-         comm.Parameters.Add(New OracleParameter("p_varvalue", varValue))
-         conn.Open()
-         comm.ExecuteNonQuery()
-         conn.Close()
-     End Sub
- End Class
 
Code: sql
	- CREATE OR REPLACE PACKAGE PKG_SESSION_UTIL AS
-    PROCEDURE SET_SESSION_VAR (p_userid       IN VARCHAR2
-                              ,p_applid       IN NUMBER
-                              ,p_sessionvar      VARCHAR2
-                              ,p_varvalue        VARCHAR2);
- END PKG_SESSION_UTIL;
- CREATE OR REPLACE PACKAGE BODY PKG_SESSION_UTIL 
- AS
-    PROCEDURE SET_SESSION_VAR (p_userid       IN VARCHAR2
-                              ,p_applid       IN NUMBER
-                              ,p_sessionvar      VARCHAR2
-                              ,p_varvalue        VARCHAR2)   AS
-       TYPE aarr_session IS TABLE OF WEB_SESSION%ROWTYPE;
-       v_session   aarr_session;
-    BEGIN
-       SELECT *
-         BULK COLLECT INTO v_session
-         FROM WEB_SESSION
-        WHERE USERID = p_userid AND applid = p_applid AND sessionvar = p_sessionvar;
-       IF v_session.COUNT > 0
-       THEN
-          UPDATE WEB_SESSION
-             SET varvalue = p_varvalue
-           WHERE USERID = p_userid AND applid = p_applid AND sessionvar = p_sessionvar;
-       ELSE
-          INSERT INTO WEB_SESSION (userid
-                                  ,applid
-                                  ,sessionvar
-                                  ,varvalue)
-               VALUES (p_userid
-                      ,p_applid
-                      ,p_sessionvar
-                      ,p_varvalue);
-       END IF;
-    END;
- END;
 
Code: html
	- <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WoodlandsList.aspx.vb" Inherits="WIM.WoodlandsWebApps.WoodlandsList" %>
- <!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/1999/xhtml">
- <head runat="server">
-     <title></title>
-     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.js" type="text/javascript"></script>
-     <%If False Then%>
-         <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5-vsdoc.js" type="text/javascript"></script>
-     <%End If%>
-     <script type="text/javascript">
-         function doStuff() {
-             $('#OpName').slideUp(1000, function () {
-                 $('#drpOperations').fadeIn(1000);
-             });
-         }
-         $(document).ready(function () {
-             $('#OpName').text($('#drpOperations option:selected').text());
-             $('#drpOperations').hide();
-             $('#drpOperations').change(function () {
-                 var newVal = $('#drpOperations option:selected').text();
-                 var ajaxData = "{ 'varValue' : '" + newVal + "' , ";
-                 ajaxData += "'UserID' : '" + $('#hdnUser').val() + "' ,";
-                 ajaxData += "'appid' : '" + $('#hdnAppId').val() + "' ,";
-                 ajaxData += "'varName' : 'WebOperId' }";
-                 $.ajax({ 
-                    type: "POST",
-                     url: "/Services/session.asmx/SetSessionVar",
-                     data: ajaxData ,
-                     contentType: "application/json; charset=utf-8",
-                     dataType: "json"
-                 });
-                 $('#drpOperations').slideUp(1000, function () {
-                     $('#OpName').text(newVal);
-                     $('#OpName').fadeIn(1000);
-                 });
-             });
-         });
-     </script>
-     <style type="text/css">
-         #OpName
-         {
-             font-weight:bold;
-             color:Maroon;
-         }
-         .OpBreadCrumb
-         {
-             float:right;
-             font-family:Arial;
-             font-size:11pt;
-             border:1px solid red;
-             vertical-align:middle;
-             padding-top:10px;
-             margin:0px;
-         }
-     </style>
-     </head>
- <body>
-     <form id="form1" runat="server">
-     <div class="OpBreadCrumb">
-     <asp:HiddenField ID="hdnUser" runat="server" />
-     <asp:HiddenField ID="hdnAppId" runat="server" />
-         Current Operation <span id="OpName" onclick="javascript:doStuff()">Prince George</span>
-     <asp:DropDownList runat="server" ID="drpOperations">    </asp:DropDownList>
-     </div>
-     <asp:Button ID="poster" runat="server" Text="PostBack" />
-     <asp:Label ID="lblMessage" runat="server"></asp:Label>
-     </form>
- </body>
- </html>
 
Code: asp.net
	- Imports Oracle.DataAccess.ClientPublic 
- Class WoodlandsList
-     Inherits System.Web.UI.Page
-     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-         If Not IsPostBack Then
-             Dim dsOps As DataSet = CType(Cache.Get("HIPRDS_OPS"), DataSet)
-             Dim strSql As String
-             If dsOps Is Nothing Then
-                 strSql = " SELECT OPER_NAME, opap.APP_OPER_CODE "
-                 strSql &= "  FROM OPERATION op INNER JOIN OPERATION_APPL opap ON OP.OPER_ID = OPAP.OPER_ID "
-                 strSql &= " WHERE OPAP.APP_ID = 141 "
-                 Dim conn As New OracleConnection( _ ConfigurationManager.ConnectionStrings("WEB_APPS_DEV").ConnectionString)
-                 Dim adap As New OracleDataAdapter(strSql, conn)
-                 dsOps = New DataSet()                adap.Fill(dsOps)
-                 drpOperations.DataSource = dsOps
-                 drpOperations.DataTextField = "OPER_NAME"
-                 drpOperations.DataValueField = "APP_OPER_CODE"
-                 drpOperations.DataBind()
-                 Cache.Insert("HIPRDS_OPS", dsOps)
-             Else
-                 drpOperations.DataSource = dsOps
-                 drpOperations.DataTextField = "OPER_NAME"
-                 drpOperations.DataValueField = "APP_OPER_CODE"
-                 drpOperations.DataBind()
-             End If
-         End If
-         hdnUser.Value = Context.User.Identity.Name.Split("\")(1)        hdnAppId.Value = 141    End Sub
- End Class