Tuesday, December 13, 2011

MSDN Blog TFS 2005 Undoing a checkout that belongs to another user


MSDN Blogs > TFS Version Control and more .. > 
Undoing a checkout that belongs to another user
mrod 8 Jan 2007 1:04 PM 6
Since we shipped, we have gotten a lot of questions but there is one that keeps reappearing and I thought to write a short blog post so we can reference it in future discussions.
The question is- How do I undo someone else’s pending changes?
The scenario vary greatly but here are the top ones
  • I need to undo a pending change because I need to check-in and someone has it exclusively checked out
  • I just need to undo the checkout lock on the file and not the actual change itself
  • I need to undo all the changes in a workspace because the person has left the company or the group

Unfortunately, we do not support this from the GUI but you can achieve your goal from the command line. Assuming you are an administrator the command that you have to use is:
tf undo /workspace:OtherUserWorkspace;OtherUser  $/Project/ItemName.cs /s:http://yourtfsserver:8080
For the other scenarios I think I will borrow content from one of jmanning blog
1)      As an admin, you have the UnlockOther permission to all items in the version control repository.  This means that you can undo anyone else's locks on any item.  The command-line for that would be something like: tf lock /lock:none $/whatever/item/goes/here/web.config. The lock command is covered @ http://msdn2.microsoft.com/library/47b0c7w9(en-US,VS.80).aspx​
2) As admin, you also have the global version control permission AdminWorkspaces - this gives you the simpler and cleaner approach that you can just delete that user's workspace (you don't have to do it from his machine).  That will take with it any pending changes, any locks, etc. that the workspace was holding.  The command is just:  tf workspace /delete hisworkspace;DOMAIN\hisuser - the workspace command is covered at http://msdn2.microsoft.com/library/y901w7se(en-US,VS.80).aspx
Since the user has moved on to another company, team or project, deleting his workspace is likely the better answer. In addition, you do not have to manually undo that checkout lock (or worry about that user potentially having other locks held in that workspace).
-mario

Monday, May 30, 2011

Application Engineer

Application Engineer via IT Wiki The Application Engineer (also known as an Application Developer) defines the:
  • application solutions that meet Customer requirements,
  • physical software design from the detailed application requirements.
Contents
  1. Responsibilities
  2. Key Role Interactions
  3. Professional Skills
  4. Interpersonal Skills
Responsibilities
The main responsibilities of the Application Engineer are to:
  • Identify, define, and model the application requirements,
  • Define data structures and distribution to satisfy the application solution,
  • Define application solutions that meet Customer requirements,
  • Act as the main project team liaison between the Customer Representatives,
  • Prepare deliverables to support the development and deployment of the solution such as application guides and test plans,
  • Provide continuity during the transition from one stage to the next,
  • Define physical program units and data structures based on the logical model to satisfy the requirements of the application,
  • Prepare deployment and post deployment plans to support the conversion and deployment of the solution,
  • Design and build prototypes. On a RAD project, the Application Engineer builds the Rapid Prototype, which becomes the application system.
Key Role Interactions
The Application Engineer has key interactions with the following roles. These interactions are guidelines only and do not reflect all possible project organizations.
  • Application Architect. Develops application solutions to meet the business needs.
  • Data Architect. Develops an Information Architecture to meet the business needs.
  • Technical Architect. Obtains guidance and support on the implementation of specific technologies.
  • Team Leader. Reports on the status of assigned tasks and estimates and raises problems and concerns for resolution. Raises scope issues for resolution.
  • Human Factors Analyst. Reviews screen, report, and dialogue design and provides feedback.
  • Developers. Provide orientation on the application solution, explains processing requirements, data requirements, and program unit processing, and walks through program unit test plans.
  • Customer Representatives. Define application requirements, demonstrates application solutions, provides training, and guides testing activities.
  • Quality Assurance Manager. Presents deliverables for quality control inspections.
Professional Skills
Ability to:
  • perform the activities and tasks for which this role is responsible,
  • apply the techniques necessary to complete the responsibilities of this role,
  • use the tools required by these activities, tasks and techniques.
Experience:
  • with the selected System Development Environment, including the specific development tools sets, on at least one other project or work assignment,
  • in the application area on at least one other project or work assignment,
  • in defining requirements and conceptualizing solutions on a number of other projects or work assignments.
