Esempio n. 1
0
        public UserData ValidateLogin(string username, string password)
        {
            UserData data = new UserData();
            try
            {
                UserInfo info = new UserInfo();
                info = RetriveUserInformation(username, password);

                ResultData result = new ResultData();
                if (info != null)
                {

                    result = UpdateLoginHistory("Login Successfully", info.EmployeeID);

                    if (result != null)
                    {
                        if (result.ResultCode == 0)
                        {
                            data.UserInformation = info;
                            data.ResultCode = ResultCodes.SUCCESSFUL_TRANSACTION;
                            data.ResultMessage = ResultCodes.toDesctiption(ResultCodes.SUCCESSFUL_TRANSACTION);
                        }
                        else
                        {
                            data.ResultCode = ResultCodes.UNSUCCESSFUL_TRANSACTION;
                            data.ResultMessage = ResultCodes.toDesctiption(ResultCodes.UNSUCCESSFUL_TRANSACTION);
                        }
                    } else
                    {
                        data.ResultCode = ResultCodes.UNSUCCESSFUL_TRANSACTION;
                        data.ResultMessage = ResultCodes.toDesctiption(ResultCodes.UNSUCCESSFUL_TRANSACTION);
                    }
                } else
                {
                    data.ResultCode = ResultCodes.UNSUCCESSFUL_TRANSACTION;
                    data.ResultMessage = ResultCodes.toDesctiption(ResultCodes.UNSUCCESSFUL_TRANSACTION);

                }

            }
            catch (Exception e)
            {
                data = new UserData();
                data.ResultCode = ResultCodes.UNSUCCESSFUL_TRANSACTION;
                data.ResultMessage = ResultCodes.toDesctiption(ResultCodes.UNSUCCESSFUL_TRANSACTION);
            }
            return data;
        }
Esempio n. 2
0
        private ResultData CreateUpdateLoginHistory(IDataReader reader)
        {
            ResultData r = new ResultData()
            {
                ResultCode = DataAccessUtility.Retrieve<int>(reader, VJColumnName.CONST_RESULT_CODE),
                ResultMessage = DataAccessUtility.Retrieve<string>(reader, VJColumnName.CONST_RESULT_MESSAGE)
            };

            return r;
        }