|
Hi there,
Have a foreign key in the agent table that determines what type of agent they are, eg.
Table tblUserType
ID Desription
================================
0 default agent
50 principal
1000 superuser
and then in your agent table add an extra column that is a foreign key to the new tblUserType.
You could extend the tblUserType to have other columns that list the type of activities allowed - but in reality you'd normalize that to another table.
Also, probably worth creating a view that INNER JOINS with any other tables that holds information about a user, such that on your login screen you can quiz the view WHERE userid = < user id given > and get all the attributes you need.
As for case-sensitive - I'm afraid SQL and ACCESS are case insensitive. The only way round this is to generate a unique key when the password is created (and amended), e.g.
In the agent table, create another column that will hold the unique key as well as the password string
then, below is an example of how you would generate the unique key to use in this column
(Pseudo-code)
var strPassword = "myPassword";
var id = for(i=0;i < strPassword.length; i++) id += ascii(strPassword[i]);
...
...
insert row(strPassword, id)
Now you can search for it in SQL
SELECT UserId FROM tblUser WHERE password = 'myPassword' and id=1081;
The id 1081 comes from the ascii values:
m = ASCII 109
y = ASCII 121
P = ASCII 80
a = ASCII 97
s = ASCII 115
s = ASCII 115
w = ASCII 119
o = ASCII 111
r = ASCII 114
d = ASCII 100
=============
1081
=============
The id generated for "MyPassword" say, would be:
M = ASCII 77
y = ASCII 121
P = ASCII 80
a = ASCII 97
s = ASCII 115
s = ASCII 115
w = ASCII 119
o = ASCII 111
r = ASCII 114
d = ASCII 100
=============
1049
=============
You must remember though that if the user can change their password YOU MUST generate the new id too!
Hope this helps,
Andy
|
|
|
|
|
I AM TRYING TO CENTER A TABLE W/ A SCROLLER USING THE <DIV> TAG, AND THE TABLE IS NOT CENTERING. IVE TRIED DIFFERENT TYPES OF CENTERING, BUT NOTHING SEEMS TO WORK. THE TABLE ABOVE THE <DIV> TAG CENTERS, BUT THE ONE AFTER IT DOES NOT, IT STAYS OFF TO THE RIGHT. WHATS UP W/ MY CODE??? THANKS...
<table align=center class="tblHDR" width="650" cellpadding="0" cellspacing="0" border="1" bordercolor="steelblue" rules="none">
<tr bgcolor="steelblue">
<th width="10%" align="left">ID</th>
<th width="55%" align="left">File Name</th>
<th width="35%" align="left">Release Date</th>
</tr>
</table>
<div style="OVERFLOW: scroll; WIDTH: 650px; HEIGHT: 200px;" align="center">
<table align="center" DATASRC="#xmlUpdate" colspan= "2" class="tbl" width="650" cellpadding="0" cellspacing="0" border="1" bordercolor="steelblue" rules="none"
bgcolor="whitesmoke" style="CURSOR: hand" name="EntryTable" id="EntryTable"
onMouseover="changeto('lightsteelblue'); return true" onMouseout="changeback('whitesmoke'); return true">
<TR onclick="CurrentRecord(this.recordNumber)" >
<TD width="10%"><SPAN DATAFLD="UpdateFilesID"></SPAN></TD>
<TD width="55%"><SPAN DATAFLD="FileName"></SPAN></TD>
<TD width="35%"><SPAN DATAFLD="ReleaseDate"></SPAN></TD>
</TR>
</table>
</div>
|
|
|
|
|
I AM TRYING TO CENTER A TABLE W/ A SCROLLER USING THE TAG, AND THE TABLE IS NOT CENTERING. IVE TRIED DIFFERENT TYPES OF CENTERING, BUT NOTHING SEEMS TO WORK. THE TABLE ABOVE THE TAG CENTERS, BUT THE ONE AFTER IT DOES NOT, IT STAYS OFF TO THE RIGHT. WHATS UP W/ MY CODE??? THANKS...
|
|
|
|
|
In your table cells (td tags), change all the widths to 33% and add the align="center" attribute too them.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
thanks for the response. i actually tried adding a <center> tag before and after the <div> tag and that worked. i dont know if thats the best approach, but it looks fine now, and everything is centered. thanks for you time.
woo doc
|
|
|
|
|
Hi folks,
I'm having a heck of a time trying to get this problem fixed. Here are the details.
We have a form that users enter date and time information into. The first field is receive date (mm/dd/yyyy and 2400 hour formats), the second field is the resolve date (mm/dd/yyyy and 24 hour format). What we do from here is compare them and get various information. Such as work time, total problem time, and stand by time. We also attempt to count each day as an 8 hour work day by getting rid of 16 hours per day.
I can get my math to work for a single month, but when the month changes (ie- 05/31/2004 for receive time and 06/01/2004 for resolve time) I get a negative value. Now the way my code is written, this is correct...the problem is that I need it to show as 8 hours TPT and not -520.
Any ideas how this might be corrected???
Here is the code:
<br />
function dateDiff(dateform) {<br />
date1 = new Date();<br />
date2 = new Date();<br />
date3 = new Date();<br />
date4 = new Date();
date5 = new Date();
fdayofour = 1072933200000;<br />
diff = new Date();<br />
<br />
if (isValidDate(dateform.ReceiveDate.value) && isValidTime(dateform.ReceiveTime.value)) {
date1temp = new Date(dateform.ReceiveDate.value + " " + dateform.ReceiveTime.value);<br />
date1.setTime(date1temp.getTime());<br />
}<br />
else return false;
<br />
if (isValidDate(dateform.ResolveDate.value) && isValidTime(dateform.ResolveTime.value)) {
date2temp = new Date(dateform.ResolveDate.value + " " + dateform.ResolveTime.value);<br />
date2.setTime(date2temp.getTime());<br />
}<br />
else return false;
<br />
if (isValidDate(dateform.CurrentDate.value) && isValidTime(dateform.CurrentTime.value)) {
date3temp = new Date(dateform.CurrentDate.value + " " + dateform.CurrentTime.value);<br />
date3.setTime(date3temp.getTime());<br />
}<br />
else return false;
<br />
if (date2temp < date1temp){<br />
alert("Date/Time Received cannot be greater than Date/Time Resolved");<br />
return false;<br />
} else if (date2temp>date3temp || date1temp>date3temp){<br />
alert("Date/Time Received/Resolved cannot be greater than the Current Date/Time");<br />
return false;<br />
} else;
<br />
date4temp = new Date(dateform.ReceiveDate.value);
date4.setTime(date4temp.getDate());<br />
<br />
rdate = date4temp.getDate();<br />
<br />
date5temp = new Date(dateform.ResolveDate.value);
date5.setTime(date5temp.getDate());<br />
<br />
rsdate = date5temp.getDate();<br />
<br />
<br />
<br />
rsall = (date2.getTime() - fdayofour);<br />
rall = (date1.getTime() - fdayofour);<br />
rdate = ((rsall - rall) / (1000 * 60 * 60));<br />
<br />
diff.setTime(date2.getTime() - date1.getTime());<br />
<br />
timediff = diff.getTime();<br />
dtimediff = diff.getTime();<br />
mtimediff = diff.getTime();<br />
<br />
days = (dtimediff / (1000 * 60 * 60 * 24));<br />
days = Math.floor(days);<br />
<br />
totdate = (rsdate - rdate);<br />
if (totdate >= 0){<br />
totdate = (totdate * 16);<br />
} else if (totdate < 0){<br />
totdate = (Math.round(days * 16))<br />
}<br />
mins = (mtimediff / (1000 * 60));<br />
hours = (mins / 60);<br />
hours = (hours - totdate);<br />
alert(rdate);<br />
worktime = Math.round((dateform.WorkTime.value * 10) /10);<br />
totalproblemtime = Math.round((hours * 10) /10);<br />
standbytime = totalproblemtime - worktime;<br />
standbytime = Math.round(standbytime *10)/10;<br />
dateform.WorkTime.value = worktime;<br />
dateform.StandByTime.value = standbytime;<br />
dateform.TotalProblemTime.value = totalproblemtime;<br />
return false;
}<br />
<br />
|
|
|
|
|
Hi there,
Are you using IE on a Win. platform? If so you could include a VBScript block in your client HTML page, and get the JScript to call a function in the VBScript block - give it the two dates and use the DateDiff function, e.g.
<script language='VBScript'>
<!--
Function GetDays(dtStart, dtEnd)
GetDays = DateDiff("d", dtStart, dtEnd)
End Function
</script>
<script language='JScript'>
<!--
function onClick()
{
var dtStart = new Date("2004/06/08");
var dtEnd = new Date("2004/07/09");
var nDays = GetDays(dtStart.getVarDate(), dtEnd.getVarDate());
alert(nDays);
}
</script>
Then you can treat each day as n x 8hrs or whatever is needed.
Hope this helps,
Andy
|
|
|
|
|
Thank you Andy....
I feel like an idiot atm, because we already have a VBscript for doing this, and I was trying to emulate it in javascript. We're using a SQL server to house a monstorus database, and this code I had typed in earlier is actually in a VB/ASP page.
I'll see if I can't modify the vbscript with the right tags and get it to work in the form.
Thanks for the input!
John
|
|
|
|
|
How about:
MillisecondsPerDay = 86400000;
function GetDays(startDate, endDate)
{
return Math.floor(
(endDate.valueOf() - startDate.valueOf())
/ MillisecondsPerDay);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hi,
I created a live chat application.Everything working fine in our devlompent server.But after we went live ,some messages are not reaching database server.For the chat window I used frame set having top frame for dispaly messages and bottom frame for sending messages.Can any one tell me why it's happening?why some meassages are not reaching database?
Thanks in advance
satya
|
|
|
|
|
Hi,
I created a live chat application.Everything working fine in our devlompent server.But after we went live ,some messages are not reaching database server.For the chat window I used frame set having top frame for dispaly messages and bottom frame for sending messages.Can any one tell me why it's happening?why some meassages are not reaching database?
Thanks in advance
satya
|
|
|
|
|
how can we stop multiple login of a user in a browser based application
|
|
|
|
|
you can store wheather this user is already logged or not in the Application object..
add the user name to the Application Contents Collection and remove it when he logges off.
|
|
|
|
|
What if they don't log off?
If the user closes his only browser window losing his link to the session. Then how are they going to get back into the system?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
he'll have to wait till the previous session times out
|
|
|
|
|
Keep a database and check if the user is already logged in.
Any tool is only as good as you can use it!!
(http://www.pascalnet.tk)
|
|
|
|
|
Or you could use cookies. If users has a cookie, he is already logged in. so do not log him in again just continue with what content he was supposed to receive. Otherwise login the users.
This way even if the users closed the browser without loggin out he would still retain his login info till the cookie is valid
Any tool is only as good as you can use it!!
(http://www.pascalnet.tk)
|
|
|
|
|
how to code a treeview control for a web application
|
|
|
|
|
All I saw was how to ask the same question 3 times in a row.
BW
The Biggest Loser
"People look so snooty, take pills make them moody Automatic bazootie, zero to tutti frutti" -Hollywood Freaks
|
|
|
|
|
What do you mean "How to code"? Do you mean like how to use? Or how to create your own?
If you wan't to know how to use it... Search Google and CodeProject.
If you wan't to know how to create one, you would have to inherit from the Control, and draw it using GDI+.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
how to code a treeviewcontrol for a web application
|
|
|
|
|
how to add a treeview to a webproject
|
|
|
|
|
Hi To All
Yes the subject says a lot!!!
I have a webform which contains buttons, for one button i need to populate a modal dialog window and I will create a server object which will be in session in modal dialog.
But for the same button event I need to perform the insertion to database using session object which is created in modal dialog window.
The following is the code which will tell you what i am trying to do...
Response.write(openModalDialog);
str=Session["test"]//this will be created after I perform in modal dialog window
Database.insert(str)
please note that I am trying to execute all the lines in same button event
But i want to execute second and third line after i popup modal window and second should be executed once i close the modal window.
Please let me know if you have any idea on how to do that or any other way through which i can achieve.
Regards,
|
|
|
|
|
Hi there,
I'm assumming that you are using ASP.NET (??)
Your problem can be achieved with the following:
Create two web forms; the first is the page that has the buttons (and that will open the modal dialog), the second is the contents of the modal window.
e.g.
The first page...
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestWebApp.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
</HEAD>
<script language='JScript'>
function onbtnClick()
{
window.showModalDialog("./Modal1.aspx", "", "");
}
</script>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 456px; POSITION: absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
and the code behind...
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
Button1.Attributes["onclick"] = "onbtnClick()";
}
else
{
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
}
So what we are doing is on the initialisation of the page, we set the onclick attribute of the button to the client-side function onbtnClick() which will open the modal dialog window. If you look at the function, then we will open the Modal1.aspx page. The client-side event handler will be perform first, then once the user closes the modal dialog, the form will post back to the server and call the Button1_Click server event handler.
I dont know what you want to display in the modal window, but Model1.aspx can be a normal ASP.NET page so put whatever you need inside of it.
Hope this helps,
Andy
|
|
|
|
|
Hi Thanks for replying me...
This will solve, but my PL(Leader)is asking me to have both java and server script to execute in the same button function.
I mean he dont want javascript to have in the client side, he wants to embed the javascript at server side.
|
|
|
|