|
If i understand you correctly you want to notify another user before they delete a record that it has been viewed.If so Sessions will not help you here. The First Thing you need to do. Before a User Deletes you must make sure that there is no other User who has retrieved the record. Now there are many ways to do that. its either , when a User selects a Record it must be Locked with his name and when another user selects it and try to delete it , it must say the username name bla bla has locked the record and you cannot delete it. and when a user that locked the record is done with the data, you can unlock the data for the user to do what ever. Locking data may result into dead locks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
HI,
This requirement cannot full fill with the only using of session object. You have to work around that.
Regards
Anil Pal
|
|
|
|
|
Hi Anil,
I am not using only session, I am making it with help of global.asax and Application_start events.
But my problem is how to give message to another session user from current user.
|
|
|
|
|
ur end target is to show username in message ie."Deleted by <username>".
Is it?
With Thanks & Regards
Amit Sk Sharma
|
|
|
|
|
hi Amit,
My end target is not just display user name, but i want to display it to users which are viewing same data,
Means take an example, that there is student records 1,2,3,4.
there are users
A,B,C
Now A is viewing student recored 1.
B is viewing student record 2.
Now if C is going to delete student record 1, then A will get message that "student record 1 is deleted by A"
all the data are come from database means A,B,C and 1,2,3,4.
And please send me if you have solution.
Thanks
|
|
|
|
|
You can only tell your other user that something was deleted after the fact, or you can lock records that are open and forbid deletion ( what most people do ).
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
hi Graus,
My end target is not just display user name, but i want to display it to users which are viewing same data,
Means take an example, that there is student records 1,2,3,4.
there are users
A,B,C
Now A is viewing student recored 1.
B is viewing student record 2.
Now if C is going to delete student record 1, then A will get message that "student record 1 is deleted by A"
all the data are come from database means A,B,C and 1,2,3,4.
And please send me if you have solution.
Thanks
|
|
|
|
|
U can put a log there in DB with user ID of the person deleting record.
When any one tries to fetch deleted data refer log table first and if it has entry for the same; pick user name from there and if no record exists for tht student(ur example)in log, pick actual data and display it.
Hope it will give u a solution
With Thanks & Regards
Amit Sk Sharma
|
|
|
|
|
I want to save database round trip because there are 20 pages, and each page load if I will go to check whether this particular record is deleted by another user.
I think it is not an fesiable way.
|
|
|
|
|
Hi,
I know, but in my application, I have to allow both user to view and same data, but if any of one is deleting the data then I have to give message that this data is deleted by this particular user.
And redirect another user to home page.
So I have to access, another session user, from current user session.
Means if current user is going to delete data, at the same time he can access the another user, who is seeing same data, and he will give message that data is going to be deleted.
Thanks
Reply·
|
|
|
|
|
Hi,
First point is this how you are going to notify the user who is already watching the deal(until he refreshes the page).
So its better lock it while it is viewed by other and for this create a log in ur db in synchronisation with ur Session variable..
|
|
|
|
|
Hi,
I know, but in my application, I have to allow both user to view and same data, but if any of one is deleting the data then I have to give message that this data is deleted by this particular user.
And redirect another user to home page.
So I have to access, another session user, from current user session.
Means if current user is going to delete data, at the same time he can access the another user, who is seeing same data, and he will give message that data is going to be deleted.
Thanks
|
|
|
|
|
As you told me it is not a big deal then just keep log in ur db of current user and the record id viewed by them and update it evrytime they view some another record. When a user try to delete the record it is first checked in the logtable it is being viewed by someone or not. If it is viewed by some one then just return the person name or id as hyperlink.
But u hav to make some messaging system in your application to notify the another user about the delete.
|
|
|
|
|
sorry, by mistake i gave you 1 in rating.
I want to give message to another user that particular recored is deleted and recirect him/her to Home page, when a User is going to delete a record.
So I have to access session(instance) of another user, but I havn't idea, how to access another user at the same time who is viewing same record.
Thanks
Hardik Shah
|
|
|
|
|
ok it is a pretty difficult task.
there is a solution but may its not the be the best one but it will work for u.
we reached to the solution that u will get the username of the person viewing the record.
then just in some table update a flag for notification with the useraname of viewer.
Now add a component in your application that will be called on each page . On that component place a alert message which wil be fired when the flag of the notification table is true. And through ajax get the dataset refreshed after few seconds say 3 sec.
Hope now u get the solution...
|
|
|
|
|
I got an idea but it will slow down ur page litlle bit..
use ajax and refresh the dataset after some time say 3 seconds and if it dont find any data there then just display a alert message the record has been deleted..
So it suits ur requirement??
|
|
|
|
|
Hey thanks for quick reply,
but don't we have anything through which we can notify another session of user, through Global.asax Application_start events.
I am planning to use Application_start event by defining arraylist.
we user is going to view record, data is inserted in this arraylost.
then when user is going to delete the page it will check for same data from Application array list.
And through it he can find session of that particular user and give message.
but i don't know how to give message to another user with out he is not firing any postback event
|
|
|
|
|
ok it is a pretty difficult task.
there is a solution but may its not the be the best one but it will work for u.
we reached to the solution that u will get the username of the person viewing the record.
then just in some table update a flag for notification with the useraname of viewer.
Now add a component in your application that will be called on each page . On that component place a alert message which wil be fired when the flag of the notification table is true. And through ajax get the dataset refreshed after few seconds say 3 sec.
Hope now u get the solution...
|
|
|
|
|
Hey thanks for reply, I think i got solution from your above answer.
But can you have any way from which we can make a track of all current user of my application by his identity.
thanks and regards,
Hardik
|
|
|
|
|
if u are using some login system in your application then it is very easy to track users otherwise there are some commands in c# to get ip address of the user(but it is not much suitable for u.)
|
|
|
|
|
ok thanks a lot to help me for finding proper solution of my problem.
|
|
|
|
|
Hi
I have written java script code which is working fine in IE
but its not working in MOzila
code are............
function btntest_onclick()
{
var val1 = document.getElementById('username').value;
var val2 = document.getElementById('password').value;
self.location.href ("login.aspx?username=" + val1 + "&password=" + val2 + "");
}
Any Suggestion
Thanks in Advanced
krishna veer singh
|
|
|
|
|
Hi,
Try window.open("");
Regards
Anil Pal
|
|
|
|
|
its opening new page while i want to open in same page
krishna veer singh
|
|
|
|
|
Hi
Try this
document.location.href = "http://www.google.com";
Regards
Anil Pal
|
|
|
|