Пример #1
0
        public UserInfo ValidateLogin(string username, string password)
        {
            if (String.IsNullOrEmpty(username.Trim()) || String.IsNullOrEmpty(password.Trim()))
            {
                return null;
            }
            else
            {
                da = new DAUser(dbProviderFactory);
                data = new UserData();

                data = da.ValidateLogin(username, password);

                if (data.ResultCode == ResultCodes.SUCCESSFUL_TRANSACTION)
                {
                    if (data.UserInformation != null)
                    {
                        return data.UserInformation;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
        }
Пример #2
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;
        }