Advanced Login System
Create Stored Procedures in MS SQL Server 2012
1- create a stored procedure with name "spAuthentication"
Go to, DBLoginSystem ->> Programmability ->> Stored Procedures
Right Click and Create new Stored Procedure
2-You will see pre-defined template as shown below.Just delete everthing in pre-defined template, copy the follwing script and paste it.
3-SQL Script: Store Procedure Authentication
βββββββββββ
USE [DBLoginSystem]
GO
/****** Object: StoredProcedure [dbo].[spAuthentication] Script Date: 01-12-2018 8.58.15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spAuthentication] (@Email varchar(50),
@Password varchar(50),
@Result varchar(100) OUTPUT,
@Role varchar(50) OUTPUT,
@userName varchar(50) OUTPUT)
AS
BEGIN
DECLARE @isActivated bit,
@isReAttempLoked bit,
@Count int,
@RetryCount int,
@RoleId int,
@UserInfo varchar(50);
SET NOCOUNT ON;
IF EXISTS (SELECT
*
FROM Users
WHERE Email = @Email)
BEGIN
--select @Result = 'Valid Credential';
SELECT
@isActivated = isActivated,
@RoleID = RoleID,
@UserInfo = UserName
FROM Users
WHERE Email = @Email
IF (@isActivated = 0)
BEGIN
SELECT
@Result = 'Your Account is locked by Admin.',
@Role = '',
@userName = '';
END
ELSE
BEGIN
--select @Result = 'Unlocked';
SELECT
@isReAttempLoked = isLocked
FROM Users
WHERE Email = @Email
IF (@isReAttempLoked = 1)
BEGIN
SELECT
@Result = 'Account has been locked by invalid credential attempt.',
@Role = '',
@userName = '';
END
ELSE
BEGIN
SELECT
@Count = COUNT(Email)
FROM Users
WHERE ([Email] = @Email)
AND [Password] = @Password
IF (@Count = 1)
BEGIN
-- Reset RetryAttempts
UPDATE Users
SET RetryAttempts = 0,
LastLogin = GETDATE()
WHERE Email = @Email
SELECT
@Result = 'Logged Successfully!',
@Role = (SELECT
RoleName
FROM Roles
WHERE RoleID = @RoleID),
@userName = @UserInfo;
END
ELSE
BEGIN
-- If a match is not found
SELECT
@RetryCount = ISNULL(RetryAttempts, 0)
FROM Users
WHERE Email = @Email
SET @RetryCount = @RetryCount + 1
IF (@RetryCount <= 3)
BEGIN
-- If re-try attempts are not completed
UPDATE Users
SET RetryAttempts = @RetryCount
WHERE Email = @Email
SELECT
@Result = 'Invalid Password, No of attemps ' + CONVERT(varchar(50), @RetryCount) + ' out of 3.',
@Role = '',
@userName = '';
END
ELSE
BEGIN
-- If re-try attempts are completed
UPDATE Users
SET RetryAttempts = @RetryCount,
IsLocked = 1,
LockedDateTime = GETDATE()
WHERE Email = @Email
SELECT
@Result = 'Your account is locked.',
@Role = '',
@userName = '';
END
END
END
END
END
ELSE
BEGIN
SELECT
@Result = 'Invalid email Id.',
@Role = '',
@userName = '';
END
END
GO
βββββββββββββββββββββββββ-Subscribe @coderbaba
4- run script
5-Check Email against database if false returns "Invalid Email Id".
6-If user account is blocked then it returns "Your account has been blocked by Admin. Please contact Administrator".
7-If user account is locked due to invalid credential attempts then it returns "Account has been locked by invalid credential attempts."
8-If Email Id and Password not matched against Database then
Retry count increase by 1
Create Stored Procedures in MS SQL Server 2012
1- create a stored procedure with name "spAuthentication"
Go to, DBLoginSystem ->> Programmability ->> Stored Procedures
Right Click and Create new Stored Procedure
2-You will see pre-defined template as shown below.Just delete everthing in pre-defined template, copy the follwing script and paste it.
3-SQL Script: Store Procedure Authentication
βββββββββββ
USE [DBLoginSystem]
GO
/****** Object: StoredProcedure [dbo].[spAuthentication] Script Date: 01-12-2018 8.58.15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spAuthentication] (@Email varchar(50),
@Password varchar(50),
@Result varchar(100) OUTPUT,
@Role varchar(50) OUTPUT,
@userName varchar(50) OUTPUT)
AS
BEGIN
DECLARE @isActivated bit,
@isReAttempLoked bit,
@Count int,
@RetryCount int,
@RoleId int,
@UserInfo varchar(50);
SET NOCOUNT ON;
IF EXISTS (SELECT
*
FROM Users
WHERE Email = @Email)
BEGIN
--select @Result = 'Valid Credential';
SELECT
@isActivated = isActivated,
@RoleID = RoleID,
@UserInfo = UserName
FROM Users
WHERE Email = @Email
IF (@isActivated = 0)
BEGIN
SELECT
@Result = 'Your Account is locked by Admin.',
@Role = '',
@userName = '';
END
ELSE
BEGIN
--select @Result = 'Unlocked';
SELECT
@isReAttempLoked = isLocked
FROM Users
WHERE Email = @Email
IF (@isReAttempLoked = 1)
BEGIN
SELECT
@Result = 'Account has been locked by invalid credential attempt.',
@Role = '',
@userName = '';
END
ELSE
BEGIN
SELECT
@Count = COUNT(Email)
FROM Users
WHERE ([Email] = @Email)
AND [Password] = @Password
IF (@Count = 1)
BEGIN
-- Reset RetryAttempts
UPDATE Users
SET RetryAttempts = 0,
LastLogin = GETDATE()
WHERE Email = @Email
SELECT
@Result = 'Logged Successfully!',
@Role = (SELECT
RoleName
FROM Roles
WHERE RoleID = @RoleID),
@userName = @UserInfo;
END
ELSE
BEGIN
-- If a match is not found
SELECT
@RetryCount = ISNULL(RetryAttempts, 0)
FROM Users
WHERE Email = @Email
SET @RetryCount = @RetryCount + 1
IF (@RetryCount <= 3)
BEGIN
-- If re-try attempts are not completed
UPDATE Users
SET RetryAttempts = @RetryCount
WHERE Email = @Email
SELECT
@Result = 'Invalid Password, No of attemps ' + CONVERT(varchar(50), @RetryCount) + ' out of 3.',
@Role = '',
@userName = '';
END
ELSE
BEGIN
-- If re-try attempts are completed
UPDATE Users
SET RetryAttempts = @RetryCount,
IsLocked = 1,
LockedDateTime = GETDATE()
WHERE Email = @Email
SELECT
@Result = 'Your account is locked.',
@Role = '',
@userName = '';
END
END
END
END
END
ELSE
BEGIN
SELECT
@Result = 'Invalid email Id.',
@Role = '',
@userName = '';
END
END
GO
βββββββββββββββββββββββββ-Subscribe @coderbaba
4- run script
5-Check Email against database if false returns "Invalid Email Id".
6-If user account is blocked then it returns "Your account has been blocked by Admin. Please contact Administrator".
7-If user account is locked due to invalid credential attempts then it returns "Account has been locked by invalid credential attempts."
8-If Email Id and Password not matched against Database then
Retry count increase by 1
9-If Retry Count > 3 then (Invalid credential Attempts)
User Account will be locked automatically and returns "Your account has been locked by invalid credential attempts".
10-If Email Id and Password matched against Database then
Retry count = 0 (Clears previous invalid attempts)
returns "Logged Successfully"
If Role is Admin then Populate Admin Form
11-else If Role is Employee then Populate Employee Form.
User Account will be locked automatically and returns "Your account has been locked by invalid credential attempts".
10-If Email Id and Password matched against Database then
Retry count = 0 (Clears previous invalid attempts)
returns "Logged Successfully"
If Role is Admin then Populate Admin Form
11-else If Role is Employee then Populate Employee Form.
TECH MAHINDRA Interview - 2022
Online TR :
Explain the Project !
Tell me about your family !
Why I have to pay for you?
Why IT ? (As I am from ECE)
Asked like " I have only one job offer , can you sacrifice it to your friend rather than to you?"
Online HR :
Tell me about yourself and about project apart from the technical part
What do you know about Tech Mahindra?
Are you willing to accept the 2 years service agreement?
Can you work for more hours?
Ready to relocate?
At present any Offers?
follow @coder_baba
Online TR :
Explain the Project !
Tell me about your family !
Why I have to pay for you?
Why IT ? (As I am from ECE)
Asked like " I have only one job offer , can you sacrifice it to your friend rather than to you?"
Online HR :
Tell me about yourself and about project apart from the technical part
What do you know about Tech Mahindra?
Are you willing to accept the 2 years service agreement?
Can you work for more hours?
Ready to relocate?
At present any Offers?
follow @coder_baba
EPAM Interview Experience - 2022
1. Tell me about yourself.
2. Can you tell us about the last project you worked on?
3. Tell us about a time something went wrong in a project you were managing.
4. How do you prioritize tasks in a project?
5. What was your most successful project?
6. Whatβs your experience with budget management?
7. How would you describe a project plan?
8. How would you create an environment of
9. What tools do you use to plan a project?
10. Describe your experience in this industry.
11. One of your team members is asking for more time
12. How would you deal with a difficult stakeholder?
follow @coder_baba
1. Tell me about yourself.
2. Can you tell us about the last project you worked on?
3. Tell us about a time something went wrong in a project you were managing.
4. How do you prioritize tasks in a project?
5. What was your most successful project?
6. Whatβs your experience with budget management?
7. How would you describe a project plan?
8. How would you create an environment of
9. What tools do you use to plan a project?
10. Describe your experience in this industry.
11. One of your team members is asking for more time
12. How would you deal with a difficult stakeholder?
follow @coder_baba
NTT DATA Interview Experience
1) Introduce youself?
2) Tell me about your college!
3) Rate youself on the scale of 1β5(C knowlege)
4) write a number pattern generation program!
5) Itβs ok! What is a pointer? Types?
6) Tell me about your mini project
7) Have you planned you major project?
8) Gave me program and asked me to find the o/p!
9) Let me test your analytical and logical skills! Gave me a puzzle
10) What is an operating system? Uses?
11) What is Kernel?
12) What is processor and Describe its operation?
13) What is a circuit?( ECE)
14) Why should we hire you being very poor in technical?
subscribe https://www.youtube.com/coderbaba
1) Introduce youself?
2) Tell me about your college!
3) Rate youself on the scale of 1β5(C knowlege)
4) write a number pattern generation program!
5) Itβs ok! What is a pointer? Types?
6) Tell me about your mini project
7) Have you planned you major project?
8) Gave me program and asked me to find the o/p!
9) Let me test your analytical and logical skills! Gave me a puzzle
10) What is an operating system? Uses?
11) What is Kernel?
12) What is processor and Describe its operation?
13) What is a circuit?( ECE)
14) Why should we hire you being very poor in technical?
subscribe https://www.youtube.com/coderbaba