C
Craig Buchanan
I am writing an application that treats a website's forms as a really crappy
type of webservice. i do this because they don't have an API.
one of the objects in my application (called 'Employee') requires the use of
two forms (on two pages). as a result, i need to 'map' how my class'
properties are mapped to the two forms.
i've done this by creating a custom Property class which has the following
properties: Name, Value, FormName, Url, ElementName, and ElementType (e.g.
INPUT, SELECT). i also have an associated collection name
PropertyCollection. I store this mapping in an XML document and use it as a
source for the XmlDeserializer when it re-creates the PropertyCollection.
in the Save method of the Employee class, i would like to take the string
that represents the form (e.g. firstName=bob&lastName=johnson&salary=100000)
and substitute the value of the each property that changed (e.g.
firstName=bob&lastName=johnson&salary=200000). i plan to track the
properties that have values have changed and use this list to drive the
change to the form variables.
My problem is how to best alert the Employee class that a Property has
changed. i'm guessing that i can do this with a Delegate, but I don't have
much experience using them.
I would appreciate some thoughts on how to approach this.
Thanks in advance,
Craig Buchanan
type of webservice. i do this because they don't have an API.
one of the objects in my application (called 'Employee') requires the use of
two forms (on two pages). as a result, i need to 'map' how my class'
properties are mapped to the two forms.
i've done this by creating a custom Property class which has the following
properties: Name, Value, FormName, Url, ElementName, and ElementType (e.g.
INPUT, SELECT). i also have an associated collection name
PropertyCollection. I store this mapping in an XML document and use it as a
source for the XmlDeserializer when it re-creates the PropertyCollection.
in the Save method of the Employee class, i would like to take the string
that represents the form (e.g. firstName=bob&lastName=johnson&salary=100000)
and substitute the value of the each property that changed (e.g.
firstName=bob&lastName=johnson&salary=200000). i plan to track the
properties that have values have changed and use this list to drive the
change to the form variables.
My problem is how to best alert the Employee class that a Property has
changed. i'm guessing that i can do this with a Delegate, but I don't have
much experience using them.
I would appreciate some thoughts on how to approach this.
Thanks in advance,
Craig Buchanan