Interpersonal Skills
All team members require a high level of:
  • Personal Attributes,
  • General Business Skills.
Related White Papers, Webcasts and Content:
  • The 2010 Application Delivery Handbook
  • Empowering the "Business Developer:" Accentuate the Positives and Eliminate the Negatives of Businessperson-Developed Applications
  • Avoid These 7 Fatal Flaws When Choosing Your ERP Solution
  • Rapid Application Development (RAD) Critical Success Factors (Blogs)
  • Application_Architect (Wiki)
  • Architect job advertisements (Groups)
  • Designing an Application Solution for SQL Server 2005 (Training)
  • Industry Overview: Information Technology (Training)
  • Developing Applications that Use SQL Server Support Services (Training)

Tuesday, March 15, 2011

Mod Check 11 CPU too high

I put together a VB.NET function to create a mod 11 check digit. The code is in no way unique to any individual or scenario. Anyone can find hundreds of variations in any basic example book, bulletin board or web site.
The function is inefficient; it uses too much CPU for too long to be useful in the “real world”.
What is done wrong or in a way that can be improved and still function on a 32-bit OS such as Windows XP Sp3, Vista and/or 7?

    ''' <summary>
    ''' Mod Check 11 pegging CPU too high
    ''' </summary>
    ''' <param name="controlNumber">base Account Number i.e. 000345</param>
    ''' <param name="divisor">11</param>
    ''' <param name="weights">137</param>
    ''' <returns>account number i.e. 0003456</returns>
    ''' <remarks>The basics are standard create and attach a check digit to an "base Account"</remarks>
    Public Shared Function CalculateMOD(ByVal controlNumber As String, ByVal divisor As Int32, ByVal weights As Int64) As String
        ' Get Weights Char Array
        Dim validWeights() As Char = weights.ToString.ToCharArray()
        Dim formulaValidWeights As String = New String(validWeights)
        Dim sum As Int32 = 0
        Dim checkDigit As String = String.Empty
        ''Set the weight beginning=2.  
        Dim weightindex As Int32 = 0
        Dim baseAccount() As Char = controlNumber.ToCharArray()
        ' Reverse baseAccount Char Array order
        Array.Reverse(baseAccount)
        ' controlNumberArray - baseAccount Char Array reversed
        Dim controlNumberArray As String = New String(baseAccount)
        For controlNumberIndex As Int32 = 0 To controlNumberArray.Length - 1
            ''sets the weight count to loop from 0 up to weight length.  
            If (weightindex > validWeights.Length - 1) Then
                ''resets weightcount to 0 again.  
                weightindex = 0
            End If
            sum += Convert.ToInt32(controlNumberArray.Substring(controlNumberIndex, 1), CultureInfo.InvariantCulture) * Convert.ToInt32(formulaValidWeights.Substring(weightindex, 1))
            weightindex += 1
        Next
        Dim remainder As Int32 = sum Mod divisor
        Select Case remainder
            Case 0
                checkDigit = Convert.ToString(0, CultureInfo.InvariantCulture)
            Case 1
                checkDigit = "-"
            Case Else
                checkDigit = Convert.ToString((divisor - remainder), CultureInfo.InvariantCulture)
        End Select
        controlNumber = controlNumber + checkDigit
        Return controlNumber
    End Function

Tuesday, February 22, 2011

.NET Runtime version 2.0.50727.3615 - Fatal Execution Engine Error (7A0360B0) (80131506)

Phil's fairly useful blog, Monday, 11 January 2010, Visual Studio 2008 crash using Reporting Services 2008 charts
http://phil-austin.blogspot.com/2010/01/visual-studio-2008-crash-using.html
Seems relevant to my recent .NET Framework crashing issues

In my case Visual Studio 2008 SP1 silently and completely aborts when loading an up until now working Solution (SQL SERVER 2008 SP1, .NET 3.5 SP1, VSTS 2008 Developer, VSTS 2008 Database, TeamExplorer 2008, TFS 2005)
Initially, I crated a blank solution, imported the projects, overwrote the existing solution, bound back to TFS and checked in.
This process seemed to have fixed the issue for a few days, then the crashes started again.

