Wednesday, December 23, 2009
hi
eleshopexm.com This is a very good network platform,
which operations are: motorcycles, brand-name mobile phones, MP3, MP4,
notebook computers, television, etc.; quality assurance warranty, and
absolute credit guarantee; because it is purchasing from the
manufacturer , the price is cheap, are now being sold at wholesale
prices, if not satisfied, you can also unconditional return,
opportunity, can we say Go nuts! ! !
Thursday, April 20, 2006
Disecting CSLA 2.0 - Looking at SimpleDataProvider in depth
Disecting CSLA 2.0 - PropertyHasChanged Combo
- ValidationRules.CheckRules(PropertyName)
- MarkDirty()
- OnPropertyChanged(PropertyName)
Thursday, January 26, 2006
VB.NET 2005 - Continue & Using keywords
Continue
This is one of the features I've been looking for in VB .NET and I'm glad they added this functionality. Using this keyword insie the loop allows you to skip and perform the next iteraion. Continue For is used cojunction with For loop and Continue While is use in while loop.
Using
This is for garbage collection where in developer wishes to explicitly clean up the unmanged resources before abandoning an object. The object must implment IDisposable. Please see below for an example:
Inherits Generic.List(Of Country)
Implements IDisposable
Public Overloads Sub Add(ByVal CountryName As String)
Dim itm As New Country
itm.CountryName = CountryName
Me.Add(itm)
Dim i As Integer = Me.Count - 1
Me.Item(i).IDCountry = Me.Count
End Sub
Public Overloads Sub Dispose() Implements IDisposable.Dispose
' Do some clean up here
End Sub
End Class
To explicity clean up the unmanged resources
' Retrive some data from mCountries
Using (mCountries)
' Manipulate data
End Using
Tuesday, January 24, 2006
IMS Update
Monday, January 23, 2006
VB .NET 2005 - Global Keyword
Global
Points to .NET framework base class library when used. This is useful wherein some of the custom namespace in an assembly has the same namespace in .NET framework base class libraries.
Namespace System.IO
Public Class FileWriter
Public Shared Sub Write()
' Some code here for actual implementation
End Sub
End Class
End Namespace
Supposing you want to use the .NET framework base class library for System.IO.
Simple use the Global keyword, please see below.
Dim fstm as Global.System.IO.FileStream
IMS Update for Mediaspot
Thursday, January 12, 2006
Replacing IdleSync() w/ OnListChanged()
Environment: CLSA .NET and Windows Form
The original sample code illustrated the use of Application.IdleSync() to toggle the save button in a BusinessBaseCollection when editing a specific editable object. I've noticed when the mouse is moved the application.IdleSync() handler is triggered and I find it ineffecient.
Trying to find an efficient way, I noticed that BusinessBaseCollection overrides the OnListChanged Event. So I changed my IdleSync handler to OnListChanged.
See below for illustration:
In windows form level, I've created a method name OnListChanged()
btnSave.Enabled = mCustomer.IsSavable
'Add the code for the Broken Rules Error Provider
End Sub
After retrieving records from the database, pattern this code just replace it with your own variables.
'Needs to be remove first
RemoveHandler mCustomer.OnListChanged, AddressOf OnListChanged
AddHandler mCustomer.OnListChanged, AddressOf OnListChanged
Before closing the form alway remove the added handler, it can be placed on Form_Close() event.
RemoveHandler mCustomer.OnListChanged, AddressOf OnListChanged
Wednesday, January 11, 2006
CSLA.NET Switching root to child object and vice versa
I’ve managed to create my own switchable mechanism in CSLA .NET for editable object. I did tried to implement the original switchable editable object as presented by the author, but it confuses me a lot. As far as I understand to make the editable object switchable from root to child is by putting MarkAsChild() in the constructor of the object. When an editable child object is implemented calling Save() method it would throw an exception because it can’t be save directly. However, if we can manage to change the IsChild property from true to false then there will be no problem. But IsChild is a read only property. I know this is a hack version against the original implementation and I guess a lot of you guys will object on what I did. =)
So out of curiosity, I tried to use reflection to change the mIsChild of type boolean private variable to false to behave as a root object and setting it to true to behave as a child object and it works. So I decided to combine the implementation of child and root object rather than implementing switchable object.
When calling Save() method in:
So instead of duplicating the code from Update() to DataPortal_Update(), I simply call Update() in DataPortal_Update().
Below are codes for switching editable object from root to child and vice versa:
Public Sub ToRoot(ByVal o As Object)
Dim t As System.Type
t = o.GetType().BaseType()
If String.Compare(t.Name, "BusinessBase", True) > 0 Then
Throw New Exception("Not a CSLA object")
End If
Dim fi As FieldInfo = t.GetField("mIsChild", _
Reflection.BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance _
Or BindingFlags.FlattenHierarchy Or BindingFlags.CreateInstance _
Or BindingFlags.SetField)
If fi Is Nothing Then
Throw New Exception("Unable to resolve CSLA object info")
End If
Dim IsChild As Boolean = fi.GetValue(o)
If Not IsChild Then
Throw New Exception("The object is already in Root")
End If
fi.SetValue(o, False)
End Sub
Public Sub ToChild(ByVal o As Object)
Dim t As System.Type
t = o.GetType().BaseType()
If String.Compare(t.Name, "BusinessBase", True) > 0 Then
Throw New Exception("Not a CSLA object")
End If
Dim fi As FieldInfo = t.GetField("mIsChild", _
Reflection.BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance _
Or BindingFlags.FlattenHierarchy Or BindingFlags.CreateInstance _
Or BindingFlags.SetField)
If fi Is Nothing Then
Throw New Exception("Unable to resolve CSLA object info")
End If
Dim IsChild As Boolean = fi.GetValue(o)
If IsChild Then
Throw New Exception("The object is already in Child")
End If
fi.SetValue(o, True)
End Sub
Scenario: Switchng editable object (from child to root) inside a root collection
eobjName = DirectCast(Me.BindingContext(mNameCol.Current, eobjName).Clone()
ToRoot(eobjName)
'Do something with root object and save changes
eobjName.Save()
ToChild(eobjName)
Friend Sub UpdateCollection(ByVal o as eobjNameType)
Dim i as Integer
For i = 0 To List.Count - 1
If DirectCast(List.Item(i), eobjNameType).Equals(o) Then
List.Item(i) = o
Exit For
End If
Next i
End Sub
Mediaspot's IMS Go Live
MediaSpot’s Inventory Management and Sales System go live. It did run with a couple of errors. LOL… It’s really different when you are the one who develop and at the same time doing the testing. I’m glad that it was my cousin’s store there was not too much pressure when the errors pop up. LOL.. Right now, I managed to finish all the bugs that were found.
There was a little delay on the time frame of the deployment of the project due to the fact that I was using CSLA .NET rather than doing in using datasets. I know that doing it datasets will give me the speed in development, but I wanted it to be in object oriented approach in dealing with the business process and another reason is that I’m a fan of Rockford Lhotka. LOL…
For the backend I was using MySQL latest version to take advantage with stored procedures, views and triggers. Why not MS-SQL? I guess the reason is clear MySQL is for free. =) But when I’ve found out the SQL 2005 Express is for free, it was too late because I was halfway doing it in MySQL. So my plan later is to create a database in SQL 2005 Express and modify the application to choose what type of backend database server to use.
I have no regrets using MySQL, at least I did have a chance to know SQL syntax in MySQL. The shift from MS-SQL to MySQL during developing the stored procedures wasn’t that hard. I’ve found some bugs in MySQL and I’ll be sending it MySQL to clarify if is really a bug or the feature is not supported.
MediaSpot is a store the sales a variety gadgets for cell phones, computers, digital cameras, DVD and MP3 players. It is located on JQS, which is beside UC Banilad Campus.