コード例 #1
0
        public GetUserGuidByFBTokenResponse GetUserGuidByToken(GetUserGuidByFBTokenRequest request)
        {
            GetUserGuidByFBTokenResponse response = new GetUserGuidByFBTokenResponse();

            try
            {
                if (new EFUserTokenMethodsCAP().IsExistByFBToken(request.fbToken))
                {
                    UserToken user = new EFUserTokenMethodsCAP().GetByFBToken(request.fbToken);

                    response.UserGuid = user.UserGuid;
                    response.Result   = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.SUCCESS, Message = "létezik"
                    };
                }
                else
                {
                    response.Result = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.INEFFECTIVE, Message = "nem létezik"
                    };
                }
            }
            catch (Exception exception)
            {
                response.Result = (new Ac4yProcessResult()
                {
                    Code = Ac4yProcessResult.FAIL, Message = exception.Message, Description = exception.StackTrace
                });
            }
            return(response);
        }
コード例 #2
0
        public GetUserByTokenResponse GetUserByToken(GetUserByTokenRequest request)
        {
            GetUserByTokenResponse response = new GetUserByTokenResponse();

            try
            {
                UserToken userToken = new EFUserTokenMethodsCAP().GetByFBToken(request.fbToken);

                User user = new EFUserMethodsCAP().GetByGuid(userToken.UserGuid);
                response.User   = user;
                response.Json   = JsonConvert.SerializeObject(user);
                response.Result = new Ac4yProcessResult()
                {
                    Code = Ac4yProcessResult.SUCCESS, Message = "Megvan a tokenhez tartozó user"
                };
            }
            catch (Exception exception)
            {
                response.Result = (new Ac4yProcessResult()
                {
                    Code = Ac4yProcessResult.FAIL, Message = exception.Message, Description = exception.StackTrace
                });
            }
            return(response);
        }
コード例 #3
0
        public DeleteUserResponse DeleteUser(DeleteUserRequest request)
        {
            DeleteUserResponse response = new DeleteUserResponse();

            try
            {
                UserToken userToken = new EFUserTokenMethodsCAP().GetByFBToken(request.fbToken);

                if (userToken != null)
                {
                    User user = new EFUserMethodsCAP().GetByGuid(userToken.UserGuid);
                    response.UserGuid = user.Guid;

                    if (user != null)
                    {
                        new EFUserMethodsCAP().DeleteUser(user);

                        response.Result = new Ac4yProcessResult()
                        {
                            Code = Ac4yProcessResult.SUCCESS, Message = "user törölve"
                        };
                    }
                    else
                    {
                        response.Result = new Ac4yProcessResult()
                        {
                            Code = Ac4yProcessResult.INEFFECTIVE, Message = "a usert nem sikerült kiolvasni"
                        }
                    };
                }
                else
                {
                    response.Result = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.INEFFECTIVE, Message = "ezzel a tokennel nincs user-token pár"
                    }
                };
            }
            catch (Exception exception)
            {
                response.Result = (new Ac4yProcessResult()
                {
                    Code = Ac4yProcessResult.FAIL, Message = exception.Message, Description = exception.StackTrace
                });
            }
            return(response);
        }
コード例 #4
0
        public CheckSerialNumberResponse CheckSerialNumber(CheckSerialNumberRequest request)
        {
            CheckSerialNumberResponse response = new CheckSerialNumberResponse();

            try
            {
                if (new EFUserMethodsCAP().IsExistById(request.SerialNumber))
                {
                    User             user      = new EFUserMethodsCAP().GetById(request.SerialNumber);
                    List <UserToken> tokenList = new EFUserTokenMethodsCAP().GetListByGuid(user.Guid);

                    response.UserGuid = user.Guid;
                    response.Result   = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.SUCCESS, Message = "létezik az adott serial number"
                    };

                    foreach (var token in tokenList)
                    {
                        if (request.fbToken.Equals(token.fbToken))
                        {
                            response.UserGuid = null;
                            response.Result   = new Ac4yProcessResult()
                            {
                                Code = Ac4yProcessResult.INEFFECTIVE, Message = "a token már a userhez van rendelve"
                            };
                        }
                    }
                }
                else
                {
                    response.Result = new Ac4yProcessResult()
                    {
                        Code = Ac4yProcessResult.INEFFECTIVE, Message = "nem létezik az adott serial number"
                    };
                }
            }
            catch (Exception exception)
            {
                response.Result = (new Ac4yProcessResult()
                {
                    Code = Ac4yProcessResult.FAIL, Message = exception.Message, Description = exception.StackTrace
                });
            }
            return(response);
        }