|
-
March 18th, 2009, 09:28 PM
#1
RowDataBound(:
hello(:
i need another help for this prob..
i hav to knw hw to use rowDataBound(:
objective - gotta generate an email for the user who has created ticket on a problem wid all the details.
i'm able to retrieve all the records of the tickets bt i want to display only the specific record of the user.
how do i start abt doin tht??
pls help any help much appreciated..
thx(:
-
March 19th, 2009, 02:28 PM
#2
Re: RowDataBound(:
You should be doing the filtering of the records on the database side. Write a proper query that will give you the desired record.
What is it that you want to do with RowDataBound event?
-
April 6th, 2009, 01:54 AM
#3
Re: RowDataBound(:
hello Shuja Ali or any1 else who knows the answer to this qn,pls help
i have these codes which does the calculations for auto assigning of the tickets to the support staff to attend to their ticket.
but i'm not sure if i'm supposed to write these codes in the code-behind or in the classes where the sql statements are defined??
any idea?
-
April 6th, 2009, 02:18 AM
#4
Re: RowDataBound(:
Anything that has to do with the database should be written in the database side of the code or if you have Business Layer (classes that define business logic), then you should write it there.
-
April 6th, 2009, 03:10 AM
#5
Re: RowDataBound(:
i don't have a business layer class..i don't know what is that.. 
i was told to put the codes in the classes page where i have the sql statements..
so is that the right way??
-
April 6th, 2009, 03:41 AM
#6
Re: RowDataBound(:
Yes that should be the right way of doing it.
-
April 6th, 2009, 03:53 AM
#7
Re: RowDataBound(:
okay..thanx so much..
another one mre qn!(:
the task which i'm doing is to actually assign the ticket submitted bny the user to a support staff automatically so they can attend to it..these support staffs have their own quotas..
so i came out with this formula to implement this concept..
the formula is -> QuotaAns = (1 / (TotalTickets + 1)) * Quota
the quotaAns will determine who to give the ticket to..this formula muz calculate for all the support staff and see who has the highest quota will receive the ticket..
for example: if support Staff A's Quota is 50% and B's quota is 30% and C's quota is 20%
the formula will be implemented this way: QuotaAns = (1/(1+1))*50%
so this will be used for all the support staff and who has the highest quotaAns gets the ticket.
the 1 always remains the same because its the one new ticket..total ticket is for that particular staff which will be accumilated..
i've got to implement this in my codes and i did this :
Public Function CalculateQuota() As Double
Dim newTicket As Integer = 1
Dim TotalTickets As Integer
Dim Quota As Double
Dim QuotaArr As String
Dim QuotaAns As Double
QuotaAns = (1 / (TotalTickets + 1)) * Quota
If QuotaAns < ((SupportStaffID = "10") And (SupportStaffID = "11") And (SupportStaffID = "15")) Then
End If
End Function
but i'm stuck half way..i don't know how to move on..any help pls??
-
April 6th, 2009, 04:58 AM
#8
Re: RowDataBound(:
i edited and came out with another kind of codes.
do u think its correct??
can u help me pls??
thx
Public Function CalculateQuota() As Double
Dim newTicket As Integer = 1
Dim TotalTickets As Integer
Dim Quota As Double
Dim QuotaArr() As Double
Dim QuotaAns As Double
Dim SupportStaffID As Integer
Dim i As Integer
For i = (SupportStaffID = 10) To (SupportStaffID = 15)
QuotaAns = (1 / (TotalTickets + 1)) * Quota
QuotaArr(i) = QuotaAns
Next i
If QuotaArr(i) > (SupportStaffID = 11) Or (SupportStaffID = 15) Then
newTicket = (SupportStaffID = 10)
ElseIf QuotaArr(i) > (SupportStaffID = 10) Or (SupportStaffID = 15) Then
newTicket = (SupportStaffID = 11)
Else
newTicket = (SupportStaffID = 15)
End If
End Function
-
April 6th, 2009, 08:57 AM
#9
Re: RowDataBound(:
Quota has no value assigned to it in the code posted.
Your if statements look like they need to be part of your loop.
Not sure about the for statement you are using, never seen one done like that before.
I also see no need for the QuotaArr. If the if statements where within the loop you could simply use the QuotaAns.
NewTicket is not used once assigned so I have no idea what it is for but once the statements are placed in the loop it will only conatin the value for the last run of the loop.
Your function does not return a value.
SupportStaffID is also not assigned but you are checking its value. Its value will always be 0 if you do not assign it.
Seems like maybe this needs to be a parameter passed to the function rather than a local variable.
Last edited by DataMiser; April 6th, 2009 at 09:01 AM.
-
April 6th, 2009, 07:39 PM
#10
Re: RowDataBound(:
ohh okok..
i kind of get what you are saying..
i'll try to go work on the codes again..
and see if it works..thanx alot for your help..
i'll get back soon!(:
-
April 6th, 2009, 07:51 PM
#11
Re: RowDataBound(:
hey i tried putting my if statements into the for loop and passed my supportStaffID parameter into the function and took out the QuotaArr which u found it redundant if its inside my loop..
but nth works..i'll post my codes here..if u don't mind,pls help me check and work with me to solve this pls..thanx alot(:
-
April 6th, 2009, 08:06 PM
#12
Re: RowDataBound(:
ok this is my UI for submit ticket :
i have the different fields such as the subject,description,due date,the category type etc..
and a submit button
as soon as the user fills in all the fields and clicks on submit,the system will save the records in the database and automatically assign the ticket to a support staff depending on the quota for each support staff..the quota is saved in the database and i've gotta retrieve the value from the database.
datz y i came out wid the formula :
QuotaAns = (1 / (TotalTickets + 1)) * Quota
1 stands for that one new ticket juz submitted and the total tickets stands for the total tickets the particular staff has currently and the quota amount should be retrieved from the database..
quotaAns is the value which i should compare with the other staffs to determine to who the new ticket should go to.
and i put in the codes in the classes whr i have the sql statements..
i have this sql statement to retrieve the number of total ticket each staff has:
Code:
Public Function DBSelect_TotalTickets(Optional ByVal SupportStaffID As Integer = 0) As DataTable
Dim local_dbConn As New SqlConnection
Dim local_sqlCommand As New SqlCommand
local_dbConn = db_conn.DBConn
local_sqlCommand.Connection = local_dbConn
local_sqlCommand.CommandText = "SELECT COUNT(ID) FROM ITHelpDesk.dbo.Tickets where SupportStaffID = @xSupportStaffID"
local_sqlCommand.CommandText = CommandType.Text
Dim sql_adapter As New SqlDataAdapter(local_sqlCommand)
Dim dt As New DataTable
sql_adapter.Fill(dt)
If dt.Rows.Count > 0 Then
dt.PrimaryKey = New DataColumn() {dt.Columns("ID")}
End If
local_dbConn.Close()
Return dt
End Function
and i have this sql statement to retrieve the ID of the newest ticket inserted:
Code:
Public Function DBSelect_NewTicketID() As DataTable
Dim local_dbConn As New SqlConnection
Dim local_sqlCommand As New SqlCommand
local_dbConn = db_conn.DBConn
local_sqlCommand.Connection = local_dbConn
local_sqlCommand.CommandText = "SELECT MAX(ID) FROM ITHelpDesk.dbo.Tickets"
local_sqlCommand.CommandText = CommandType.Text
Dim sql_adapter As New SqlDataAdapter(local_sqlCommand)
Dim dt As New DataTable
sql_adapter.Fill(dt)
If dt.Rows.Count > 0 Then
dt.PrimaryKey = New DataColumn() {dt.Columns("ID")}
End If
local_dbConn.Close()
Return dt
End Function
and this the function i have to do the calculation;
Code:
Public Function CalculateQuota(Optional ByVal SupportStaffID As Integer = 0) As Double
Dim newTicket As Integer = 1
Dim TotalTickets As Integer
Dim Quota As Double
' Dim QuotaArr() As Double = Nothing
Dim QuotaAns As Double
Dim i As Integer
For i = 10 To 15
QuotaAns = (1 / (TotalTickets + 1)) * Quota
'QuotaArr(i) = QuotaAns
If QuotaAns > (SupportStaffID = 11) Or (SupportStaffID = 15) Then
newTicket = (SupportStaffID = 10)
ElseIf QuotaAns > (SupportStaffID = 10) Or (SupportStaffID = 15) Then
newTicket = (SupportStaffID = 11)
Else
newTicket = (SupportStaffID = 15)
End If
Next i
End Function
and this the code i have behind my button:
Code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim clsSupportStaffQuota_Obj As New clsSupportStaffQuota
clsSupportStaffQuota_Obj.CalculateQuota()
End Sub
i dunno what is going wrong here..please do help me..
it'll seriously be appreciated..
thx alot..do reply me asap..
thanx thanx!(:
Last edited by BabyAngel; April 6th, 2009 at 08:10 PM.
-
April 6th, 2009, 08:34 PM
#13
Re: RowDataBound(:
i debugged my codes under the calculateQuota function..
but al the values are 0..
how do i pass in the value..
i seriously having so much of headache with this..
pls help me..
-
April 6th, 2009, 08:59 PM
#14
Re: RowDataBound(:
I am not sure what you are trying to do with these lines of code
Code:
If QuotaAns > (SupportStaffID = 11) Or (SupportStaffID = 15) Then
newTicket = (SupportStaffID = 10)
ElseIf QuotaAns > (SupportStaffID = 10) Or (SupportStaffID = 15) Then
newTicket = (SupportStaffID = 11)
Else
newTicket = (SupportStaffID = 15)
End If
If I am not mistaken what you are in effect doing with this code is saying
If (QuotaAns > True) Or (SupportStaffID = 15) then
or
If (QuotaAns > False) Or (SupportStaffID = 15) then ' Depending on the value of supportstaffid
NewTicket=True ' or maybe NewTicket=False depending on the value passed in supportstaffid.
I doubt that this is what you are wanting to do here
As written it appears that the first part of the if will almost if not always be true Assuming QuotaAns > 0 or SupportStaffID=15
What value are you actually trying to assign to new ticket?
You also are not returning a value.
For example if you wanted the value of NewTicket returned to the calling code you would add a line near the bottom [just above the end fucntion]
Last edited by DataMiser; April 6th, 2009 at 09:03 PM.
-
April 6th, 2009, 09:07 PM
#15
Re: RowDataBound(:
This is totally wrong:
Code:
QuotaAns > (SupportStaffID = 11) Or (SupportStaffID = 15)
is the same thing as:
Code:
QuotaAns > (TRUE) Or (TRUE)
or
Code:
QuotaAns > (FALSE) Or (FALSE)
not what you want
Use Select Case for SupportStaffID
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|