示例#1
0
        public Result VerifyUser(UserDataObject UserObj)
        {
            try
            {
                UserDataBase obj = new UserDataBase();
                Result       VerificationResult = new Result();
                if (UserObj.Emailid == "" || UserObj.Emailid == null)
                {
                    VerificationResult.Message = "Email ID is Required";
                    VerificationResult.Status  = "Failure";
                    return(VerificationResult);
                }
                else if (UserObj.Password == "" || UserObj.Password == null)
                {
                    VerificationResult.Message = "Password is Required";
                    VerificationResult.Status  = "Failure";
                    return(VerificationResult);
                }

                UserDataObject DBVerificationResponse = new UserDataObject();
                DBVerificationResponse = obj.VerifyUser(UserObj.Emailid);

                if (DBVerificationResponse.Password.Equals(UserObj.Password))
                {
                    VerificationResult.Status   = "Success";
                    VerificationResult.Message  = "User Successfully Logged In";
                    VerificationResult.Adminid  = DBVerificationResponse.Adminid;
                    VerificationResult.UserName = DBVerificationResponse.UserName;
                }
                else
                {
                    VerificationResult.Status  = "Failure";
                    VerificationResult.Message = "Wrong Credentials";
                }

                return(VerificationResult);
            }
            catch
            {
                throw;
            }
        }