473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Notifying other running instances of my app of changes to list contents.

I have an application that has many windows. One window is used for
order processing. I would like this window to display the other users
who are also performing order processing (the idea is to prevent a user
from opening an order that is being worked on by another user.

I have considered using the database:

* my query can return a user id or other identifier along with the
order record so that when I populate my list view control, I can
display the user who is working on that record.

* if the user trys to open one of these records I can tell them
'someone else has this right now'.

* I want to avoid hitting the database to update this list using a
timer control and multithreading (the reason I would do that is to
periodically update each users list view with the most current users
using whatever order).

the bad part of this idea is that when the window initially loads and
populates the list, it only knows about the other users at that time.
the user would click on something that looks 'open' to them only to
find out it's not really open to them.

I'm looking for a way to make my order list more dynamic- meaning, if
user A has the order list widow open, and so does user B, I want the
window user B is using to be aware of user A's change (open a new order
for processing).

Am I on the right track? Is the list view not the right component? I
know gridview and datagrid can be sensitive to database changes, but I
cannot see how I can avoid the use of a timer in any of the above (or
will the grid component's automatically sense changes to the database
outside of themselves?).

I'm considering using some type of network communication to get these
messages across. Is this a good idea, or bad?

thanks for any thoughts- I am really stuck here. I'm concered that I
am missing something easy and obvious...

Jul 18 '06 #1
3 1251
IdleTask,

What you're asking is the difference between pessimistic and optimistic
concurrency.
A not so simple problem to answer in a newsgroup.

Pessimistic concurrency is based on the fact that in a database two users
can update often the same data at the same time.

Optimistic concurrency is based on the fact that time has learned that the
first situation occurs in most standard situations seldom, however that
errors because of that has to be prevented, so there is a checking
afterwards if something has been changed in the meantime.

Pessimistic concurrency is very difficult to do without getting the change
on deadlocks. It has as well a very hug impact on the performance of a
database (the reason that is not anymore in AdoNet while it was in Ado).

Therefore it is in my idea better to over think your plans again.

http://msdn.microsoft.com/library/de...oncurrency.asp

I hope this gives some ideas

Cor
<id******@msn.comschreef in bericht
news:11**********************@h48g2000cwc.googlegr oups.com...
>I have an application that has many windows. One window is used for
order processing. I would like this window to display the other users
who are also performing order processing (the idea is to prevent a user
from opening an order that is being worked on by another user.

I have considered using the database:

* my query can return a user id or other identifier along with the
order record so that when I populate my list view control, I can
display the user who is working on that record.

* if the user trys to open one of these records I can tell them
'someone else has this right now'.

* I want to avoid hitting the database to update this list using a
timer control and multithreading (the reason I would do that is to
periodically update each users list view with the most current users
using whatever order).

the bad part of this idea is that when the window initially loads and
populates the list, it only knows about the other users at that time.
the user would click on something that looks 'open' to them only to
find out it's not really open to them.

I'm looking for a way to make my order list more dynamic- meaning, if
user A has the order list widow open, and so does user B, I want the
window user B is using to be aware of user A's change (open a new order
for processing).

Am I on the right track? Is the list view not the right component? I
know gridview and datagrid can be sensitive to database changes, but I
cannot see how I can avoid the use of a timer in any of the above (or
will the grid component's automatically sense changes to the database
outside of themselves?).

I'm considering using some type of network communication to get these
messages across. Is this a good idea, or bad?

thanks for any thoughts- I am really stuck here. I'm concered that I
am missing something easy and obvious...

Jul 18 '06 #2
Hi

Another possible alternative for you is, instead of listing all orders
to be processed along with the name of the user currently dealing with
it (if there is one) is to have a button on your form (called something
like "Get order to process") which will pull one order out at a time
and when an order is pulled out by a user to work on you can mark this
order as 'checked out' or whatever. This way you can ensure that only
one person is working on an order at any given time and you'll only be
hitting the DB when they're ready to process an order, and they'll only
see orders that are not being worked on (plus you'll only be retrieving
one order at a time from the DB so the performance shouldn't take a
nosedive).

Alternatively you could code a queue of available orders, once a user
has 'checked out' an order to process, it gets removed from the queue
(although with this option you'll obviously have to continually poll
the DB to refresh the queue).

I suppose it really depends on what you want to achieve.

