472,096 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

multi-user data entry

I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file.
However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his
own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
..
..
..

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
..
..
..

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well
as objEdit. Why is that happening?

Thanks.

Pat
Nov 20 '05 #1
3 1536
An ADO.NET group will be able to handle this better, but there are lots of
ways to do this such as using something as simple as GetChanges.. I think a
dataset also implements IComparable in which case you can get the changes
out.

-CJ
"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file.
However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his
own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
.
.
.

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
.
.
.

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well
as objEdit. Why is that happening?

Thanks.

Pat

Nov 20 '05 #2
Hmm. Correct me if I'm wrong, but I think your
suggestion finds the changed rows that the user makes
himself. The underlying XML file may have been changed
several times during the user's editing activities. I
want to find if the XML file has been changed (by other
users) during the user's editing activities.

Thanks,

Pat
-----Original Message-----
An ADO.NET group will be able to handle this better, but there are lots ofways to do this such as using something as simple as GetChanges.. I think adataset also implements IComparable in which case you can get the changesout.

-CJ
"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file. However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
.
.
.

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
.
.
.

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well as objEdit. Why is that happening?

Thanks.

Pat

.

Nov 20 '05 #3
This is a common thing I see, I use SQL though to do Pessemistic locking
(something you should be VERY careful with). What I'm saying is, you could
reload the XML file, and then validate changes agasint both of them, and do
whatever BL you need to do..

Now if you want to get "creative" you could use a FileSystemWatcher to
watch to see if the XML file was updated at anytime, and notify the user
instantly if they want to import these changes. Depending on how many users
you have / how many updates there are, this could get ugly. (File keeps
changing, user keeps getting notified) You also would have to write your
own handler in updating the UI when a file changes and getting the changes
(seeing if it affects the current record or not). but you have to remember
Datasets are disconnected so it can't necessarily watch to see when someone
else updates automaticalliy.

If you have some extra money check out Microsoft ADO.NET Core Reference
guid. ISBN 0-7356-1423-7 which I found pretty useful when learning about
Pessemistic locking.
USA pricing is 59.99. Canada 86.99,

Has a CD too...


"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:04****************************@phx.gbl...
Hmm. Correct me if I'm wrong, but I think your
suggestion finds the changed rows that the user makes
himself. The underlying XML file may have been changed
several times during the user's editing activities. I
want to find if the XML file has been changed (by other
users) during the user's editing activities.

Thanks,

Pat
-----Original Message-----
An ADO.NET group will be able to handle this better, but

there are lots of
ways to do this such as using something as simple as

GetChanges.. I think a
dataset also implements IComparable in which case you

can get the changes
out.

-CJ
"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file. However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
.
.
.

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
.
.
.

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well as objEdit. Why is that happening?

Thanks.

Pat

.

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

37 posts views Thread by ajikoe | last post: by
4 posts views Thread by Frank Jona | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.