<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DataBatrix &#187; .NET 3.5</title>
	<atom:link href="http://www.databatrix.com/tag/net-3-5/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.databatrix.com</link>
	<description>The workings of Eric Bridges</description>
	<lastBuildDate>Thu, 01 Dec 2011 23:47:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>.NET Serialization: Binary, SOAP, and XML (VB)</title>
		<link>http://www.databatrix.com/2009/10/net-serialization-binary-soap-and-xml-vb/</link>
		<comments>http://www.databatrix.com/2009/10/net-serialization-binary-soap-and-xml-vb/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 23:43:50 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[.NET 2.0]]></category>
		<category><![CDATA[.NET 3.5]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Binary]]></category>
		<category><![CDATA[Serialization]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.databatrix.com/?p=227</guid>
		<description><![CDATA[In .NET when you need to shrink an object into a more portable format you have 3 choices.  Binary, SOAP, or XML.  The process of shrinking and expanding the object is called serialization and deserialization.  Each option has it&#8217;s own advantages which I will explain. Binary You can serialize an object into binary format quite [...]]]></description>
			<content:encoded><![CDATA[<p>In .NET when you need to shrink an object into a more portable format you have 3 choices.  Binary, SOAP, or XML.  The process of shrinking and expanding the object is called serialization and deserialization.  Each option has it&#8217;s own advantages which I will explain.</p>
<h2>Binary</h2>
<p>You can serialize an object into binary format quite easily using the .NET Framework.  This is the quickest and smallest way to serialize; however, the binary format can only be deserialized using the same .NET Framework.  This may be a problem for interoperability.  It must be noted that this format will serialize Public and Private members (unlike XML serialization).</p>
<p>The example below shows how to serialize an object called &#8220;newCustomer&#8221;:</p>
<pre class="brush:vb">        Dim newCustomer As Contact = GetSampleContact()

        Using fs As New IO.FileStream(filePathandName &amp; ".bin", IO.FileMode.Create)
            Dim binFormatter As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
            binFormatter.Serialize(fs, newCustomer)
        End Using</pre>
<p>And here is the reverse to deserialize:</p>
<pre class="brush:vb">        Dim readCustomer As Contact

        Using fs As New IO.FileStream(filePathandName &amp; ".bin", IO.FileMode.Open, IO.FileAccess.Read)
            Dim binFormatter As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
            readCustomer = CType(binFormatter.Deserialize(fs), Contact)
        End Using</pre>
<h2>SOAP</h2>
<p>SOAP is another method.  This is similar to the binary method except the serialized data is stored in a standardized form (SOAP) which will easily allow interoperability.  Public and Private members are serialized using this method as well.<br />
To serialize:</p>
<pre class="brush:vb">        Dim newCustomer As Contact = GetSampleContact()
        Using fs As New IO.FileStream(filePathandName &amp; "SOAP.xml", IO.FileMode.Create)
            Dim soapFormattter As New Runtime.Serialization.Formatters.Soap.SoapFormatter()
            soapFormattter.Serialize(fs, newCustomer)
        End Using</pre>
<p>And to deserialize:</p>
<pre class="brush:vb">        Dim readCustomer As Contact
        Using fs As New IO.FileStream(filePathandName &amp; "SOAP.xml", IO.FileMode.Open, IO.FileAccess.Read)
            Dim soapFormattter As New Runtime.Serialization.Formatters.Soap.SoapFormatter()
            readCustomer = CType(soapFormattter.Deserialize(fs), Contact)
        End Using</pre>
<h2>XML</h2>
<p>A third choice is using the XMLSerializer class.  This method will only serialize Public properties and members and the object must be marked with the Serializable attribute and contain an empty constructor.  This method of serialization will be smaller in size than the SOAP method since less information is serialized.  Here is an example of such class:</p>
<pre class="brush:vb">     &lt;Serializable()&gt; Class Contact

        Private _FirstName As String
        Public Property FirstName() As String
            Get
                Return _FirstName
            End Get
            Set(ByVal value As String)
                _FirstName = value
            End Set
        End Property

        Private _LastName As String
        Public Property LastName() As String
            Get
                Return _LastName
            End Get
            Set(ByVal value As String)
                _LastName = value
            End Set
        End Property

        Private _MiddleI As String
        Public Property MiddleI() As String
            Get
                Return _MiddleI
            End Get
            Set(ByVal value As String)
                _MiddleI = value
            End Set
        End Property

        Private _PIN As String
        Public WriteOnly Property PIN() As String
            Set(ByVal value As String)
                _PIN = value
            End Set
        End Property

        Sub New()

        End Sub

        Sub New(ByVal fName As String, ByVal middleI As String, ByVal lName As String, ByVal p As String)
            _FirstName = fName
            _MiddleI = middleI
            _LastName = lName
            _PIN = p
        End Sub
    End Class</pre>
<p>Here is how you would serialize using the XMLSerializer:</p>
<pre class="brush:vb">        Dim newCustomer As Contact = GetSampleContact()
        Using fs As New IO.FileStream(filePathandName &amp; ".xml", IO.FileMode.Create)
            Dim xmlFormatter As New Xml.Serialization.XmlSerializer(GetType(Contact))
            xmlFormatter.Serialize(fs, newCustomer)
        End Using</pre>
<p>And to deserialize:</p>
<pre class="brush:vb">        Dim readCustomer As Contact
        Using fs As New IO.FileStream(filePathandName &amp; ".xml", IO.FileMode.Open, IO.FileAccess.Read)
            Dim xmlFormatter As New Xml.Serialization.XmlSerializer(GetType(Contact))
            readCustomer = CType(xmlFormatter.Deserialize(fs), Contact)
        End Using</pre>
<p><img class="alignnone size-full wp-image-232" title="Serialization Demo" src="http://www.databatrix.com/wp-content/uploads/2009/10/Serialization.JPG" alt="Serialization Demo" width="505" height="336" /></p>
<p>You can download a sample serialization demo project that I created to demonstrate: <a title="Serialization Demo Project.zip" href="http://www.databatrix.com/wp-content/uploads/2009/10/SerializationDemo.zip">SerializationDemoProject.zip</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databatrix.com/2009/10/net-serialization-binary-soap-and-xml-vb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E-manage Mobile Portal</title>
		<link>http://www.databatrix.com/2009/08/e-manage-mobile-portal/</link>
		<comments>http://www.databatrix.com/2009/08/e-manage-mobile-portal/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 15:17:46 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[.NET 3.5]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MS SQL]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.databatrix.com/2009/08/e-manage-mobile-portal/</guid>
		<description><![CDATA[Background: E-manage is a business management application.  It is capable of managing customer databases (CRM) as well as projects, invoices, purchase orders, and inventory to name a few.  The e-manage client application runs on a users desktop and uses Microsoft .NET as foundation along with a Microsoft SQL Server as the back-end. Problem: Getting information [...]]]></description>
			<content:encoded><![CDATA[<h3>Background:</h3>
<p>E-manage is a business management application.  It is capable of managing customer databases (CRM) as well as projects, invoices, purchase orders, and inventory to name a few.  The e-manage client application runs on a users desktop and uses Microsoft .NET as foundation along with a Microsoft SQL Server as the back-end.</p>
<h3>Problem:</h3>
<p>Getting information was easy when you were in the office at a computer.  However, you were out of luck when you were out of the office.  Something was needed to allow users access to crucial business data while mobile.</p>
<h3>Solution:</h3>
<p>I was asked to created a mobile web portal that could be used with any smart phone that had a basic Internet connection.  This would allow users to access company data while out of the office.</p>
<h3>Result:</h3>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_181" class="wp-caption alignnone" style="width: 160px"><a href="http://www.databatrix.com/wp-content/uploads/2009/08/em_main.JPG"><img class="size-thumbnail wp-image-181" title="Mobile_Main_Screen" src="http://www.databatrix.com/wp-content/uploads/2009/08/em_main-150x150.jpg" alt="Mobile portal landing screen with alerts and recent items." width="150" height="150" /></a><p class="wp-caption-text">Mobile portal landing screen with alerts and recent items.</p></div></td>
<td>
<p><div id="attachment_180" class="wp-caption alignnone" style="width: 160px"><a href="http://www.databatrix.com/wp-content/uploads/2009/08/em_company.JPG"><img class="size-thumbnail wp-image-180" title="Mobile_Company_View" src="http://www.databatrix.com/wp-content/uploads/2009/08/em_company-150x150.jpg" alt="Mobile portal company view" width="150" height="150" /></a><p class="wp-caption-text">Mobile portal company view</p></div></td>
</tr>
<tr>
<td>
<p><div id="attachment_183" class="wp-caption alignnone" style="width: 160px"><a href="http://www.databatrix.com/wp-content/uploads/2009/08/em_ServiceTicket.JPG"><img class="size-thumbnail wp-image-183" title="Mobile Service Ticket" src="http://www.databatrix.com/wp-content/uploads/2009/08/em_ServiceTicket-150x150.jpg" alt="View/Edit/Create Service Tickets" width="150" height="150" /></a><p class="wp-caption-text">View/Edit/Create Service Tickets</p></div></td>
<td>
<p><div id="attachment_182" class="wp-caption alignnone" style="width: 160px"><a href="http://www.databatrix.com/wp-content/uploads/2009/08/em_projects.JPG"><img class="size-thumbnail wp-image-182" title="Mobile Projects View" src="http://www.databatrix.com/wp-content/uploads/2009/08/em_projects-150x150.jpg" alt="View/Edit Projects" width="150" height="150" /></a><p class="wp-caption-text">View/Edit Projects</p></div></td>
</tr>
</tbody>
</table>
<p><a href="http://www.databatrix.com/wp-content/uploads/2009/08/eManage_Mobile_Portal_Create_Service_Ticket.wmv">e-manage Mobile Portal &#8211; Create Service Ticket</a> (Video)</p>
<p><a href="http://www.databatrix.com/wp-content/uploads/2009/08/eManage_Mobile_Portal_Add_New_Company.wmv">e-manage Mobile Portal &#8211; Add New Company</a> (Video)</p>
<p>I created a web application written in VB.NET that would connect directly with the MS SQL Server to supply the user with the data they needed.  I created it to be light as possible without giving up functionality and usability.  I also integrated with Yahoo Business Search API to lookup business addresses automatically to increase accuracy.  From the mobile portal, you can:</p>
<ul>
<li>View/Edit/Create a Company or Location</li>
<li>Create a Company with the aid of a Yahoo search</li>
<li>View/Edit/Create a Contact</li>
<li>Assign existing Company Contacts to a Project</li>
<li>View/Edit/Create a Project</li>
<li>View/Edit/Create a Service Agreement</li>
<li>View Service Ticket part totals when viewing a Service Agreement</li>
<li>Easily see a service agreement&#8217;s validity based on the agreement&#8217;s start date and agreement contact length</li>
<li>View/Edit/Create a Service Ticket</li>
<li>Assign/Re-Assign Service Tickets to Service Agreements</li>
<li>Add Parts to a Service Ticket by Searching the e-manage part database</li>
<li>View Part totals for a Service Ticket</li>
<li>View/Download a document/attachment that belongs to a Company, Contact, Project, Service Agreement, or Service Ticket</li>
<li>View/Create a Note that belongs to a Company, Contact, Project, Service Agreement, or Service Ticket</li>
<li>View/Reply/Acknowledge a Note that belongs to any object</li>
<li>Submit Project Action Items</li>
<li>View your Actions To Perform</li>
<li>View your Open Action Items</li>
<li>View Recent Items (syncs with the Recent Items in e-manage and updates any items that you open via the mobile portal)</li>
<li>Open multiple items at the same time in a tabbed environment</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.databatrix.com/2009/08/e-manage-mobile-portal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.databatrix.com/wp-content/uploads/2009/08/eManage_Mobile_Portal_Create_Service_Ticket.wmv" length="3940379" type="video/x-ms-wmv" />
<enclosure url="http://www.databatrix.com/wp-content/uploads/2009/08/eManage_Mobile_Portal_Add_New_Company.wmv" length="2566817" type="video/x-ms-wmv" />
		</item>
	</channel>
</rss>