If you want all the users to be able to see all the orders, along with
details of who's working on them, you've really got no alternative than
to poll the DB frequently to ensure the view they have is up to date,
(either that or have something like the following implemented so you
only poll the DB when you know there's been a change:
http://www.codeproject.com/cs/databa...tsArticle.asp).

If you just want to stop people working on an order that's already
being processed, then don't give them the option - i.e. pull
one/five/however many orders you think they can process and flag these
as checked out so other users can't get at them.

Hope that helps
Martin

Cor Ligthert [MVP] wrote:
IdleTask,

What you're asking is the difference between pessimistic and optimistic
concurrency.
A not so simple problem to answer in a newsgroup.

Pessimistic concurrency is based on the fact that in a database two users
can update often the same data at the same time.

Optimistic concurrency is based on the fact that time has learned that the
first situation occurs in most standard situations seldom, however that
errors because of that has to be prevented, so there is a checking
afterwards if something has been changed in the meantime.

Pessimistic concurrency is very difficult to do without getting the change
on deadlocks. It has as well a very hug impact on the performance of a
database (the reason that is not anymore in AdoNet while it was in Ado).

Therefore it is in my idea better to over think your plans again.

http://msdn.microsoft.com/library/de...oncurrency.asp

I hope this gives some ideas

Cor
<id******@msn.comschreef in bericht
news:11**********************@h48g2000cwc.googlegr oups.com...
I have an application that has many windows. One window is used for
order processing. I would like this window to display the other users
who are also performing order processing (the idea is to prevent a user
from opening an order that is being worked on by another user.

I have considered using the database:

* my query can return a user id or other identifier along with the
order record so that when I populate my list view control, I can
display the user who is working on that record.

* if the user trys to open one of these records I can tell them
'someone else has this right now'.

* I want to avoid hitting the database to update this list using a
timer control and multithreading (the reason I would do that is to
periodically update each users list view with the most current users
using whatever order).

the bad part of this idea is that when the window initially loads and
populates the list, it only knows about the other users at that time.
the user would click on something that looks 'open' to them only to
find out it's not really open to them.

I'm looking for a way to make my order list more dynamic- meaning, if
user A has the order list widow open, and so does user B, I want the
window user B is using to be aware of user A's change (open a new order
for processing).

Am I on the right track? Is the list view not the right component? I
know gridview and datagrid can be sensitive to database changes, but I
cannot see how I can avoid the use of a timer in any of the above (or
will the grid component's automatically sense changes to the database
outside of themselves?).

I'm considering using some type of network communication to get these
messages across. Is this a good idea, or bad?

thanks for any thoughts- I am really stuck here. I'm concered that I
am missing something easy and obvious...
Jul 18 '06 #3
Hey there-

Thanks for your reply. I agree w/ you and the other person's
suggestion that I rethink. Sometimes you get busy and caught up in the
problem and you can over think it :)

Pulling one order at a time is good suggestion and will work for my
needs.

Thanks again (to you and the other person as well).

Jul 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Wohlbier | last post by:
Hi, I have a basic programming question regarding classes in python. I want to have a list of "primaryClass" instances, and in each instance of primaryClass I would like a list of "subClass"...
2
by: anon | last post by:
I'm aware that you can assign a value to an attribute in all class instances by assigning to <Class>.<attribute>, however, my case is slightly different and bizarre. In module node: top,...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
0
by: marc.derider | last post by:
I was making a change to a Web service. It was something extremely trivial, such as adding a single parameter to extend the functionality exposed through that method. It got me to thinking...
18
by: Daniel | last post by:
My previous thread got very large so here is my point again, but a better example of my problem: SceneChair chair = (SceneChair)_objMan.GetObject((int)ObjectID.Seats); chair.Position =...
6
by: dtschoepe | last post by:
Hi all, Working on homework again... I've got a weird problem, I've been banging my head against the wall on what is causing it. I have a pointer to a typdef named Person. At one point in the...
0
by: velu5 | last post by:
Hello, I want to enumerate all the RUNNING SQL instances using SQL DMO. But any of the following methods would not help ListAvailableSQLServers Method ListInstalledInstances Method because...
0
by: Alex N | last post by:
My question relates to one of the previous ones, http://bytes.com/topic/c-sharp/answers/545389-saving-properties-settings-dll-project If i want to share a single <app>.exe.config file among...
1
by: edurazee | last post by:
Suppose I am in a network. One or more MySQL services are running on a machine/several machines in the network including the localhost. How to write a C# code to list/enumerate the names of all...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.