Something new to the environment - SQL SERVER 2008 R2 Express
So we'll strip that out, rebuild the SQL SERVER 2008 Development Ed with Service Packs, SP the VS editions and attempt to move forward.

Even though I'm trying to strip an SQL Server 2008 R2 Express Edition, I found this blog helpful http://sqlblog.com/blogs/aaron_bertrand/archive/2010/10/25/fun-with-software-uninstalling-sql-server-2008-r2-evaluation-edition.aspx
Why?
Because internally the SQL Server 2008 R2 Express Edition is reporting itself to be an Expired Evaluation Edition?
I was required to strip out all 10.5x instances of SQL SERVER 2008 objects, tools, shared components.
Run VS2008 SP1
Run SQL SERVER 2008 Development Ed – added edit existing instances
Run SQL SERVER 2008 SP2

Wednesday, July 28, 2010

Converting string value of an Enum entry to a valid instance of the Enum

"How do I convert a string value of an Enum entry to a valid instance of the Enum?"

C#

String [VariableName] = "StringValue";

[EnumType] [VariableName1] = ([EnumType])Enum.Parse(typeof([EnumType]),[VariableName]);

Example:

String ListSortDirectionString = "Ascending";

System.ComponentModel.ListSortDirection ListSortDirectionEnum = (System.ComponentModel.ListSortDirection)Enum.Parse(typeof(System.ComponentModel.ListSortDirection), ListSortDirectionString);

VB.NET (Option explicit ON, Option strict ON)

DIM [VariableName] AS String = "StringValue";

DIM [VariableName1] AS [EnumType] = CType(Enum.Parse(GetType([EnumType]), [VariableName], True), [EnumType])

Example:

Dim ListSortDirectionString As String = "Ascending"

Dim ListSortDirectionEnum As System.ComponentModel.ListSortDirection = CType([Enum].Parse(GetType(System.ComponentModel.ListSortDirection), ListSortDirectionString, True), System.ComponentModel.ListSortDirection)

Tuesday, March 30, 2010

Visual Studio - hexadecimal editor

I have a project that parses large text files from one third-party source into a bunch of small text files for another third-party printer interface.
Using Regular Expression and Hexadecimal File Editors have been a base necessity.
For example, almost none of the newer print systems use a Form Feed - character code 12 in decimal (0xC in hexadecimal) - Chr(12) -Regular Expression \f - Hexadecimal View 0C
Of course, the third-party printer interface in this scenario required the Form Feed be kept in position.

Nearly every six months, like this week, another alteration is asked for and I find myself back in the code.



