示例#1
0
        internal bool GetTaskReward(out APIResponseDTO response)
        {
            Watch.Start();
            ExecuteTaskDTO checkRewardDTO = null;

            response = new APIResponseDTO();
            string transactionId = null;
            object taskReward    = null;


            try
            {
                if (!GetTaskIdFromRequest(this.request, out checkRewardDTO))
                {
                    response.SetErrorResponse("Invalid Request!", APIResponseDTO.RESULT_TYPE.ERROR);
                    return(false);
                }
                this.serverMgr.RemoteIncentiveEngine.RewardUser(checkRewardDTO.UserID, checkRewardDTO.TaskId, out transactionId, out taskReward);
                response.SetResponse(taskReward, APIResponseDTO.RESULT_TYPE.SUCCESS);
                return(true);
            }
            catch (Exception ex)
            {
                Global.Log.Error(ex.Message);
                return(false);
            }
        }
示例#2
0
        private bool GetTaskIdFromRequest(HttpRequest request, out ExecuteTaskDTO execTaskDTO)
        {
            string errorMessage = null;

            execTaskDTO = null;
            APIRequestDTO requestDTO;

            try
            {
                if (!Library.GetDTOFromRequest(request, out requestDTO, typeof(ExecuteTaskDTO).FullName, ref errorMessage))
                {
                    Global.Log.Error(errorMessage);
                    return(false);
                }
                execTaskDTO = (ExecuteTaskDTO)requestDTO;
                Global.Log.DebugFormat("User ID: [{0}] going to execute Task: [{1}]", execTaskDTO.UserID, execTaskDTO.TaskId);
                return(true);
            }
            catch (Exception ex)
            {
                Global.Log.Error(ex.Message);
                return(false);
            }
        }