Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a user table in the SQL Server in which the fields are:
UserID --> Int,
Username --> Varchar(40),
Password --> Varchar(50),
UserType --> Varchar(10),
IsSuperUser --> Bool,
EmailAddress --> Varchar(255)

when a user signin in his account there i was checking failure attempts for three times. But the user is a IsSuperUser then he can signin several times otherwise the user gets the alert message for first, second and third attempts and later on the user will be locked. Now the IsSuperUser handles and unlocks the locked user. how can i achieve this please anybody help me

What I have tried:

if (ObjUser.IsSuperUser)
    Response.Redirect("~/Signin.aspx", false);
else
    Reaming users count code here... // <-- Everything works fine here.

Here ObjUser is business class object having property IsSuperUser get and set;
If i enter username capital letters then the user is not considering the user as IsSuperUser. For this i have i have converted to lower but no chance how can i achieve this
Posted
Updated 24-Jan-19 19:35pm
Comments
Member 14129317 25-Jan-19 1:20am    
using Matrix = MathNet.Numerics.LinearAlgebra.Matrix<double>;
Member 8583441 25-Jan-19 1:32am    
I have tried using ternary operator and the problem has resolved.
ObjUser.IsSuperUser = (dr["UserName"].ToString() == uname.ToLower() && Convert.ToBoolean(dr["IsSuperUser"]) == true) ? true : false;

using Matrix = MathNet.Numerics.LinearAlgebra.Matrix<double>; this error  resolve
 
Share this answer
 
Comments
Member 8583441 25-Jan-19 1:31am    
can i have the namespace for MathNet sir
Richard Deeming 25-Jan-19 11:56am    
Absolutely nothing to do with the question!

If you want to ask a question, then ASK A QUESTION[^]. DO NOT post your question as a "solution" to someone else's question.

And be warned: you'll need to provide a lot more information than you have here if you want anyone to help you.
using Matrix = MathNet.Numerics.LinearAlgebra.Matrix<double>;
 
Share this answer
 
Comments
Richard Deeming 25-Jan-19 11:57am    
And again, absolutely nothing to do with the question!

Why have you posted the same non-solution twice?
My solution is
ObjUser.IsSuperUser = (dr["UserName"].ToString() == uname.ToLower() && Convert.ToBoolean(dr["IsSuperUser"]) == true) ? true : false;
 
Share this answer
 
Comments
OriginalGriff 25-Jan-19 1:43am    
That's terrible! First you compare a Boolean value against true, then you use a conditional operator to convert it to what is was to start with!
Member 8583441 25-Jan-19 1:48am    
Now i got your point sir thanks for suggesting the perfect solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900