Due to the infrequency of use, I find it difficult to keep the details of Regular Expression syntax in my head so I use Expresso from Ultrapico (http://www.ultrapico.com/) which does an excellent job of translating what I want into a .NET Framework Language code snippet.

For my project development I use Visual Studio 2008 SP1 which has as much of a hexadecimal editor "Binary Editor" as I need.

=============================
Visual Studio - hexadecimal editor

Go to File -> Open -> file

Select the file that you want to open, the Open button state will change to enable

Click the small drop down list at the right of the Open button and select Open With

You will get a list of additional editors, choose Binary Editor

http://francoisbeaussier.blogspot.com/2007/04/visual-studio-has-also-hexadecimal.html

Friday, March 26, 2010

Puzzle Eye

I started a puzzle long ago. I was given a block of pieces fit together forming an eye looking at me. “This piece goes just like this,” the elder said as he left me to finish the rest.

The puzzle was large and complex.

Taking my time I found other parts that that fitted together making small understandable blocks, but none fit with the eye. Over time I pieced together a border many small blocks which I had worked out fit into place within the boarder, but not the eye… Surely it would go in this space here, my reason would argue against my experience.

The eye did not fit; more of the puzzle came together; the eye did not fit…

Perhaps I have made an assumption I am not aware of… What do I know?

I know, what I know may be wrong… I carefully dismantled the eye and tested each piece.

Over and over they only came together again as an eye starting at me…

More of the puzzle came together, but as always, the eye did not fit…

Take a break; walk away; come back and try again;

More of the puzzle came together; maybe the eye was not a part of this puzzle…

But then why was it here, given and left staring at me?

Or was that an assumption too?

Then I laughed; I laughed until I was short of breath and tears stained my checks.

Oh, what Joy!

Oh, what a fool I am.

I turned the eye completely round and dropped it into place.

Wednesday, March 17, 2010

Cameelious hump Poem

Just So Stories For Little Children
By Rudyard Kipling
Published 1915
How the camel got his hump
epilogue Pg 29

The Camel’s hump is an ugly lump
     Which well you may see at the Zoo,
But uglier yet is the hump we get
     From having too little to do.

Kiddies and grown-ups too-oo-oo,
If we have n’t enough to do-oo-oo,
     We get the hump - - -
     Cameelious hump - - -
The hum that is black and blue!

We climb out of bed with a frouzly head
     And a snarly-yarly voice.
We shiver and scowl and we grunt and we growl
     At our bath and our boots and our toys;

And there ought to be a corner for me
(And I know there is one for you)
     When we get the hump - - -
     Cameelious hump - - -
The hump that is black and blue!

The cure for this ill is not to sit still,
     Or frowst with a book by the fire;
But to take a large hoe and a shovel also,
     And dig till you gently perspire.

And then you will find that the sun and the wind
And the Djinn of the Garden too,
     Have lifted the hump - - -
     The horrible hump - - -
That hump that is black and blue!

I get it as well as you-oo-oo - - -
If I have n’t enough to do-oo-oo - - -
     We all get hump - - -
     Cameelious hump - - -
Kiddies and grown ups too.

Monday, February 15, 2010

Learning Oracle Data Provider for .NET

On “Using System.Data.OracleClient”
As of June 2009 Microsoft announced its deprecation of System.Data.OracleClient, also known as Microsoft OracleClient.
Choosing to use it instead of learning how to professionally and effectively utilize ODP.NET (Oracle Data Provider for .NET) is a dead end road.
Start with ODP.NET for Microsoft OracleClient Developers; keep learning, keep refactoring; make the best product you can with the resources you are allotted.
I personally feel there is still a lot to learn on my own path of ASP.NET and Oracle development. It certainly isn't a line of development I originally planned on.
Of course, running Oracle on windows isn't a lot of fun, but it is manageable if you keep up with all the small tweaks that are needed for the two to play nice together.

Friday, November 06, 2009

ASP.NET Silverlight 3 Web Service integration DRAFT


Development Environment

Dell Laptop

.Net Framework 3.5 SP1

Visual Studio.Net 2008 SP1 (Team System Developer, Tester, Database)

Silverlight 3.0

Fiddler 2

SQL Server Management Studio 2008 SP1

Alpha/Dev Web Server

Windows Server 2003 Standard Edition SP2

           
IIS v 6.0

Alpha/Dev SQL Server 2005 - databases (2) are 2000 compatible library

Existing Production Application

“Transcript Currier”

ASP.NET 2.0 (VB) Web Application

           
SQL Server 2000

The existing system:

User Type: Customer

1.     
"Login" Page - customer logs in

2.     
"Jobs List" Page - customer chooses a job or creates a
new one

3.     
"Customer Upload" page

a.      
Fill out the basic job information

b.     
Identify the number of transcripts within the job
(GridView Control)


                                                  
i.     
Transcript Header (auto-generated <JobNumber>An)


                                                
ii.     
Case Number, Description, Copies (user input)

c.      
Pick a transcript header (dropdown control) and
associate a file (file upload control) - 10 static control sets

d.     
Process the Job (click button control)


                                                  
i.     
validation run

1.     
required fields

2.     
valid business dates

3.     
check file type (usually audio)


                                                
ii.     
moves the files to File Server via virtual directory on
Web Server IIS Site


                                               
iii.     
compresses files into a <project code directory>/<job
number directory>\<job number>.zip file


                                              
iv.     
processes the job details in database posting compressed
file path for transcriptionists to pick up work

The desire is to modify the existing application to

1.     
replace 10 static control sets with one control set
(transcription header dropdown and file picker)

2.     
allow the user to select multiple files from various
location

3.     
present a list of properly associated files <job number>
<transcript header> and <files>

4.     
 compress files or
take a compressed file <job number>.zip {<transcript header directory>\<fiels>}

5.     
transfer compressed file to the File Server via virtual
directory on Web Server IIS site (as is done now)

The Silverlight User Control as I have it outlined now is a replacement for the
static dropdown/file upload control set and contains a ComboBox, a filepicker,
two textblocks, and a button.


·       
ComboBox – select the transcript header
aka CaseFileName


·       
FilePicker – choose the file(s) from your machine
(may be done repeatedly)


·       
TextBlock1 – display the files picked


·       
TextBlock2 – display the files existing/selected
for the transcript


·       
Button – Upload the files

In the current outlined work flow, when the user is done they’ll process the job
details

I’ve got four issues when I actually tie the tools together at this moment.

  1. Silverlight ComboBox does not populate
  2. Silverlight intermittently spits up
    cross-domain policy soap errors
  3. Silverlight upload file(s) – splits file(s) into small
    packages and moves to the file server – appears to be spawning multiple threads
    resulting in file write conflict errors
  4. The UI looks atrociously worse than it did before – which is
    saying a lot.

So as always, I’ve decoupled the scenarios to try to get to the base issues.

  1. Silverlight ComboBox does not populate

http://10.1.251.62/ys2005web/TestSilverlightControl1.aspx

http://10.1.251.62/ys2005web/SlC1WebService.asmx

SlC1WebService




Click here for a complete list of operations.

GetTranscriptHeaderRecords


Test


The test form is only available for requests from the local machine.

SOAP 1.1

The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.


POST /ys2005web/SlC1WebService.asmx HTTP/1.1
Host: 10.1.251.62
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://10.1.251.62/ys2005web/GetTranscriptHeaderRecords"
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetTranscriptHeaderRecords xmlns="http://10.1.251.62/ys2005web/">
      <jobNumber>int</jobNumber>
    </GetTranscriptHeaderRecords>
  </soap:Body>
</soap:Envelope>

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetTranscriptHeaderRecordsResponse xmlns="http://10.1.251.62/ys2005web/">
      <GetTranscriptHeaderRecordsResult>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
      </GetTranscriptHeaderRecordsResult>
    </GetTranscriptHeaderRecordsResponse>
  </soap:Body>
</soap:Envelope>



SOAP 1.2

The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /ys2005web/SlC1WebService.asmx HTTP/1.1
Host: 10.1.251.62
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetTranscriptHeaderRecords xmlns="http://10.1.251.62/ys2005web/">
      <jobNumber>int</jobNumber>
    </GetTranscriptHeaderRecords>
  </soap12:Body>
</soap12:Envelope>

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetTranscriptHeaderRecordsResponse xmlns="http://10.1.251.62/ys2005web/">
      <GetTranscriptHeaderRecordsResult>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
      </GetTranscriptHeaderRecordsResult>
    </GetTranscriptHeaderRecordsResponse>
  </soap12:Body>
</soap12:Envelope>



B. The Silverlight Control


Imports

System.Diagnostics


Imports

System.Windows.Browser


Partial

Public Class
SilverlightControl1


   
Inherits UserControl


   
Public Sub
New()


       
InitializeComponent()


   
End Sub


   
Public Sub
New(ByVal
JobNumber As String)


       
InitializeComponent()


       
cboTranscriptHeader_Load(JobNumber)


   
End Sub


   
'
-------------------------------------------------------------------------------------


#Region

"** event handling"


   
Protected Sub
cboTranscriptHeader_ItemSelected( _


       
ByVal sender As
Object, _


       
ByVal e As
SelectionChangedEventArgs) Handles
cboTranscriptHeader.SelectionChanged


       
Debug.Assert(sender IsNot
Nothing, "sender is
null."
)


       
Debug.Assert(e IsNot
Nothing
, "e is null.")


       
If cboTranscriptHeader.SelectedItem
Is Nothing
Then


           
Return


       
End If


       
'Note: "Transcript Header Id"
(WebDumper.dbo.CustomerUploadFiles.CaseFileName)


       
Dim TranscriptHeader As
String =
Convert.ToString(cboTranscriptHeader.SelectedItem)


       
'ToDo: Code required when a Transcript Header Id is
selected


       
'   A
specific Customer Job have one Job Header Record (DB: WebDumper TBL:
CustomerUploadHeader)


       
'  
Each Customer Job has one or more Transcript Header Records (DB: WebDumper TBL:
CustomerUploadFiles)


       
'  
Each set of uploaded files should reside in a direcory named after the
Transcript Header Id


       
'  
All the Transcript Header Id Directories should be complessed into a single file
named by the "Job Number" 


       
'  
Direcory Structure:


       
'      
"Project Code" (dir)


       
'      
-->  "Job Number" (dir)


       
'      
-->  -->  "Job Number".ZIP (compressed file)


       
'      
-->  -->
 --> 
"Transcript Header Id" (dir)


       
'      
-->  -->  --> 
-->  *.* (audio and text
files)


   
End Sub


   
Public Function
BuildAbsoluteUri(ByVal relativeUri
As String)
As Uri


       
' Get current absolute Uri; this depends on where the
app is deployed


       
Dim uri1 As Uri
= System.Windows.Browser.HtmlPage.Document.DocumentUri


       
Dim uriString As
String = uri1.AbsoluteUri


       
' Replace page name with relative service Uri


       
Dim ls As Int32
= uriString.LastIndexOf("/"c)


       
uriString = uriString.Substring(0, ls + 1) + relativeUri


       
' Return new Uri


       
Return New
Uri(uriString, UriKind.Absolute)


   
End Function


   
Private _jobNumber As
Nullable(Of Integer)


   
Public Property
jobNumber() As Nullable(Of Integer)


        Get


           
Return _jobNumber


       
End Get


       
Set(ByVal value
As Nullable(Of
Integer))


           
_jobNumber = value


       
End Set


   
End Property


   
Private Sub
MainPage_Loaded(ByVal sender
As Object,
ByVal e As
System.Windows.RoutedEventArgs) Handles
Me.Loaded


       
Debug.Assert(sender IsNot
Nothing, "sender is
null."
)


       
Debug.Assert(e IsNot
Nothing
, "e is null.")


       
HtmlPage.RegisterScriptableObject("SilverlightComponentOne",
Me)


       
'' 
Scriptable Member accessible by JavaScript/Ajax and Silverlight interface


       
''  
loadtranscriptheaderdropdownlist(jobNumber)


   
End Sub


    <ScriptableMember()> _


   
Sub cboTranscriptHeader_Load(ByVal jobnumber As
String)


       
'ToDo: A cleaner way to go from String to Nullable
Integer?


       
Dim _value As
Integer


       
If Integer.TryParse(jobnumber,
_value) Then


           
_jobNumber = _value


       
Else


           
_jobNumber = Nothing


       
End If


       
Dim ws As
SilverlightApplicationUploader.SLC1WebService.SlC1WebServiceSoapClient = _


          
New
SilverlightApplicationUploader.SLC1WebService.SlC1WebServiceSoapClient()


       
Dim request As
New
SLC1WebService.GetTranscriptHeaderRecordsRequest(Me.jobNumber)


       
AddHandler
ws.GetTranscriptHeaderRecordsCompleted, AddressOf
ws_GetTranscriptHeaderRecords


       
ws.GetTranscriptHeaderRecordsAsync(request)


   
End Sub


   
Private Sub
ws_GetTranscriptHeaderRecords(ByVal sender
As Object, _


       
ByVal e As
SLC1WebService.GetTranscriptHeaderRecordsCompletedEventArgs)


       
Me.cboTranscriptHeader.Items.Clear()


       
For Each record
As
SilverlightApplicationUploader.SLC1WebService.vwTranscriptHeaderRecords
In e.Result.GetTranscriptHeaderRecordsResult


           
Me.cboTranscriptHeader.Items.Add(record.Filename)


       
Next


   
End Sub


#End

Region '"** event
handling"


   
''
-------------------------------------------------------------------------------------


End

Class

C. The client config


<?
xml
version="1.0"
encoding="utf-8" ?>


<
configuration>


  <
system.serviceModel>


    <
bindings>


      <
basicHttpBinding>


       
<
binding

name="SlC1WebServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"


           

receiveTimeout="00:10:00"
sendTimeout="00:01:00"


           

maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"


           

textEncoding="utf-8" >


         
<
security

mode="None"/>


       
</
binding>


      </
basicHttpBinding>


    </
bindings>


    <
client>


      <
endpoint

address="http://localhost:2443/SlC1WebService.asmx"


         

binding="basicHttpBinding"
bindingConfiguration="SlC1WebServiceSoap"


           

contract="SLC1WebService.SlC1WebServiceSoap" name="SlC1WebServiceSoap" />


    </
client>


  </
system.serviceModel>


</
configuration>

D. The Silverlight Control xaml


<
UserControl x:Class="SilverlightApplicationUploader.SilverlightControl1"


  
 xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


  
 xmlns
:x="http://schemas.microsoft.com/winfx/2006/xaml"


           
 xmlns:data="clr-namespace:SilverlightApplicationUploader.SLC1WebService"


  
 Width
="400" Height="300">

   
<UserControl.Resources>

       


<
Style x:Key="ControlBorder"
TargetType
="Border">

           


<
Setter Property="BorderThickness"
Value
="3" />

           


<
Setter Property="Background"
Value
="#FFC2F5CB" />

           


<
Setter Property="BorderBrush"
Value
="#FF257004" />

           


<
Setter Property="CornerRadius"
Value
="6" />

           


<
Setter Property="Margin"
Value
="5" />

           


<
Setter Property="Padding"
Value
="5" />

       


</
Style>

       


<
Style x:Key="ControlTitle"
TargetType
="TextBlock">

           


<
Setter Property="FontSize"
Value
="14" />

           


<
Setter Property="HorizontalAlignment"
Value
="Center" />

           


<
Setter Property="FontFamily"
Value
="Courier New" />

           


<
Setter Property="FontWeight"
Value
="Bold" />

           


<
Setter Property="Foreground"
Value
="#FF1F6900" />

       


</
Style>

   
</UserControl.Resources>

   
<Grid x:Name="LayoutRoot"
Background
="White">

       


<
ScrollViewer>

           


<
StackPanel x:Name="_mainPanel"
Margin
="6" >

               


<
Border Style="{StaticResource ControlBorder}">

                   


<
StackPanel>

                       


<
TextBlock x:Name="DisplayTranscriptHeader"
Text
="TranscriptHeader" Style="{StaticResource ControlTitle}" />

                        <StackPanel Orientation="Horizontal"
Height
="50">

                           


<
ComboBox x:Name="cboTranscriptHeader"
Width
="80" Height="30"


                                    
 VerticalAlignment="Top" Margin="5"


                      
              
 SelectionChanged="cboTranscriptHeader_ItemSelected"


                                    
 ItemsSource="{Binding Mode=OneWay}" >

                               


<
ComboBoxItem Content="CaseFileNumber" />

                           


</
ComboBox>

                       


</
StackPanel>

                   


</
StackPanel>

               


</
Border>

           


</
StackPanel>

       


</
ScrollViewer>

   
</Grid>


</
UserControl>

E. The Application Class


Partial

Public Class App


   
Inherits Application


    public
Sub New()


       
InitializeComponent()


   
End Sub


   
Private Sub
Application_Startup(ByVal o
As Object,
ByVal e As
StartupEventArgs) Handles
Me.Startup


       
Dim JobNumber As
String = e.InitParams("JobNumber")


       
Me.RootVisual = New
SilverlightControl1(JobNumber)


   
End Sub


   
Private Sub
Application_Exit(ByVal o
As Object,
ByVal e As
EventArgs) Handles Me.Exit


   
End Sub


   
Private Sub
Application_UnhandledException(ByVal sender
As object,
ByVal e As
ApplicationUnhandledExceptionEventArgs) Handles
Me.UnhandledException


       
' If the app is running outside of the debugger then
report the exception using


       
' the browser's exception mechanism. On IE this will
display it a yellow alert


       
' icon in the status bar and Firefox will display a
script error.


       
If Not
System.Diagnostics.Debugger.IsAttached Then


           
' NOTE: This will allow the application to
continue running after an exception has been thrown


           
' but not handled.


        
   
' For production applications this error
handling should be replaced with something that will


           
' report the error to the website and stop the
application.


           
e.Handled = True


           
Deployment.Current.Dispatcher.BeginInvoke(New
Action(Of
ApplicationUnhandledExceptionEventArgs)(AddressOf
ReportErrorToDOM), e)


       
End If


   
End Sub


  
Private
Sub ReportErrorToDOM(ByVal e As
ApplicationUnhandledExceptionEventArgs)


       
Try


           
Dim errorMsg As
String = e.ExceptionObject.Message +
e.ExceptionObject.StackTrace


           
errorMsg = errorMsg.Replace(""""c,
"'"c).Replace(ChrW(13) & ChrW(10), "\n")


           
System.Windows.Browser.HtmlPage.Window.Eval("throw
new Error(""Unhandled Error in Silverlight Application "
+ errorMsg +
""");")


       
Catch


       
End Try


   
End Sub


End

Class

F. The Application xaml


<
Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


           
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"


           
 x:Class="SilverlightApplicationUploader.App"


           
 >

   
<Application.Resources>

       

   
</Application.Resources>


</
Application>

G. The client access policy


<?
xml
version="1.0"
encoding="utf-8" ?>


<
access-policy>


  <
cross-domain-access>


    <
policy>


      <
allow-from

http-request-headers="*">


       
<!--
/*Specify
request headers like Content-Type,SOAPAction*/
-->


       
<
domain

uri="*"/>


      </
allow-from>


      <
grant-to>


       
<
resource

include-subpaths="true"
path="/"/>


      </
grant-to>


    </
policy>


  </
cross-domain-access>

</access-policy>

 

H. The cross domain policy


<?
xml
version="1.0"
encoding="utf-8" ?>


<
cross-domain-policy>


  <
allow-http-request-headers-from

domain="*" headers="*"/>

</cross-domain-policy>

I. The Web Service


<System.Web.Services.WebService(Namespace:="http://localhost:2443/")>
_


<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_


<ToolboxItem(False)> _


Public

Class SlC1WebService


   
Inherits System.Web.Services.WebService


    <WebMethod()> _


    
Public Function
GetTranscriptHeaderRecords(ByVal jobNumber
As Global.System.Nullable(Of Integer))
As List(Of
vwTranscriptHeaderRecords)


       
'ToDo: Call this method from SL passing JobNumber and
Retreiving list of transcriptHeaders

 


       
Dim transcriptHeaders
As
New List(Of
vwTranscriptHeaderRecords)


 


       
Dim de As
New StenoMainEntities


 
       
' Execute the query and get the
ObjectQueryResult.


       
Dim TranscriptHeaderRecordsResult
As Objects.ObjectResult(Of vwTranscriptHeaderRecords) =
de.GetTranscriptHeaderRecords(jobNumber)


       
' Iterate through the collection of Product items.


       
Dim result As
vwTranscriptHeaderRecords


       
For Each result
In TranscriptHeaderRecordsResult


           
transcriptHeaders.Add(result)


       
Next


       
Return transcriptHeaders

   
End Function


End

Class


 
'''
<summary>

''' Parameter class

'''
</summary>


Public

Class Parameter


   
Private _Key As
String


   
Public Property
Key() As String


       
Get


           
Return _Key


       
End Get


       
Set(ByVal value
As String)


           
_Key = value


       
End Set


   
End Property


   
Private _Value As
String


   
Public Property
Value() As String


       
Get


           
Return _Value


       
End Get


       
Set(ByVal value
As String)


           
_Value = value


       
End Set


   
End Property


End

Class

 A direct call of the data transcript function works - - - 


Public

Partial Class
TestGetTranscriptHeader


   
Inherits System.Web.UI.Page


   
Protected Sub
Page_Load(ByVal sender
As
Object, ByVal
e As System.EventArgs)
Handles
Me.Load


       
Dim jobNumber As
Nullable(Of Integer)
= 520124


       
Dim transcriptHeaders
As
New List(Of
vwTranscriptHeaderRecords)


       
Dim de As
New DBEntities


       
' Execute the query and get the ObjectQueryResult.


       
Dim TranscriptHeaderRecordsResult
As Objects.ObjectResult(Of vwTranscriptHeaderRecords) =
de.GetTranscriptHeaderRecords(jobNumber)


       
' Iterate through the collection of Product items.


       
Dim result As
vwTranscriptHeaderRecords


       
For Each result
In TranscriptHeaderRecordsResult


           
transcriptHeaders.Add(result)


       
Next


       
Response.Write("Results" & vbCrLf)


       
For Each result
In transcriptHeaders


           
Response.Write("-" & result.JobNumber
& ", " & result.Filename & vbCrLf)


       
Next


   
End Sub

End Class